xushiting пре 2 година
родитељ
комит
f186a6076d

+ 0 - 33
pnpm-lock.yaml

@@ -21,7 +21,6 @@ specifiers:
   classnames: ^2.3.1
   craco-less: ^2.0.0
   dom-to-image: ^2.6.0
-  html2canvas: ^1.4.1
   http-proxy-middleware: ^2.0.6
   icons: link:@types/@ant-design/icons
   js-base64: ^3.7.2
@@ -62,7 +61,6 @@ dependencies:
   classnames: 2.3.2
   craco-less: 2.0.0_xgxnkve2gkwyphykbzlgtzhxmi
   dom-to-image: 2.6.0
-  html2canvas: 1.4.1
   icons: link:@types/@ant-design/icons
   js-base64: 3.7.3
   lodash: 4.17.21
@@ -3671,11 +3669,6 @@ packages:
     resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==}
     dev: false
 
-  /base64-arraybuffer/1.0.2:
-    resolution: {integrity: sha512-I3yl4r9QB5ZRY3XuJVEPfc2XhZO6YweFPI+UovAzn+8/hb3oJ6lnysaFcjVpkCPfVWFUDvoZ8kmVDP7WyRtYtQ==}
-    engines: {node: '>= 0.6.0'}
-    dev: false
-
   /batch/0.6.1:
     resolution: {integrity: sha512-x+VAiMRL6UPkx+kudNvxTl6hB2XNNCG2r+7wixVfIYwu/2HKRXimwQyaumLjMveWvT2Hkd/cAJw+QBMfJ/EKVw==}
     dev: false
@@ -4224,12 +4217,6 @@ packages:
       postcss-selector-parser: 6.0.11
     dev: false
 
-  /css-line-break/2.1.0:
-    resolution: {integrity: sha512-FHcKFCZcAha3LwfVBhCQbW2nCNbkZXn7KVUJcsT5/P8YmfsVja0FMPJr0B903j/E69HUphKiV9iQArX8SDYA4w==}
-    dependencies:
-      utrie: 1.0.2
-    dev: false
-
   /css-loader/6.7.2_webpack@5.75.0:
     resolution: {integrity: sha512-oqGbbVcBJkm8QwmnNzrFrWTnudnRZC+1eXikLJl0n4ljcfotgRifpg2a1lKy8jTrc4/d9A/ap1GFq1jDKG7J+Q==}
     engines: {node: '>= 12.13.0'}
@@ -5878,14 +5865,6 @@ packages:
       webpack: 5.75.0
     dev: false
 
-  /html2canvas/1.4.1:
-    resolution: {integrity: sha512-fPU6BHNpsyIhr8yyMpTLLxAbkaK8ArIBcmZIRiBLiDhjeqvXolaEmDGmELFuX9I4xDcaKKcJl+TKZLqruBbmWA==}
-    engines: {node: '>=8.0.0'}
-    dependencies:
-      css-line-break: 2.1.0
-      text-segmentation: 1.0.3
-    dev: false
-
   /htmlparser2/6.1.0:
     resolution: {integrity: sha512-gyyPk6rgonLFEDGoeRgQNaEUvdJ4ktTmmUh/h2t7s+M8oPpIPxgNACWa+6ESR57kXstwqPiCut0V8NRpcwgU7A==}
     dependencies:
@@ -10616,12 +10595,6 @@ packages:
       minimatch: 3.1.2
     dev: false
 
-  /text-segmentation/1.0.3:
-    resolution: {integrity: sha512-iOiPUo/BGnZ6+54OsWxZidGCsdU8YbE4PSpdPinp7DeMtUJNJBoJ/ouUSTJjHkh1KntHaltHl/gDs2FC4i5+Nw==}
-    dependencies:
-      utrie: 1.0.2
-    dev: false
-
   /text-table/0.2.0:
     resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==}
     dev: false
@@ -10914,12 +10887,6 @@ packages:
     engines: {node: '>= 0.4.0'}
     dev: false
 
-  /utrie/1.0.2:
-    resolution: {integrity: sha512-1MLa5ouZiOmQzUbjbu9VmjLzn1QLXBhwpUa7kdLUQK+KQ5KA9I1vk5U4YHe/X2Ch7PYnJfWuWT+VbuxbGwljhw==}
-    dependencies:
-      base64-arraybuffer: 1.0.2
-    dev: false
-
   /uuid/8.3.2:
     resolution: {integrity: sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==}
     hasBin: true

+ 13 - 88
src/views/draw-file/board/editCAD/Controls/UIControl.js

@@ -15,12 +15,11 @@ import { floorplanData } from '../FloorplanData.js'
 import { signService } from '../Service/SignService.js'
 import mitt from 'mitt'
 
-export default class UIControl {
+export default class UIControl{
     constructor(layer) {
         this.layer = layer
         this.bus = mitt()
         this.selectUI = null;
-        this.uiSelectCallback = null;
 
         // this.bus.emit('')
     }
@@ -83,108 +82,34 @@ export default class UIControl {
     /**
      * 设置部件属性
      * @param {*} type 部件类型
-     * @param {*} name 属性名称
      * @param {*} value 属性值
      */
-    setAttributes(type, name, value) {
-        console.log(name)
-        let item = stateService.getFocusItem()
-        switch (name) {
-            case 'remove':
-                if (type == VectorType.Wall) {
-                    floorplanService.deleteWall(item.vectorId)
-                } else if (type == VectorType.Tag) {
-                    floorplanService.deleteTag(item.vectorId)
-                    let _item = stateService.getDraggingItem()
-                    if (_item && _item.vectorId != item.vectorId) {
-                        floorplanService.deleteTag(_item.vectorId)
-                    }
-                } else if (type == VectorType.WallCorner) {
-                    wallService.deleteWallCorner(item.vectorId)
-                } else if (signService.isSign(type)) {
-                    floorplanService.deleteSign(item.vectorId)
-                }
-                stateService.clearItems()
-                stateService.clearEventName()
-                this.layer.renderer.autoRedraw()
-                break
-            case 'angle':
-                if (signService.isSign(type)) {
-                    let sign = floorplanService.getSign(item.vectorId)
-                    sign.angle = value
-                    this.layer.renderer.autoRedraw()
-                }
-                break
-            case 'scale':
-                if (signService.isSign(type)) {
-                    let sign = floorplanService.getSign(item.vectorId)
-                    sign.scale = value
-                    this.layer.renderer.autoRedraw()
-                }
-                break
-            case 'split':
-                if (type == VectorType.Wall) {
-                    let wall = floorplanService.getWall(item.vectorId)
-                    let startPoint = floorplanService.getPoint(wall.start)
-                    let endPoint = floorplanService.getPoint(wall.end)
-                    let mid = {
-                        x: (startPoint.x + endPoint.x) / 2,
-                        y: (startPoint.y + endPoint.y) / 2,
-                    }
-                    let point = wallService.createPoint(mid.x, mid.y)
-                    const _wallId = wallService.splitWall(item.vectorId, point.vectorId, 'start')
-
-                    wall = floorplanService.getWall(item.vectorId)
-                    startPoint = floorplanService.getPoint(wall.start)
-                    endPoint = floorplanService.getPoint(wall.end)
-                    let _mid = {
-                        x: (startPoint.x + endPoint.x) / 2,
-                        y: (startPoint.y + endPoint.y) / 2,
-                    }
-                    let focusItem = {
-                        vectorId: _wallId,
-                        type: type,
-                    }
-
-                    if (mid.x < _mid.x) {
-                        stateService.setFocusItem(focusItem)
-                    } else if (mid.x == _mid.x && mid.y > _mid.y) {
-                        stateService.setFocusItem(focusItem)
-                    }
-                    this.layer.renderer.autoRedraw()
-                }
-                break
-            case 'tag':
-                if (type == VectorType.Tag) {
-                    let tag = floorplanService.getTag(item.vectorId)
-                    if (value != null && value.trim() != '') {
-                        tag.setTitle(value)
-                    } else {
-                        tag.setTitle(KanKan.Config.i18n('cad.input'))
-                    }
-
-                    //this.layer.history.save()
-                    this.layer.renderer.autoRedraw()
-                }
-                break
-        }
+    setAttributes(type, value) {
+        
     }
 
     showAttributes(item) {
+        let type = item.type;
+        let value = null;
         switch (item.type) {
             case VectorType.Tag:
                 const tag = floorplanService.getTag(item.vectorId)
-                this.uiSelectCallback(item.type,item.value)
+                value = item.value;
                 return;
             case VectorType.Table:
-                this.uiSelectCallback(item.type,item.value)
+                value = item.value;
                 return;
         }
-        this.uiSelectCallback(item.type,null)
+        this.bus.emit('showAttribute',{
+            type:type,
+            value:value
+        })
     }
 
     clearUI() {
         this.selectUI = null
+        this.bus.emit('hideAttribute')
+        this.bus.emit('hideUI')
     }
 
     getSignTypeForUI() {

+ 10 - 12
src/views/draw-file/board/editCAD/Layer.js

@@ -77,7 +77,6 @@ export default class Layer {
         // 右键
         if (e.button == 2) {
             this.stopAddVector()
-            this.uiControl.selectUI = null
             this.renderer.autoRedraw()
             return
         }
@@ -141,7 +140,7 @@ export default class Layer {
                 //this.uiControl.showAttributes()
                 this.uiControl.selectUI = selectItem.type
             } else if (eventName == null) {
-                this.uiControl.selectUI = null
+                this.uiControl.clearUI();
             }
         }
         this.setEventName('mouseDown')
@@ -498,7 +497,7 @@ export default class Layer {
             case LayerEvents.PanBackGround:
                 needAutoRedraw = true
                 stateService.clearFocusItem()
-                this.uiControl.selectUI = null
+                this.uiControl.clearUI();
                 break
             case LayerEvents.MoveWallPoint:
                 if(focusItem == null){
@@ -537,7 +536,7 @@ export default class Layer {
                         stateService.clearEventName()
                         addWall.clear()
                         elementService.hideAll()
-                        this.uiControl.selectUI = null
+                        this.uiControl.clearUI();
                         this.history.save()
                     }
                 }
@@ -560,7 +559,7 @@ export default class Layer {
                 elementService.hideAll()
                 addRectangle.clear();
                 this.history.save()
-                this.uiControl.selectUI = null
+                this.uiControl.clearUI();
                 break
             case LayerEvents.MoveRectangle:
                 if(focusItem == null){
@@ -592,7 +591,7 @@ export default class Layer {
                 elementService.hideAll()
                 addCircle.clear();
                 this.history.save()
-                this.uiControl.selectUI = null
+                this.uiControl.clearUI();
                 break
             case LayerEvents.MoveCircle:
                 if(focusItem == null){
@@ -618,7 +617,7 @@ export default class Layer {
                 elementService.hideAll()
                 addIcon.clear();
                 this.history.save()
-                this.uiControl.selectUI = null
+                this.uiControl.clearUI();
                 break
             case LayerEvents.MoveIcon:
                 if(focusItem == null){
@@ -644,7 +643,7 @@ export default class Layer {
                 elementService.hideAll()
                 addArrow.clear();
                 this.history.save()
-                this.uiControl.selectUI = null
+                this.uiControl.clearUI();
                 break
             case LayerEvents.MoveArrow:
                 needAutoRedraw = true
@@ -665,7 +664,7 @@ export default class Layer {
                 break
             case LayerEvents.AddSign:
                 needAutoRedraw = true
-                this.uiControl.selectUI = null
+                this.uiControl.clearUI();
                 this.history.save()
                 break
             case LayerEvents.MoveSign:
@@ -674,7 +673,6 @@ export default class Layer {
                     this.uiControl.selectUI = focusItem.type
                     this.history.save()
                 } else {
-                    debugger
                     this.history.save()
                 }
                 break
@@ -713,7 +711,7 @@ export default class Layer {
             console.log('ctrl+y')
         } else if (e.code == 'Delete') {
             this.deleteItem()
-            this.uiControl.selectUI = null
+            this.uiControl.clearUI();
             this.history.save()
             this.renderer.autoRedraw()
             console.log('Delete')
@@ -822,7 +820,7 @@ export default class Layer {
             if (eventName == LayerEvents.AddTag) {
                 if (draggingItem && draggingItem.vectorId) {
                     tagService.deleteTag(draggingItem.vectorId)
-                    this.uiControl.selectUI = null
+                    this.uiControl.clearUI();
                 }
             } else if (eventName == LayerEvents.AddSign) {
                 if (draggingItem && draggingItem.vectorId) {