diff --git a/package.json b/package.json index 7331db162..0dcf04f09 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,7 @@ "webpack-dev-server": "^2.11.1" }, "dependencies": { - "@blueprintjs/core": "^1.35.2", + "@blueprintjs/core": "^1.39.0", "blueimp-md5": "^2.10.0", "css-element-queries": "^1.0.2", "dat.gui": "^0.7.1", diff --git a/src/Add-on/DrawBoard/DrawBehindBoard.ts b/src/Add-on/DrawBoard/DrawBehindBoard.ts index 61970ed43..59cb5a5aa 100644 --- a/src/Add-on/DrawBoard/DrawBehindBoard.ts +++ b/src/Add-on/DrawBoard/DrawBehindBoard.ts @@ -35,8 +35,8 @@ export class DrawBehindBoard implements Command if (state === ModalState.Ok) { - let board = Board.CreateBoard(spaceParse.BehindLength, spaceParse.SpaceLength, parseFloat(store.behindBoardOption.thickness), BoardType.Behind); - spaceParse.BaseBehindPoint.add(new Vector3(0, -parseFloat(store.behindBoardOption.thickness))) + let board = Board.CreateBoard(spaceParse.BehindLength, spaceParse.SpaceLength, parseFloat(store.behindBoardOption.thickness) / 100, BoardType.Behind); + spaceParse.BaseBehindPoint.add(new Vector3(0, -parseFloat(store.behindBoardOption.thickness) / 100)) board.ApplyMatrix(MoveMatrix(spaceParse.BaseBehindPoint)); let rot = new Matrix4().extractRotation(spaceParse.OCS) diff --git a/src/Add-on/DrawBoard/DrawLeftRightBoard.ts b/src/Add-on/DrawBoard/DrawLeftRightBoard.ts index fdb4bf4cf..d58c77d75 100644 --- a/src/Add-on/DrawBoard/DrawLeftRightBoard.ts +++ b/src/Add-on/DrawBoard/DrawLeftRightBoard.ts @@ -1,12 +1,12 @@ import { Vector3 } from 'three'; -import { SideBoardStore, ModalState } from '../../UI/Store/BoardStore'; -import { BoardType, Board } from '../../DatabaseServices/Board'; -import { Command } from '../../Editor/CommandMachine'; + import { app } from '../../ApplicationServices/Application'; -import { MoveMatrix } from '../../Geometry/GeUtils'; +import { Board, BoardType } from '../../DatabaseServices/Board'; +import { Command } from '../../Editor/CommandMachine'; import { PromptStatus } from '../../Editor/PromptResult'; -import { LeftRightBoardModal } from '../../UI/Components/Board/leftRightBoardModal'; +import { MoveMatrix } from '../../Geometry/GeUtils'; import { BoardModalType } from '../../UI/Components/Board/BoardModal'; +import { ModalState, SideBoardStore } from '../../UI/Store/BoardStore'; export class DrawLeftRight implements Command @@ -22,14 +22,14 @@ export class DrawLeftRight implements Command if (state === ModalState.Ok) { let data = store.boardOption; - let lenght = data.lenght ? parseFloat(data.lenght) : 0; - let width = data.width ? parseFloat(data.width) : 0; - let thickness = data.thickness ? parseFloat(data.thickness) : 0; - let spacing = data.spacing ? parseFloat(data.spacing) : 0; + let lenght = data.lenght ? parseFloat(data.lenght) / 100 : 0; + let width = data.width ? parseFloat(data.width) / 100 : 0; + let thickness = data.thickness ? parseFloat(data.thickness) / 100 : 0; + let spacing = data.spacing ? parseFloat(data.spacing) / 100 : 0; let leftBarod = Board.CreateBoard(lenght, width, thickness, BoardType.Vertical) let rightBoard = Board.CreateBoard(lenght, width, thickness, BoardType.Vertical); - rightBoard.ApplyMatrix(MoveMatrix(new Vector3(spacing + thickness))); + rightBoard.ApplyMatrix(MoveMatrix(new Vector3(spacing - thickness))); app.m_Database.ModelSpace.Append(leftBarod); app.m_Database.ModelSpace.Append(rightBoard); diff --git a/src/UI/Components/Board/BehindBoardModal.tsx b/src/UI/Components/Board/BehindBoardModal.tsx index 674e55364..ceab64cb2 100644 --- a/src/UI/Components/Board/BehindBoardModal.tsx +++ b/src/UI/Components/Board/BehindBoardModal.tsx @@ -1,35 +1,188 @@ import { inject, observer } from 'mobx-react'; import * as React from 'react'; -import { BehindBoardStore } from '../../Store/BoardStore'; +import { Radio, RadioGroup } from '../../../../node_modules/@blueprintjs/core'; +import { BehindBoardStore, BehindHeightPositon, BehindRelativePositon } from '../../Store/BoardStore'; +import { SetBoardDataItem } from './BoardCommon'; @inject("store") @observer export class BehindBoardModal extends React.Component<{ store?: BehindBoardStore }, {}> { + m_ScaleParameter = new Map([ + ["knifeRad", "刀具半径"], + ["grooveAddLength", "槽加长"], ["grooveAddWidth", "槽加宽"], ["grooveAddDepth", "槽加深"] + ]); + m_HeightParameter = new Map([ + ["height", "板件高度"], ["bottomExt", "移动"] + ]); + m_PosParameter = new Map([ + ["spaceHeight", "单层空间"], ["count", "板件个数"], ["thickness", "背板厚度"] + ]); render() { let store = this.props.store; + return ( - <> - { - Array.from(store.m_Parameter.keys()).map(k => - { - return ( -
- - +
+
+
+
+
加工数据
+
+ { + Array.from(this.m_ScaleParameter.keys()).map(k => { - store.behindBoardOption[k] = e.target.value; - }} - /> + return ( +
+ {this.m_ScaleParameter.get(k)}: + + { + store.behindBoardOption[k] = e.target.value; + }} + dir="auto" /> +
+ ) + }) + } +
+
+
+
板件尺寸
+
+ +
+ + + + + +
+ + +
- ) - }) - } - +
+
+ +
+
板件高度
+ + { + store.behindBoardOption.boardHeight = e.currentTarget.value as BehindHeightPositon; + + }} + selectedValue={store.behindBoardOption.boardHeight} + > + + + + +
+ { + Array.from(this.m_HeightParameter.keys()).map(k => + { + return ( +
+ {this.m_HeightParameter.get(k)}: + + { + store.behindBoardOption[k] = e.target.value; + }} + dir="auto" /> +
+ ) + }) + } +
+
+
+
配置板块
+ + { + store.behindBoardOption.boardRelative = e.currentTarget.value as BehindRelativePositon; + + }} + selectedValue={store.behindBoardOption.boardRelative} + > + + + + +
+ { + Array.from(this.m_PosParameter.keys()).map(k => + { + return ( + + ) + }) + } +
+
+
+
) } } + diff --git a/src/UI/Components/Board/BoardCommon.tsx b/src/UI/Components/Board/BoardCommon.tsx new file mode 100644 index 000000000..4305ae2c6 --- /dev/null +++ b/src/UI/Components/Board/BoardCommon.tsx @@ -0,0 +1,20 @@ +import { inject, observer } from 'mobx-react'; +import * as React from 'react'; + +export const SetBoardDataItem = observer(({ k, behindBoardOption, title }) => +
+ + {title}: + + + { + behindBoardOption[k] = e.target.value; + }} + /> +
+); diff --git a/src/UI/Components/Board/BoardModal.tsx b/src/UI/Components/Board/BoardModal.tsx index a3b8b7edb..6bf3be6ee 100644 --- a/src/UI/Components/Board/BoardModal.tsx +++ b/src/UI/Components/Board/BoardModal.tsx @@ -1,10 +1,20 @@ import { Button, Dialog } from '@blueprintjs/core'; import * as React from 'react'; -import { BehindBoardStore, BoardStore, ModalState, SideBoardStore, TopBottomBoardStore, LayerBoardStore, VerticalBoardStore } from '../../Store/BoardStore'; + +import +{ + BehindBoardStore, + BoardStore, + LayerBoardStore, + ModalState, + SideBoardStore, + TopBottomBoardStore, + VerticalBoardStore, +} from '../../Store/BoardStore'; import { BehindBoardModal } from './BehindBoardModal'; +import { LayerBoardModal } from './LayerBoardModal'; import { LeftRightBoardModal } from './leftRightBoardModal'; import { TopBottomBoardModal } from './TopBottomBoardModal'; -import { LayerBoardModal } from './LayerBoardModal'; import { VerticalBoardModal } from './VerticalBoardModal'; export enum BoardModalType @@ -87,3 +97,70 @@ export class BoardModal extends React.Component { } } +export class BoardModal1 extends React.Component { + + private m_ModalMap: Map; + constructor(props) + { + super(props); + let store = this.props.store; + this.m_ModalMap = new Map([ + [BoardModalType.LR, ], + [BoardModalType.TB, ], + [BoardModalType.Be, ], + [BoardModalType.Ly, ], + [BoardModalType.Ve, ], + ]) + } + render() + { + let store = this.props.store; + + return ( +
e.stopPropagation()} > +
+
+ +
store.title
+ +
+
+ { + e.stopPropagation(); + } + }> + { + this.m_ModalMap.get(this.props.type) + } +
+
+
+
+
+
+
+ ); + } +} + diff --git a/src/UI/Components/Board/LayerBoardModal.tsx b/src/UI/Components/Board/LayerBoardModal.tsx index 0d06df643..cf1f37682 100644 --- a/src/UI/Components/Board/LayerBoardModal.tsx +++ b/src/UI/Components/Board/LayerBoardModal.tsx @@ -27,7 +27,7 @@ export class LayerBoardModal extends React.Component<{ store?: LayerBoardStore } type="number" value={store.layerBoardOption[k]} disabled={(k === "width" && store.layerBoardOption.isTotalWidth) - || (k === "dist" && store.layerBoardOption.posType == LayerPosType.Mid) + || (k === "dist" && store.layerBoardOption.posType == LayerPosType.Div) } onChange={e => { @@ -57,7 +57,7 @@ export class LayerBoardModal extends React.Component<{ store?: LayerBoardStore } > - +
diff --git a/src/UI/Components/Board/VerticalBoardModal.tsx b/src/UI/Components/Board/VerticalBoardModal.tsx index 0c62a173b..52b85fabf 100644 --- a/src/UI/Components/Board/VerticalBoardModal.tsx +++ b/src/UI/Components/Board/VerticalBoardModal.tsx @@ -27,7 +27,7 @@ export class VerticalBoardModal extends React.Component<{ store?: VerticalBoardS type="number" value={store.verticalBoardOption[k]} disabled={(k === "width" && store.verticalBoardOption.isTotalWidth) - || (k === "dist" && store.verticalBoardOption.posType == VerticalPosType.Mid) + || (k === "dist" && store.verticalBoardOption.posType == VerticalPosType.Div) } onChange={e => { @@ -54,9 +54,9 @@ export class VerticalBoardModal extends React.Component<{ store?: VerticalBoardS }} selectedValue={store.verticalBoardOption.posType} > - - - + + + diff --git a/src/UI/Components/Board/leftRightBoardModal.tsx b/src/UI/Components/Board/leftRightBoardModal.tsx index 298c55331..9a7bafff9 100644 --- a/src/UI/Components/Board/leftRightBoardModal.tsx +++ b/src/UI/Components/Board/leftRightBoardModal.tsx @@ -1,35 +1,29 @@ import { inject, observer } from 'mobx-react'; import * as React from 'react'; + import { SideBoardStore } from '../../Store/BoardStore'; -@inject("store") -@observer -export class LeftRightBoardModal extends React.Component<{ store?: SideBoardStore }, {}> -{ - render() - { - let store = this.props.store; - return ( - <> +export const LeftRightBoardModal = + inject("store") + (observer((props: { store?: SideBoardStore }) => ( +
{ - Array.from(store.m_Parameter.keys()).map(k => + Array.from(props.store.m_Parameter.keys()).map(k => { return (
- + { - store.boardOption[k] = e.target.value; + props.store.boardOption[k] = e.target.value; }} />
) }) } - - ) - } -} +
+ ))) diff --git a/src/UI/Css/style.less b/src/UI/Css/style.less index 463e7adbf..0def279a8 100644 --- a/src/UI/Css/style.less +++ b/src/UI/Css/style.less @@ -395,7 +395,55 @@ input[type=radio] { height: 50px !important; } } +/**************板件模态框样式*************/ +.boardRadio{ + display: flex; + justify-content: flex-start; +} +.boardRadio>label{ + margin-right: 10px; +} +#board .flexWrap>div{ + width: 50%; + line-height: 15px; +} +#board .flexWrap>div{ + width: 50%; + line-height: 30px; +} +#board .flexWrap>div>.pt-input{ + padding:0 0 0 5px; + width: 60px; +} +#board .boardModel{ + display: inline-block; + width: 35px; + height: 50px; + border: 1px solid #000; + vertical-align: middle; + margin: 10px; +} +#board .boardSize .pt-label{ + display: inline-block; + margin: 0 5px; +} +#board .boardSize .pt-inline{ + line-height: 15px; +} +#board .flex>div:first-child{ + width: 40%; +} +#board .flex>div:last-child{ + width: 60%; +} +#board .boardSize .pt-label>.pt-input{ + display: block; + padding: 0; + width: 50px; + padding-left: 5px; + line-height: 15px; +} /**********自定义通用样式*****************/ @@ -417,6 +465,11 @@ div { .flex { display: flex; + justify-content: space-between; +} +.flexWrap{ + display: flex; + flex-wrap: wrap } .ul-unstyle { @@ -441,3 +494,30 @@ img { .button-marign { margin-right: 10px; } +.center{ + text-align: center; +} +.widthHalf{ + width: 50%; +} +.arrow{ + display: block; + border: 10px solid transparent; + width: 0; + height: 0px; + margin: 0 auto; +} +.arrowtop{ + border-bottom: 10px solid #000; + margin-top: -3px; +} +.arrowbottom{ + border-top: 10px solid #000; +} +.line{ + display: block; + border: 2px solid #000; + width: 0; + height: 16px; + margin: 0 auto; +} diff --git a/src/UI/Store/BoardStore.ts b/src/UI/Store/BoardStore.ts index d517e9a5f..54f6c8f0b 100644 --- a/src/UI/Store/BoardStore.ts +++ b/src/UI/Store/BoardStore.ts @@ -57,12 +57,12 @@ export class SideBoardStore extends BoardStore { //板数据 @observable boardOption: SideBoardOption = { - lenght: "12", - width: "6", - thickness: "0.18", - spacing: "8" + lenght: "1200", + width: "600", + thickness: "18", + spacing: "836" }; - m_Parameter = new Map([["lenght", "柜长"], ["width", "柜宽"], ["thickness", "板厚"], ["spacing", "间距"]]); + m_Parameter = new Map([["lenght", "柜长"], ["width", "柜宽"], ["thickness", "板厚"], ["spacing", "总宽"]]); title = "左右侧板"; private static _store: SideBoardStore; static Store() @@ -108,6 +108,19 @@ export class TopBottomBoardStore extends BoardStore } } +export enum BehindHeightPositon +{ + ForTop = "top", + ForBottom = "bottom", + AllHeight = "all" +} +export enum BehindRelativePositon +{ + ForFront = "front", + ForBack = "back", + Div = "div" +} + export class BehindBoardStore extends BoardStore { title = "背板"; @@ -117,7 +130,17 @@ export class BehindBoardStore extends BoardStore rightExt: "0", topExt: "0", bottomExt: "0", - thickness: "0.18", + thickness: "18", + knifeRad: "3", + grooveAddLength: "0", + grooveAddWidth: "0", + grooveAddDepth: "0", + boardHeight: BehindHeightPositon.AllHeight, + height: "0", + isTotalHeight: true, + boardRelative: BehindRelativePositon.Div, + spaceHeight: "0", + count: "1" }; m_Parameter = new Map([ ["leftExt", "左延伸"], ["rightExt", "右延伸"], ["topExt", "顶延伸"], @@ -133,7 +156,7 @@ export class BehindBoardStore extends BoardStore export enum LayerPosType { - Mid = "mid", + Div = "div", Top = "top", Bottom = "bottom" } @@ -156,7 +179,7 @@ export class LayerBoardStore extends BoardStore frontShrink: "0", width: "0.6", isTotalWidth: true, - posType: LayerPosType.Mid, + posType: LayerPosType.Div, thickness: "0.18", count: "1", dist: "100" @@ -177,7 +200,7 @@ export enum VerticalPosType { Left = "left", Right = "right", - Mid = "mid" + Div = "mid" } export class VerticalBoardStore extends BoardStore @@ -187,7 +210,7 @@ export class VerticalBoardStore extends BoardStore frontShrink: "0", width: "0.6", isTotalWidth: true, - posType: VerticalPosType.Mid, + posType: VerticalPosType.Div, thickness: "0.18", count: "1", dist: "100"