!720 加入酷家乐配置

pull/720/MERGE
ZoeLeeFZ 5 years ago committed by ChenX
parent efa7d71f94
commit 85f17bbe03

@ -312,8 +312,8 @@ export class BoardFindModify implements Command
}
private async FindMaxSizeBrs()
{
let maxHeight = userConfig.maxHeight;
let maxWidth = userConfig.maxWidth;
let maxHeight = userConfig.maxSize.height;
let maxWidth = userConfig.maxSize.width;
const isLongBr = (br: Board) =>
{

@ -189,14 +189,16 @@ function ParseModel(model: KJL_ParamModel, roomName: string, gName: string, pare
let bmodel = model as KJL_ParamModel_Board;
if (!bmodel.paramPlankPath)
return;
const kjlConfig = userConfig.kjlConfig;
let [pls, edgesBandings] = ParsePathOutlineAndHole(bmodel.paramPlankPath.path, edgeBandingAll);
let br = new Board();
br.Name = model.modelName;
br.BoardProcessOption[EBoardKeyList.RoomName] = roomName;
br.BoardProcessOption[EBoardKeyList.CabinetName] = gName;
br.GroovesAddDepth = 1;
br.GroovesAddLength = safeEval(kjlConfig.grooveAddLength);
br.GroovesAddWidth = safeEval(kjlConfig.grooveAddWidth);
br.GroovesAddDepth = safeEval(kjlConfig.grooveAddDepth);
br.Thickness = bmodel.thickness;
const isInv = pls[0].Area2 < 0;
br.ContourCurve = pls[0];

@ -15,6 +15,7 @@ export enum CheckObjectType
RLB = "rotateLayerBoard",
BBC = "boardbatchcurtail",
BBS = "lookoverboardinfos",
OnlyNumber = "onlyNum",
}
export namespace CheckoutValid
@ -91,6 +92,9 @@ export namespace CheckoutValid
return CheckBoardBatchCurtail(k, v);
case CheckObjectType.BBS:
return CheckLookOverBoardInfos(k, v);
case CheckObjectType.OnlyNumber:
if (!isNum(v))
return "数值不能为空且必须为数字";
default:
return "";
}

@ -13,4 +13,5 @@ export enum StoreageKeys
Goods = "Goods_",
DrillTemp = "drilltemp_",
DrillReactor = "drillRreactor",
kjlConfig = "kjl",
}

@ -5,6 +5,13 @@ import { StoreageKeys } from "../Common/StoreageKeys";
import { IWineRackOption } from "../UI/Store/WineRackInterface";
import { PostJson, RequestStatus } from "../Common/Request";
import { ConfigUrls } from "../Common/HostUrl";
import { IBaseOption, IGrooveOption } from "../UI/Store/BoardInterface";
export interface IMaxSizeProps extends IBaseOption
{
height: number;
width: number;
}
/**
* TODO:,sessionStroage
@ -12,8 +19,10 @@ import { ConfigUrls } from "../Common/HostUrl";
export class UserConfig
{
_renderType: RenderType = RenderType.Wireframe;
@observable maxHeight = 2440;
@observable maxWidth = 1220;
@observable maxSize: IMaxSizeProps = {
height: 2440,
width: 1220,
}
isContinuousDraw = false; //是否连续绘制层板立板背板...
@observable private _drillConfigs: Map<string, DrillingOption[]> = new Map();
@observable openDrillingReactor = true;
@ -24,6 +33,11 @@ export class UserConfig
userConfigName: { [key: string]: string; } = {};
@observable modeling2HoleRad = 20; //圆造型小于等于该值拆成孔数据
@observable isAdmin = false;
@observable kjlConfig: IGrooveOption = {
grooveAddLength: "0",
grooveAddWidth: "0",
grooveAddDepth: "1",
};
constructor()
{
this.Init();
@ -35,6 +49,11 @@ export class UserConfig
this._renderType = parseFloat(type);
this.openDrillingReactor = !!localStorage.getItem(StoreageKeys.DrillReactor);
const kjlCof = localStorage.getItem(StoreageKeys.kjlConfig);
if (kjlCof)
Object.assign(this.kjlConfig, JSON.parse(kjlCof));
}
set RenderType(t: RenderType)
{

@ -195,6 +195,27 @@
}
}
#modal #optionModal .kjl-config {
&>label {
width: 50%;
display: flex;
&>span:first-child {
width: 30%;
}
&>input,
&>span:last-child {
width: 70%;
input {
width: 100%;
margin: 0;
}
}
}
}
@import (less) "BoardModal.less";
@import (less) "ArrayModal.less";
@import (less) "DrillModal.less";

@ -1,6 +1,6 @@
import React = require("react");
import { Button, Card, Classes, H4, Icon, Intent, Tab, Tabs } from "@blueprintjs/core";
import { observable } from "mobx";
import { observable, toJS } from "mobx";
import { observer } from "mobx-react";
import { Color } from "three";
import { begin } from "xaop";
@ -12,6 +12,7 @@ import { userConfig } from "../../../../Editor/UserConfig";
import { DisplayConfigPanel } from "./DisplayConfigPanel";
import { DrawConfigPanel } from "./DrawConfigPanel";
import { SystemConfigPanel } from "../SystemConfig";
import { StoreageKeys } from "../../../../Common/StoreageKeys";
export enum EOptionTabId
{
@ -33,12 +34,13 @@ export class ConfigStore extends Singleton
app.Editor.ModalManage.Clear();
app.Viewer.Renderer.setClearColor(new Color(this.bgColor), 1);
app.Viewer.UpdateRender();
}
};
OnOK = () =>
{
this.oldBgcolor = this.bgColor;
localStorage.setItem(StoreageKeys.kjlConfig, JSON.stringify(toJS(userConfig.kjlConfig)));
app.Editor.ModalManage.Clear();
}
};
}
/**
@ -79,7 +81,7 @@ export class ConfigDialog extends React.Component
this.curFileTitle = fserver.currentFileInfo.name;
else
this.curFileTitle = "新图纸";
}
};
render()
{
const store = ConfigStore.GetInstance() as ConfigStore;
@ -131,6 +133,6 @@ export class ConfigDialog extends React.Component
</div>
</div>
</div>
)
);
}
}

@ -2,9 +2,13 @@ import { Card, Checkbox, Classes, H5, Label } from '@blueprintjs/core';
import { observer } from 'mobx-react';
import * as React from 'react';
import { app } from '../../../../ApplicationServices/Application';
import { UserConfig } from '../../../../Editor/UserConfig';
import { safeEval } from '../../../../Common/eval';
import { UserConfig, IMaxSizeProps } from '../../../../Editor/UserConfig';
import { StoreageKeys } from '../../../../Common/StoreageKeys';
import { observable, has } from 'mobx';
import { DataAdapter } from './../../../../Common/DataAdapter';
import { ToasterInput } from '../../Toaster';
import { CheckObjectType } from '../../../../Common/CheckoutVaildValue';
import { IUiOption } from '../../../Store/BoardInterface';
interface IConfigProps
{
@ -13,6 +17,7 @@ interface IConfigProps
@observer
export class DrawConfigPanel extends React.Component<IConfigProps, {}> {
@observable maxSizeConfig: IUiOption<IMaxSizeProps>;
private toggleDrillingReactor = () =>
{
const userConfig = this.props.store;
@ -26,10 +31,15 @@ export class DrawConfigPanel extends React.Component<IConfigProps, {}> {
userConfig.openAutoCuttingReactor = !userConfig.openAutoCuttingReactor;
app._autoCuttingReactor.Enable = userConfig.openAutoCuttingReactor;
};
UNSAFE_componentWillMount()
{
const cof = this.props.store;
this.maxSizeConfig = DataAdapter.ConvertUIData(cof.maxSize);
}
public render()
{
const userConfig = this.props.store;
const { kjlConfig } = userConfig;
return (
<Card>
<H5></H5>
@ -45,24 +55,44 @@ export class DrawConfigPanel extends React.Component<IConfigProps, {}> {
onChange={this.toggleAutoCuttingReactor}
/>
<H5></H5>
<Label className={Classes.INLINE}>
<span></span>
<input
type="text"
className={Classes.INPUT}
value={userConfig.maxHeight}
onChange={e => userConfig.maxHeight = safeEval(e.target.value)}
/>
</Label>
<Label className={Classes.INLINE}>
<span></span>
<input
type="text"
className={Classes.INPUT}
value={userConfig.maxWidth}
onChange={e => userConfig.maxWidth = safeEval(e.target.value)}
/>
</Label>
{
[["板长", "height"], ["板宽", "width"]].map(([t, k]) =>
<Label className={Classes.INLINE}>
<span>{t}</span>
<ToasterInput
type={CheckObjectType.OnlyNumber}
option={userConfig.maxSize}
uiOption={this.maxSizeConfig}
optKey={k}
onBlur={(e, hasError) =>
{
if (hasError)
this.maxSizeConfig[k] = userConfig.maxSize[k].toString()
}}
/>
</Label>
)
}
<H5></H5>
<div className="flex-wrap kjl-config">
{
[["槽加长", "grooveAddLength"], ["槽加宽", "grooveAddWidth"], ["槽加深", "grooveAddDepth"]].map(([t, k]) =>
<Label className={Classes.INLINE}>
<span>{t}</span>
<ToasterInput
type={CheckObjectType.OnlyNumber}
option={kjlConfig}
optKey={k}
onBlur={(e, hasErr) =>
{
if (hasErr)
kjlConfig[k] = "0"
}}
/>
</Label>
)
}
</div>
</Card>
);
}

@ -13,7 +13,7 @@ export const AppToaster = Toaster.create({
interface IToasterInputProps extends ISetItemOption
{
inputClassName?: string;
onBlur?(e?);
onBlur?(e?, hasError?: boolean);
onClick?(e?);
callback?: Function;
}
@ -82,7 +82,7 @@ export class ToasterInput extends React.Component<IToasterInputProps, {}>
this.hideErrorMsg = true;
if (this.props.onBlur)
{
this.props.onBlur(e);
this.props.onBlur(e, this.errorMsg !== "");
this.getErrorMsg(this.showData[this.props.optKey]);
}
};

@ -616,3 +616,7 @@ img {
.right{
text-align: right;
}
.flex-wrap{
.flex();
flex-wrap: wrap;
}

@ -250,7 +250,7 @@ export interface IGrooveOption extends IBaseOption
grooveAddLength: string;//槽加长/宽/高
grooveAddWidth: string;
grooveAddDepth: string;
knifeRadius: string;
knifeRadius?: string;
}
export interface IShinkOption extends IBaseOption

Loading…
Cancel
Save