From 9d4d06ec1ae8c79b69f8bc07f2e9b7e7b346e165 Mon Sep 17 00:00:00 2001 From: luoyifan Date: Fri, 23 May 2025 21:11:16 +0800 Subject: [PATCH] Model2DEditor --- src/designer/Designer.ts | 8 + src/designer/Model2DEditor.vue | 68 --- src/designer/Model3DView.vue | 744 -------------------------- src/designer/menus/Model3DView.ts | 4 +- src/designer/model2DEditor/Model2DEditor.vue | 63 +++ src/designer/model2DEditor/Model2DEditorJs.ts | 40 ++ src/designer/model2DEditor/ThreeJsEditor.vue | 330 ++++++++++++ src/designer/model3DView/Model3DView.vue | 744 ++++++++++++++++++++++++++ src/views/ModelMain.less | 292 ++++++---- src/views/ModelMain.vue | 8 +- 10 files changed, 1367 insertions(+), 934 deletions(-) delete mode 100644 src/designer/Model2DEditor.vue delete mode 100644 src/designer/Model3DView.vue create mode 100644 src/designer/model2DEditor/Model2DEditor.vue create mode 100644 src/designer/model2DEditor/Model2DEditorJs.ts create mode 100644 src/designer/model2DEditor/ThreeJsEditor.vue create mode 100644 src/designer/model3DView/Model3DView.vue diff --git a/src/designer/Designer.ts b/src/designer/Designer.ts index 1c91c3b..58c78f7 100644 --- a/src/designer/Designer.ts +++ b/src/designer/Designer.ts @@ -10,6 +10,14 @@ export default class Designer { allLevels: any = null currentFloor: string = null + editorState = reactive({ + ready: false, + camera: { + position: { x: 0, y: 0, z: 0 }, + rotation: { x: 0, y: 0, z: 0 } + } + }) + constructor() { this.init() this.open() diff --git a/src/designer/Model2DEditor.vue b/src/designer/Model2DEditor.vue deleted file mode 100644 index 69f54d1..0000000 --- a/src/designer/Model2DEditor.vue +++ /dev/null @@ -1,68 +0,0 @@ - - \ No newline at end of file diff --git a/src/designer/Model3DView.vue b/src/designer/Model3DView.vue deleted file mode 100644 index 6e03d30..0000000 --- a/src/designer/Model3DView.vue +++ /dev/null @@ -1,744 +0,0 @@ - - - \ No newline at end of file diff --git a/src/designer/menus/Model3DView.ts b/src/designer/menus/Model3DView.ts index 8594f87..8de6eca 100644 --- a/src/designer/menus/Model3DView.ts +++ b/src/designer/menus/Model3DView.ts @@ -1,5 +1,5 @@ import { defineMenu } from '@/runtime/DefineMenu.ts' -import Model3DView from '@/designer/Model3DView.vue' +import Model3DView from '@/designer/model3DView/Model3DView.vue' export default defineMenu((menus) => { menus.insertChildren('tool', @@ -18,7 +18,7 @@ export default defineMenu((menus) => { showMax: true, showCancelButton: false, showOkButton: false, - dialogClass:'model-3d-view-wrap', + dialogClass: 'model-3d-view-wrap' }) } } diff --git a/src/designer/model2DEditor/Model2DEditor.vue b/src/designer/model2DEditor/Model2DEditor.vue new file mode 100644 index 0000000..aa39203 --- /dev/null +++ b/src/designer/model2DEditor/Model2DEditor.vue @@ -0,0 +1,63 @@ + + \ No newline at end of file diff --git a/src/designer/model2DEditor/Model2DEditorJs.ts b/src/designer/model2DEditor/Model2DEditorJs.ts new file mode 100644 index 0000000..c98b45a --- /dev/null +++ b/src/designer/model2DEditor/Model2DEditorJs.ts @@ -0,0 +1,40 @@ +import { renderIcon } from '@/utils/webutils.ts' +import { defineComponent } from 'vue' +import ThreeJsEditor from './ThreeJsEditor.vue' + +export default defineComponent({ + name: 'Model2DEditor', + components: { ThreeJsEditor }, + data() { + return { + oper: { + currentMode: 'normal' + }, + view: { + currentLevel: '', + searchKeyword: '' + } + } as IData + }, + methods: { + renderIcon + }, + computed: { + editorState() { + return designer.editorState + }, + allLevels() { + return designer.allLevels + } + } +}) + +export interface IData { + oper: { + currentMode: 'normal' | 'ALink' | 'SLink' | 'PointCallback' | 'PointAdd' | 'LinkAdd' | 'LinkAdd2' | 'Ruler' | 'selectByRec', + }, + view: { + currentLevel: string, + searchKeyword: string, + }, +} \ No newline at end of file diff --git a/src/designer/model2DEditor/ThreeJsEditor.vue b/src/designer/model2DEditor/ThreeJsEditor.vue new file mode 100644 index 0000000..8dd8709 --- /dev/null +++ b/src/designer/model2DEditor/ThreeJsEditor.vue @@ -0,0 +1,330 @@ + + \ No newline at end of file diff --git a/src/designer/model3DView/Model3DView.vue b/src/designer/model3DView/Model3DView.vue new file mode 100644 index 0000000..6e03d30 --- /dev/null +++ b/src/designer/model3DView/Model3DView.vue @@ -0,0 +1,744 @@ + + + \ No newline at end of file diff --git a/src/views/ModelMain.less b/src/views/ModelMain.less index 08a8438..9e89c35 100644 --- a/src/views/ModelMain.less +++ b/src/views/ModelMain.less @@ -1,271 +1,329 @@ -.app-wrap{ +.app-wrap { height: 100%; overflow: hidden; display: flex; flex-direction: column; - .app-header{ - height:50px; + + .app-header { + height: 50px; background: #545c64; flex-shrink: 0; display: flex; flex-direction: row; overflow: hidden; - .logo{ + + .logo { display: flex; align-items: center; margin: 0 20px; } - .app-header-menu-wrap{ - flex:1; + + .app-header-menu-wrap { + flex: 1; display: flex; flex-direction: row; - .app-header-menu{ + + .app-header-menu { height: 100%; - padding:0 16px; - color:#fff; + padding: 0 16px; + color: #fff; display: flex; align-items: center; cursor: pointer; - .el-icon{ - margin-left:8px; + + .el-icon { + margin-left: 8px; font-size: 12px; } - &:hover{ + + &:hover { background-color: #494d52; color: #fff } } } - .user{ + + .user { display: flex; flex-direction: row; align-items: center; margin-right: 10px; - &>span{ + + & > span { display: inline-flex; - padding:5px; + padding: 5px; background: #f4c521; - border-radius:15px; - color:#fff; + border-radius: 15px; + color: #fff; } } } - .app-section{ - flex:1; + + .app-section { + flex: 1; display: flex; flex-direction: row; overflow: hidden; - .btns-toolbar{ + + .btns-toolbar { display: flex; flex-direction: column; - .btns{ - .item{ + + .btns { + .item { height: 48px; line-height: 48px; text-align: center; cursor: pointer; font-size: 26px; - &:hover{ + + &:hover { background: #cccccc; } - &.selected{ + + &.selected { background: #e8e8e8; position: relative; - &:before{ + + &:before { content: ''; position: absolute; width: 3px; height: 100%; background: #f4c521; - left:0; - top:0; + left: 0; + top: 0; } } } } - .btns-top{ - flex:1; + + .btns-top { + flex: 1; } - .btns-bottom{ + + .btns-bottom { } } - .btns-toolbar-left{ + + .btns-toolbar-left { flex-shrink: 0; - width:50px; - border-right:1px solid #dcdcdc + width: 50px; + border-right: 1px solid #dcdcdc } - .btns-toolbar-right{ + + .btns-toolbar-right { flex-shrink: 0; - width:50px; - border-left:1px solid #dcdcdc; - &.btns-toolbar{ - .btns .item.selected:before{ - right:0; - left:auto; + width: 50px; + border-left: 1px solid #dcdcdc; + + &.btns-toolbar { + .btns .item.selected:before { + right: 0; + left: auto; } } } - .section{ - flex:1; + + .section { + flex: 1; overflow: hidden; - .section-item-wrap{ + + .section-item-wrap { height: 100%; display: flex; flex-direction: column; - &>.title{ - border-bottom:1px solid #dcdcdc; + + & > .title { + border-bottom: 1px solid #dcdcdc; height: 35px; line-height: 35px; - padding:0 0 0 10px; + padding: 0 0 0 10px; font-size: 14px; position: relative; display: flex; align-items: center; - &>.el-icon{ - margin-right:3px; + + & > .el-icon { + margin-right: 3px; position: relative; - top:1px; + top: 1px; } - &>.el-input{ - flex:1; - margin:0 30px 0 10px; + + & > .el-input { + flex: 1; + margin: 0 30px 0 10px; } - .close{ + + .close { position: absolute; - right:0; + right: 0; display: inline-flex; - padding:10px; - cursor:pointer; - &:hover{ - color:var(--el-color-primary) + padding: 10px; + cursor: pointer; + + &:hover { + color: var(--el-color-primary) } } } - .calc-left-panel{ - flex:1; + + .calc-left-panel { + flex: 1; overflow: auto; } - .calc-right-panel{ - flex:1; + + .calc-right-panel { + flex: 1; overflow: auto; } - .calc-bottom-panel{ - flex:1; + + .calc-bottom-panel { + flex: 1; overflow: auto; } } - .section-bottom{ - .section-item-wrap{ - &>.title >.el-input{ - flex:none; + + .section-bottom { + .section-item-wrap { + & > .title > .el-input { + flex: none; } } } - .section-tabs.el-tabs--card{ + + .section-tabs.el-tabs--card { height: 100%; - &>.el-tabs__header{ + + & > .el-tabs__header { box-sizing: border-box; z-index: 0; - margin:0; - &>.el-tabs__nav-wrap{ - margin-bottom:0 + margin: 0; + + & > .el-tabs__nav-wrap { + margin-bottom: 0 } - .el-tabs__item.is-active{ + + .el-tabs__item.is-active { position: relative; z-index: 1; - &:before{ + + &:before { content: ''; width: 100%; height: 1px; background: #c61429; position: absolute; - left:0; - top:0; + left: 0; + top: 0; z-index: 999; } - &:after{ + + &:after { content: ''; width: 100%; height: 1px; background: #fff; position: absolute; - left:0; - bottom:0; + left: 0; + bottom: 0; z-index: 999; } - &:hover{ - &:after{ - background:#c5c5c5; + + &:hover { + &:after { + background: #c5c5c5; } } } - .el-tabs__item{ - border-bottom:0; + + .el-tabs__item { + border-bottom: 0; } - .el-tabs__nav-prev{ + + .el-tabs__nav-prev { height: 40px; background: #c9c9c9; - .el-icon{ - color:#c61429 + + .el-icon { + color: #c61429 } } - .el-tabs__nav-next{ + + .el-tabs__nav-next { height: 40px; background: #c9c9c9; - .el-icon{ - color:#c61429 + + .el-icon { + color: #c61429 } } } - &>.el-tabs__content{ - flex:1; - &>.el-tab-pane{ + + & > .el-tabs__content { + flex: 1; + + & > .el-tab-pane { height: 100%; } - .section-canvas{ + + .section-canvas { height: 100%; display: flex; flex-direction: column; - .section-toolbar{ + + .section-toolbar { flex-shrink: 0; height: 30px; display: flex; align-items: center; - .el-button{ + + .el-button { margin-left: 5px; } - .section-toolbar-line{ + + .section-toolbar-line { width: 1px; height: 16px; background: #dcdcdc; - margin:0 5px; + margin: 0 5px; } - &.section-bottom-toolbar{ + + &.section-bottom-toolbar { justify-content: space-between; - .section-toolbar-left{ + + .section-toolbar-left { display: flex; align-items: center; } - .section-toolbar-right{ + + .section-toolbar-right { display: flex; flex-direction: row; align-items: center; - .infor{ + + .infor { background: #000; - margin:0 5px; - color:#fff; + margin: 0 5px; + color: #fff; font-size: 12px; min-width: 120px; text-align: center; - padding:3px 5px; + padding: 3px 5px; } } } } - .section-content{ - flex:1; + + .section-content { + flex: 1; background: #e0e0e0; + display: flex; + + & > .canvas-container { + flex: 1; + } } } } @@ -274,20 +332,22 @@ } } -.el-popper .el-divider--horizontal{ - margin:5px 0; - border-color:#656668 +.el-popper .el-divider--horizontal { + margin: 5px 0; + border-color: #656668 } -.model-3d-view-wrap.el-dialog.resize-dialog{ - padding:0!important; - .el-dialog__footer{ +.model-3d-view-wrap.el-dialog.resize-dialog { + padding: 0 !important; + + .el-dialog__footer { //padding-top:8px; display: none; } - .el-dialog__header{ + + .el-dialog__header { display: flex; align-items: center; - padding:8px 0 8px 8px; + padding: 8px 0 8px 8px; } } \ No newline at end of file diff --git a/src/views/ModelMain.vue b/src/views/ModelMain.vue index f3ff126..8f542be 100644 --- a/src/views/ModelMain.vue +++ b/src/views/ModelMain.vue @@ -98,16 +98,16 @@