!1051 优化:加入是否记忆上次配置选项

pull/1051/MERGE
ZoeLeeFZ 4 years ago committed by ChenX
parent ad58856836
commit a74b1e4020

@ -29,7 +29,7 @@ export interface ICursorConfig extends IBaseOption
export class UserConfig implements IConfigStore export class UserConfig implements IConfigStore
{ {
private readonly _version = 6; private readonly _version = 7;
_renderType: RenderType = RenderType.Wireframe; _renderType: RenderType = RenderType.Wireframe;
@observable maxSize: IMaxSizeProps = { @observable maxSize: IMaxSizeProps = {
height: 2440, height: 2440,
@ -65,6 +65,7 @@ export class UserConfig implements IConfigStore
time: 1, time: 1,
}; };
@observable showLines = false; @observable showLines = false;
@observable keepConfig = false;
constructor() constructor()
{ {
this.Init(); this.Init();
@ -132,6 +133,7 @@ export class UserConfig implements IConfigStore
cursorSize: toJS(this.cursorSize), cursorSize: toJS(this.cursorSize),
autoSaveConfig: toJS(this.autoSaveConfig), autoSaveConfig: toJS(this.autoSaveConfig),
showLines: this.showLines, showLines: this.showLines,
keepConfig: this.keepConfig,
} }
}; };
} }
@ -164,6 +166,10 @@ export class UserConfig implements IConfigStore
{ {
this.showLines = config.option.showLines; this.showLines = config.option.showLines;
} }
if (config.option.version > 6)
{
this.keepConfig = config.option.keepConfig;
}
} }
} }

@ -108,7 +108,7 @@ export class UserConfig extends React.Component<IConfigProps, UserConfigState>{
curName = confNames[0]; curName = confNames[0];
this.props.store.configName = curName; this.props.store.configName = curName;
if (type !== BoardModalType.TempDes && !this._userConfigStore.readConfigs.has(type)) if (!userConfig.keepConfig || type !== BoardModalType.TempDes && !this._userConfigStore.readConfigs.has(type))
this.updateBoardOption(curName); this.updateBoardOption(curName);
} }
if (type === BoardModalType.TempDes) if (type === BoardModalType.TempDes)

@ -102,6 +102,8 @@ export class DrawConfigPanel extends React.Component<IConfigProps, {}> {
</div> </div>
<H5></H5> <H5></H5>
<Checkbox label="显示纹路" checked={userConfig.showLines} onChange={() => userConfig.showLines = !userConfig.showLines} /> <Checkbox label="显示纹路" checked={userConfig.showLines} onChange={() => userConfig.showLines = !userConfig.showLines} />
<H5></H5>
<Checkbox label="保持上次配置" checked={userConfig.keepConfig} onChange={() => userConfig.keepConfig = !userConfig.keepConfig} />
</Card> </Card>
); );
} }

Loading…
Cancel
Save