浏览代码

Merge branch 'dev' of http://192.168.0.115:3000/bill/fuse into dev

bill 2 年之前
父节点
当前提交
0637b355aa

+ 10 - 9
src/views/draw-file/board/editCAD/Controls/UIControl.js

@@ -14,6 +14,7 @@ import { addWall } from '../Controls/AddWall'
 import { floorplanData } from '../FloorplanData.js'
 import { signService } from '../Service/SignService.js'
 import mitt from 'mitt'
+import {history} from '../History/History.js'
 
 export default class UIControl{
     constructor(layer) {
@@ -152,7 +153,7 @@ export default class UIControl{
             } else if (item.type == VectorType.WallCorner) {
                 wallService.deleteWallCorner(item.vectorId)
             }
-            this.layer.history.save()
+            history.save()
             this.layer.renderer.autoRedraw()
         }
     }
@@ -300,12 +301,12 @@ export default class UIControl{
         this.layer.recoveryHistory()
     }
 
-    menu_default() {
-        historyService.clearHistoryRecord()
-        floorplanService.setAngle(0)
-        this.layer.load.loadFloorJson(true).then(() => {
-        })
-    }
+    // menu_default() {
+    //     historyService.clearHistoryRecord()
+    //     floorplanService.setAngle(0)
+    //     this.layer.load.loadFloorJson(true).then(() => {
+    //     })
+    // }
 
     //截图
     menu_screenShot(styleType) {
@@ -319,7 +320,7 @@ export default class UIControl{
         stateService.clearEventName()
         addWall.clear()
         elementService.hideAll()
-        this.layer.history.save()
+        history.save()
         this.layer.renderer.autoRedraw()
     }
 
@@ -344,7 +345,7 @@ export default class UIControl{
         //修改cad数据
         coordinate.updateForRotate()
         this.layer.initPanos(floorplanService.getCurrentFloor())
-        this.layer.history.save()
+        history.save()
         this.layer.renderer.autoRedraw()
     }
 

+ 1 - 0
src/views/draw-file/board/editCAD/FloorplanData.js

@@ -2,6 +2,7 @@ export default class FloorplanData {
     constructor() {
         this.version = 'v4.0'
         this.floors = []
+        this.initFloor(0);
     }
 
     initFloor(floorNum) {

+ 4 - 0
src/views/draw-file/board/editCAD/History/History.js

@@ -20,6 +20,7 @@ export default class History {
     constructor(layer) {
         this.layer = layer
         this.bus = mitt()
+        this.init();
     }
 
     init() {
@@ -511,3 +512,6 @@ export default class History {
         }
     }
 }
+
+const history = new History()
+export { history }

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

@@ -32,7 +32,7 @@ import Constant from './Constant'
 import VectorType from './enum/VectorType'
 import MathUtil, { mathUtil } from './MathUtil'
 import { wallService } from './Service/WallService'
-import History from './History/History'
+import {history} from './History/History.js'
 import { signService } from './Service/SignService'
 
 export default class Layer {
@@ -41,7 +41,7 @@ export default class Layer {
         this.load = new Load(this)
         this.uiControl = new UIControl(this)
         this.renderer = new Render(this)
-        this.history = new History(this)
+        //this.history = new History(this)
 
         this.canvas = null;
         this.startX = null
@@ -105,7 +105,7 @@ export default class Layer {
             }
             if (addWall.canAdd) {
                 addWall.buildWall()
-                this.history.save()
+                history.save()
             } else {
                 return
             }
@@ -260,7 +260,7 @@ export default class Layer {
                 }
                 // wallId被删除了
                 else if (moveFlag == 3) {
-                    this.history.save()
+                    history.save()
                     stateService.clearSelectItem()
                     stateService.clearDraggingItem()
                     stateService.clearEventName()
@@ -555,7 +555,7 @@ export default class Layer {
                         }
                         //draggingItem.vectorId所在的墙面与其他墙角相交
                         moveWall.updateForAbsorbWallPoints()
-                        this.history.save()
+                        history.save()
                     }
                 }
                 else{
@@ -571,14 +571,14 @@ export default class Layer {
                         addWall.clear()
                         elementService.hideAll()
                         this.uiControl.clearUI();
-                        this.history.save()
+                        history.save()
                     }
                 }
                 break
             case LayerEvents.MoveWall:
                 if(focusItem == null){
                     needAutoRedraw = true
-                    this.history.save()
+                    history.save()
                 }
                 else{
                     this.uiControl.showAttributes(focusItem);
@@ -592,13 +592,13 @@ export default class Layer {
                 stateService.clearEventName()
                 elementService.hideAll()
                 addRectangle.clear();
-                this.history.save()
+                history.save()
                 this.uiControl.clearUI();
                 break
             case LayerEvents.MoveRectangle:
                 if(focusItem == null){
                     needAutoRedraw = true
-                    this.history.save()
+                    history.save()
                 }
                 else{
                     this.uiControl.showAttributes(focusItem);
@@ -607,11 +607,11 @@ export default class Layer {
             case LayerEvents.MoveRectangleVertex:
                 needAutoRedraw = true
                 elementService.hideAll()
-                this.history.save()
+                history.save()
                 break
             case LayerEvents.MoveRectangleSide:
                 needAutoRedraw = true
-                this.history.save()
+                history.save()
                 break
             case LayerEvents.AddingCircle:
                 if(addCircle.end != null && addCircle.currentVectorId != null)
@@ -624,13 +624,13 @@ export default class Layer {
                 stateService.clearEventName()
                 elementService.hideAll()
                 addCircle.clear();
-                this.history.save()
+                history.save()
                 this.uiControl.clearUI();
                 break
             case LayerEvents.MoveCircle:
                 if(focusItem == null){
                     needAutoRedraw = true
-                    this.history.save()
+                    history.save()
                 }
                 else{
                     this.uiControl.showAttributes(focusItem);
@@ -638,7 +638,7 @@ export default class Layer {
                 break
             case LayerEvents.MoveCircleVertex:
                 needAutoRedraw = true
-                this.history.save()
+                history.save()
                 break
             case LayerEvents.AddingIcon:
                 if(addIcon.end != null && addIcon.currentVectorId != null){
@@ -650,13 +650,13 @@ export default class Layer {
                 stateService.clearEventName()
                 elementService.hideAll()
                 addIcon.clear();
-                this.history.save()
+                history.save()
                 this.uiControl.clearUI();
                 break
             case LayerEvents.MoveIcon:
                 if(focusItem == null){
                     needAutoRedraw = true
-                    this.history.save()
+                    history.save()
                 }
                 else{
                     this.uiControl.showAttributes(focusItem);
@@ -664,7 +664,7 @@ export default class Layer {
                 break
             case LayerEvents.MoveIconVertex:
                 needAutoRedraw = true
-                this.history.save()
+                history.save()
                 break
             case LayerEvents.AddingArrow:
                 if(addArrow.start != null && addArrow.currentVectorId != null){
@@ -676,17 +676,17 @@ export default class Layer {
                 stateService.clearEventName()
                 elementService.hideAll()
                 addArrow.clear();
-                this.history.save()
+                history.save()
                 this.uiControl.clearUI();
                 break
             case LayerEvents.MoveArrow:
                 needAutoRedraw = true
-                this.history.save()
+                history.save()
                 break
             case LayerEvents.MoveTag:
                 if(focusItem == null){
                     needAutoRedraw = true
-                    this.history.save()
+                    history.save()
                 }
                 else{
                     this.uiControl.showAttributes(focusItem);
@@ -695,12 +695,12 @@ export default class Layer {
             case LayerEvents.AddTag:
                 needAutoRedraw = true
                 this.uiControl.showAttributes(focusItem)
-                this.history.save()
+                history.save()
                 break
             case LayerEvents.MoveTable:
                 if(focusItem == null){
                     needAutoRedraw = true
-                    this.history.save()
+                    history.save()
                 }
                 else{
                     this.uiControl.showAttributes(focusItem);
@@ -709,20 +709,20 @@ export default class Layer {
             case LayerEvents.AddTable:
                 needAutoRedraw = true
                 this.uiControl.showAttributes(focusItem)
-                this.history.save()
+                history.save()
                 break
             case LayerEvents.AddSign:
                 needAutoRedraw = true
                 this.uiControl.clearUI();
-                this.history.save()
+                history.save()
                 break
             case LayerEvents.MoveSign:
                 needAutoRedraw = true
                 if (focusItem != null && signService.isSign(focusItem.type)) {
                     this.uiControl.selectUI = focusItem.type
-                    this.history.save()
+                    history.save()
                 } else {
-                    this.history.save()
+                    history.save()
                 }
                 break
         }
@@ -762,7 +762,7 @@ export default class Layer {
         } else if (e.code == 'Delete') {
             this.uiControl.deleteItem()
             this.uiControl.clearUI();
-            this.history.save()
+            history.save()
             this.renderer.autoRedraw()
             console.log('Delete')
         } else if (e.code == 'Escape') {