From 17d158585c484dd876279ef15b1493d811720681 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E8=AF=97=E6=B4=A5?= <2723065175@qq.com> Date: Fri, 10 Nov 2023 02:18:50 +0000 Subject: [PATCH] =?UTF-8?q?!2446=20=E5=8A=9F=E8=83=BD:=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E6=8F=92=E5=85=A5=E6=97=B6=E5=8F=98=E6=96=B9?= =?UTF-8?q?=E6=A1=86=E7=9A=84=E4=B8=AA=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Common/CheckoutVaildValue.ts | 9 ++++++ src/Editor/UserConfig.ts | 10 ++++-- .../Modal/OptionModal/DisplayConfigPanel.tsx | 31 +++++++++++++++++++ .../Template/InsertTemplateByBasePoint.ts | 3 +- src/UI/Components/Toaster.tsx | 4 ++- 5 files changed, 53 insertions(+), 4 deletions(-) diff --git a/src/Common/CheckoutVaildValue.ts b/src/Common/CheckoutVaildValue.ts index 2e3b9371d..b7beaf946 100644 --- a/src/Common/CheckoutVaildValue.ts +++ b/src/Common/CheckoutVaildValue.ts @@ -690,6 +690,15 @@ export namespace CheckoutValid } return ""; } + case "templateDisplayCount": + { + let val = safeEval(v); + if (val < 1 || val > 10000) + { + return "最大显示个数区间为1-10000"; + } + return ""; + } default: return ""; } diff --git a/src/Editor/UserConfig.ts b/src/Editor/UserConfig.ts index 73a05b7fd..756a73ceb 100644 --- a/src/Editor/UserConfig.ts +++ b/src/Editor/UserConfig.ts @@ -44,7 +44,7 @@ export interface IChat export class UserConfig implements IConfigStore { - private readonly _version = 36; //🌟🌟每次更新必须向上添加一次版本号🌟🌟 + private readonly _version = 37; //🌟🌟每次更新必须向上添加一次版本号🌟🌟 @observable designer = ""; //一键布局的设计师 _renderType: RenderType = RenderType.Wireframe; @observable maxSize: IMaxSizeProps = { @@ -172,7 +172,7 @@ export class UserConfig implements IConfigStore pageFooterName: "", //页脚名称 printResolution: 1450, }; - + @observable templateDisplayCount: number = 100; //插入模板时显示的最大个数 constructor() { this.Init(); @@ -272,6 +272,7 @@ export class UserConfig implements IConfigStore pageFooterName: "", printResolution: 1450, }); + this.templateDisplayCount = 100; } SaveConfig() { @@ -326,6 +327,7 @@ export class UserConfig implements IConfigStore printOption: toJS(this.printOption), show2DPathLine: this.show2DPathLine, show2DPathObject: this.show2DPathObject, + templateDisplayCount: this.templateDisplayCount, } }; } @@ -488,6 +490,10 @@ export class UserConfig implements IConfigStore this.show2DPathLine = config.option.show2DPathLine; this.show2DPathObject = config.option.show2DPathObject; } + if (config.option.version > 36) + { + this.templateDisplayCount = config.option.templateDisplayCount; + } } } diff --git a/src/UI/Components/Modal/OptionModal/DisplayConfigPanel.tsx b/src/UI/Components/Modal/OptionModal/DisplayConfigPanel.tsx index 0dc7eee5e..99a8c7868 100644 --- a/src/UI/Components/Modal/OptionModal/DisplayConfigPanel.tsx +++ b/src/UI/Components/Modal/OptionModal/DisplayConfigPanel.tsx @@ -51,6 +51,9 @@ export const ColorList: [string, number][] = [ @observer export class DisplayConfigPanel extends React.Component<{ store: ConfigStore; }> { + private currentOpt = { + templateDisplayCount: userConfig.templateDisplayCount, + }; @observable private _OpenColorPick = false; @observable _AAType = "性能"; @observable _ZoomSpeed: number = userConfig.viewSize.zoomSpeed; @@ -423,6 +426,34 @@ export class DisplayConfigPanel extends React.Component<{ store: ConfigStore; }> +