Selaa lähdekoodia

Merge branch 'master' of http://192.168.0.115:3000/bill/public-fuse

bill 1 vuosi sitten
vanhempi
commit
6100f56763

+ 21 - 0
src/view/case/draw/board/editCAD/Controls/MoveBgImage.js

@@ -0,0 +1,21 @@
+import { floorplanService } from '../Service/FloorplanService'
+import { mathUtil } from '../MathUtil.js'
+import { coordinate } from '../Coordinate'
+import Constant from '../Constant'
+
+export default class MoveBgImage {
+    constructor() {
+
+    }
+
+    moveFullBgImage(dx,dy, bgImageId) {
+        let bgImage = floorplanService.getCustomImage(bgImageId)
+        bgImage.center = {
+            x:bgImage.center.x + dx/coordinate.res * Constant.defaultZoom/coordinate.zoom,
+            y:bgImage.center.y - dy/coordinate.res * Constant.defaultZoom/coordinate.zoom,
+        }
+    }
+}
+
+const moveBgImage = new MoveBgImage()
+export { moveBgImage }

+ 14 - 9
src/view/case/draw/board/editCAD/Controls/UIControl.js

@@ -405,14 +405,19 @@ export default class UIControl {
   }
 
   exportImg(canvas,filename, callback){
-    coordinate.ratio = 3;
+    coordinate.setRatio(3)
+    canvas.width = canvas.width * coordinate.ratio
+    canvas.height = canvas.height * coordinate.ratio
     this.layer.renderer.autoRedraw()
     setTimeout(() => {
-      let img = this.downloadCadImg(canvas, filename)
-      // 完成callback传出blob  callback(blob)
-      coordinate.ratio = 1;
+      let blobImg = this.downloadCadImg(canvas, filename)
+      // 完成callback传出blob  
+      callback(blobImg)
+      
+      canvas.width = canvas.width / coordinate.ratio
+      canvas.height = canvas.height / coordinate.ratio
+      coordinate.setRatio(1)
       this.layer.renderer.autoRedraw()
-      return img;
     },100)
 
   }
@@ -423,12 +428,12 @@ export default class UIControl {
     var type = "png";
     var imgData = canvas.toDataURL(type, 1);
 
-    let blobImg = this.base64ToBlob(imgData);
-    return blobImg;
+    //let blobImg = this.base64ToBlob(imgData);
+    
 
     // 加工image data,替换mime type
-    //imgData = imgData.replace(this._fixType(type), 'image/octet-stream')
-
+    let blobImg  = imgData.replace(this._fixType(type), 'image/octet-stream')
+    return blobImg;
     // download
     //this.saveFile(imgData, filename)
   }

+ 4 - 0
src/view/case/draw/board/editCAD/Coordinate.js

@@ -40,6 +40,10 @@ export default class Coordinate {
         }
     }
 
+    setRatio(ratio) {
+        this.ratio = ratio;
+    }
+
     // 世界坐标转换成屏幕坐标
     getScreenXY(point) {
         if (this.width == null || this.height == null) {

+ 6 - 14
src/view/case/draw/board/editCAD/Geometry/CustomImage.js

@@ -21,22 +21,14 @@ export default class CustomImage extends Geometry {
     }
 
     isContain(position) {
-        // if(Math.abs(position.x - this.center.x)* coordinate.res * coordinate.zoom/ 100 <this.ratio*this.width/2 && Math.abs(position.y - this.center.y)* coordinate.res * coordinate.zoom/ 100<this.ratio*this.height/2)
-        // {
-        //     return SelectState.Select
-        // } else {
-        //     return null
-        // }
-        // this.context.arc(pt.x-geometry.ratio * geometry.width/4*geometry.scale, pt.y-geometry.ratio * geometry.height/4*geometry.scale, 2 * coordinate.ratio, 0, Math.PI * 2, true)
-    
         let p0 = {
-            x:this.center.x - this.ratio*this.width/2/coordinate.res*this.scale,
-            y:this.center.y + this.ratio*this.height/2/coordinate.res*this.scale
+            x:this.center.x - this.ratio*this.width/coordinate.res*this.scale,
+            y:this.center.y + this.ratio*this.height/coordinate.res*this.scale
         }
 
         let p1 = {
             x:this.center.x,
-            y:this.center.y + this.ratio*this.height/2/coordinate.res*this.scale
+            y:this.center.y + this.ratio*this.height/coordinate.res*this.scale
         }
 
         let p2 = {
@@ -45,12 +37,12 @@ export default class CustomImage extends Geometry {
         }
 
         let p3 = {
-            x:this.center.x- this.ratio*this.width/2/coordinate.res*this.scale,
+            x:this.center.x- this.ratio*this.width/coordinate.res*this.scale,
             y:this.center.y
         }
         let center = {
-            x:this.center.x - this.ratio*this.width/4/coordinate.res*this.scale,
-            y:this.center.y + this.ratio*this.height/4/coordinate.res*this.scale
+            x:this.center.x - this.ratio*this.width/2/coordinate.res*this.scale,
+            y:this.center.y + this.ratio*this.height/2/coordinate.res*this.scale
         }
 
         p0 = this.rotatePoint(p0, center, this.angle)

+ 2 - 2
src/view/case/draw/board/editCAD/Geometry/Table.js

@@ -192,11 +192,11 @@ export default class Table extends Geometry {
         const cell = floorplanService.getCell(vectorId)
         for(let i=0;i<cell.rowIndex;++i){
             const _cell = floorplanService.getCell(this.cells[i][0])
-            height += _cell.height;
+            height += _cell.height*coordinate.ratio;
         }
         for(let i=0;i<cell.colIndex;++i){
             const _cell = floorplanService.getCell(this.cells[0][i])
-            width += _cell.width;
+            width += _cell.width*coordinate.ratio;
         }
 
         return {

+ 8 - 16
src/view/case/draw/board/editCAD/Layer.js

@@ -180,12 +180,14 @@ export default class Layer {
         needAutoRedraw = listenLayer.start(position);
         break;
       case LayerEvents.PanBackGround:
-        // stateService.clearItems()
-        // coordinate.center.x = coordinate.center.x - (dx * Constant.defaultZoom) / coordinate.zoom / coordinate.res
-        // coordinate.center.y = coordinate.center.y + (dy * Constant.defaultZoom) / coordinate.zoom / coordinate.res
-        // this.lastX = X
-        // this.lastY = Y
-        // needAutoRedraw = true
+        break;
+      case LayerEvents.ModifyBgImage:
+        needAutoRedraw = true;
+        if (draggingItem != null) {
+          moveCustomImage.moveFullCustomImage(dx, dy, draggingItem.vectorId);
+          this.lastX = X;
+          this.lastY = Y;
+        }
         break;
       case LayerEvents.AddWall:
         stateService.clearDraggingItem();
@@ -932,9 +934,6 @@ export default class Layer {
       } else if (eventName == LayerEvents.AddTable) {
         stateService.clearEventName();
       } 
-      // else if (eventName == LayerEvents.AddCustomImage) {
-      //   stateService.clearEventName();
-      // }
       else if (
         eventName != LayerEvents.AddWall &&
         eventName != LayerEvents.AddingWall
@@ -974,13 +973,6 @@ export default class Layer {
           stateService.clearItems();
         }
       } 
-      // else if (eventName == LayerEvents.AddCustomImage) {
-      //   if (draggingItem && draggingItem.vectorId) {
-      //     customImageService.deleteCustomImage(draggingItem.vectorId);
-      //     this.uiControl.clearUI();
-      //     stateService.clearItems();
-      //   }
-      // }
     } else {
       stateService.setEventName(LayerEvents.AddWall);
     }

+ 39 - 49
src/view/case/draw/board/editCAD/Renderer/Draw.js

@@ -250,7 +250,8 @@ export default class Draw {
             //     this.context.fillText(geometry.value, fontStart1.newpoint2.x, fontStart1.newpoint2.y)
             // }
             //let count = (2*(i-(fontInfo.textValues.length-1))+1)
-            let count = 1 * (fontInfo.textValues.length-i)
+            //let count = 1 * (fontInfo.textValues.length-i)
+            let count = i+1
             count = 2* count  - fontInfo.textValues.length
             this.context.fillText(fontInfo.textValues[i], pt.x - fontWidth1/2, pt.y + dy*count)
         }
@@ -292,7 +293,7 @@ export default class Draw {
     drawCell(geometry,width,height){
 
         this.context.save()
-        this.context.lineWidth = Style.Table.lineWidth * coordinate.ratio
+        this.context.lineWidth = Style.Table.lineWidth 
         this.context.strokeStyle = Style.Table.strokeStyle
         this.context.fillStyle = Style.Table.fillStyle
 
@@ -321,16 +322,13 @@ export default class Draw {
         this.context.translate(width, height)
         this.context.beginPath()
         this.context.moveTo(0,0)
-        this.context.lineTo(geometry.width,0)
-        this.context.lineTo(geometry.width,geometry.height)
-        this.context.lineTo(0,geometry.height)
+        this.context.lineTo(geometry.width* coordinate.ratio,0)
+        this.context.lineTo(geometry.width* coordinate.ratio,geometry.height* coordinate.ratio)
+        this.context.lineTo(0,geometry.height* coordinate.ratio)
         this.context.closePath();
         this.context.stroke()
 
-        const defaultHeight = 24;
-        const defaultWidth = 156;
-
-        this.context.font = '12px Microsoft YaHei'
+        this.context.font = 12*coordinate.ratio+'px Microsoft YaHei'
         let fontWidth = this.context.measureText(geometry.value).width
         //如果是数字或者字母
         const patt = /[A-z0-9]/g;
@@ -342,12 +340,12 @@ export default class Draw {
         
 
         //let rowCount = Math.ceil(geometry.height/defaultHeight)               //分几行写
-        let rowCount = Math.ceil(fontWidth/geometry.width)                        //分几行写,根据要写的文字的长度来判断
+        let rowCount = Math.ceil(fontWidth/(geometry.width* coordinate.ratio))                        //分几行写,根据要写的文字的长度来判断
 
         if(rowCount == 1){
             this.context.textAlign = "center";
             this.context.textBaseline = "middle";
-            this.context.fillText(geometry.value, geometry.width/2, geometry.height/2)
+            this.context.fillText(geometry.value, geometry.width/2* coordinate.ratio, geometry.height/2* coordinate.ratio)
         }
         //大于1行
         else{
@@ -356,7 +354,7 @@ export default class Draw {
             this.context.textAlign = "left";
             for(let i=0;i<rowCount;++i){
                 const value = geometry.value.substr(i*rowFontCount,rowFontCount)
-                this.context.fillText(value, geometry.width/2 - rowWidth/2, 18+18*i)
+                this.context.fillText(value, (geometry.width/2* coordinate.ratio- rowWidth/2), (18+18*i)* coordinate.ratio)
             }
         }
 
@@ -460,7 +458,7 @@ export default class Draw {
 
     drawCircleGeo(geometry)
     {
-        let radius = geometry.radius * coordinate.res * coordinate.zoom/Constant.defaultZoom
+        let radius = geometry.radius * coordinate.res * coordinate.zoom/Constant.defaultZoom * coordinate.ratio
         const twoPi = Math.PI * 2
         const pt = coordinate.getScreenXY(geometry.center)
 
@@ -543,7 +541,7 @@ export default class Draw {
 
     drawIcon(geometry)
     {
-        let radius = geometry.radius * coordinate.res * coordinate.zoom/Constant.defaultZoom
+        let radius = geometry.radius * coordinate.res * coordinate.zoom/Constant.defaultZoom * coordinate.ratio
         const twoPi = Math.PI * 2
         const pt = coordinate.getScreenXY(geometry.center)
 
@@ -626,7 +624,7 @@ export default class Draw {
         this.setCanvasStyle(Style.Font)
         
         let fontSize = Math.ceil(radius * 14/20);
-        this.context.font = fontSize + Style.Font.font;   
+        this.context.font = fontSize + Style.Font.font   
         let center = coordinate.getScreenXY(geometry.center);
         this.context.fillText(geometry.value, center.x , center.y)
         this.context.restore()
@@ -842,17 +840,17 @@ export default class Draw {
             this.context.strokeStyle = Style.Focus.Title.strokeStyle
             this.context.fillStyle = Style.Focus.Title.fillStyle
         }
-        //let pt = {}
-        //pt.x = (this.context.canvas.width - this.context.measureText(geometry.value).width)/2
-        this.context.fillText(geometry.value, this.context.canvas.width/2, geometry.height)
+        //this.context.font = `400 ${geometry.fontSize}px Microsoft YaHei`
+        this.context.font = `${24*coordinate.ratio}px Microsoft YaHei`
+        this.context.fillText(geometry.value, this.context.canvas.width/2, geometry.height*coordinate.ratio)
         this.context.restore()
     }
     
     drawBgImage(geometry){
         if(geometry.src != null){
             const pt = {
-                x:80,
-                y:150
+                x:80*coordinate.ratio,
+                y:150*coordinate.ratio
             }
 
             this.context.save()
@@ -862,16 +860,16 @@ export default class Draw {
                 img.src = geometry.src;
                 img.crossOrigin=""
                 img.onload = function () {
-                    this.context.drawImage(img, pt.x, pt.y, img.width, img.height)
+                    this.context.drawImage(img, pt.x, pt.y, img.width*coordinate.ratio, img.height*coordinate.ratio)
                 }.bind(this)
                 geometry.image = img;
             }
             else{
                 if(geometry.hasOwnProperty('width')){
-                    this.context.drawImage(geometry.image, pt.x, pt.y, geometry.width, geometry.height)
+                    this.context.drawImage(geometry.image, pt.x, pt.y, geometry.width*coordinate.ratio, geometry.height*coordinate.ratio)
                 }
                 else{
-                    this.context.drawImage(geometry.image, pt.x, pt.y, geometry.image.width, geometry.image.height)
+                    this.context.drawImage(geometry.image, pt.x, pt.y, geometry.image.width*coordinate.ratio, geometry.image.height*coordinate.ratio)
                 }
                 
             }
@@ -881,20 +879,14 @@ export default class Draw {
 
     drawCustomImage(geometry){
         if(geometry.url != null){
-            // const focusItem = stateService.getFocusItem();
-            // if (focusItem && focusItem.type == VectorType.CustomImage) {
-            //     if (geometry.vectorId == focusItem.vectorId) {
-                
-            //     }
-            // }
             const pt = coordinate.getScreenXY(geometry.center)
             this.context.save()
 
             this.context.translate(pt.x, pt.y)
             this.context.scale(geometry.scale,geometry.scale)
-            this.context.translate(-1*geometry.ratio*geometry.width/4, -1*geometry.ratio*geometry.height/4)
+            this.context.translate(-1*geometry.ratio*geometry.width/2, -1*geometry.ratio*geometry.height/2)
             this.context.rotate((geometry.angle / 180) * Math.PI)
-            this.context.translate(geometry.ratio*geometry.width/4, geometry.ratio*geometry.height/4)
+            this.context.translate(geometry.ratio*geometry.width/2, geometry.ratio*geometry.height/2)
             
 
             if(geometry.image == null)
@@ -903,19 +895,16 @@ export default class Draw {
                 img.src = geometry.url;
                 img.crossOrigin=""
                 img.onload = function () {
-                    //this.context.drawImage(img, pt.x-img.width/2, pt.y-img.height/2, img.width, img.height)
-                    this.context.drawImage(img, -img.width / 2, -img.height / 2)
+                    this.context.drawImage(img, -img.width*coordinate.ratio, -img.height*coordinate.ratio)
                 }.bind(this)
                 geometry.image = img;
             }
             else{
                 if(geometry.hasOwnProperty('width')){
-                    //this.context.drawImage(geometry.image, pt.x-geometry.width/2, pt.y-geometry.height/2, geometry.width, geometry.height)
-                    this.context.drawImage(geometry.image, -geometry.ratio * geometry.width / 2, -geometry.ratio * geometry.height / 2,geometry.ratio * geometry.width / 2, geometry.ratio * geometry.height / 2)
+                    this.context.drawImage(geometry.image, -geometry.ratio * geometry.width*coordinate.ratio, -geometry.ratio * geometry.height*coordinate.ratio,geometry.ratio * geometry.width*coordinate.ratio, geometry.ratio * geometry.height*coordinate.ratio)
                 }
                 else{
-                    //this.context.drawImage(geometry.image, pt.x-geometry.width/2, pt.y-geometry.height/2, geometry.image.width, geometry.image.height)
-                    this.context.drawImage(geometry.image, -geometry.ratio * geometry.width / 2, -geometry.ratio * geometry.height / 2,geometry.ratio * geometry.width / 2, geometry.ratio * geometry.height / 2)
+                    this.context.drawImage(geometry.image, -geometry.ratio * geometry.width*coordinate.ratio, -geometry.ratio * geometry.height*coordinate.ratio,geometry.ratio * geometry.width*coordinate.ratio, geometry.ratio * geometry.height*coordinate.ratio)
                 }
                 
             }
@@ -926,7 +915,7 @@ export default class Draw {
                     this.context.lineWidth = 2/geometry.scale;
                     this.context.strokeStyle = Style.Select.Tag.strokeStyle
                     this.context.fillStyle = Style.Select.Tag.fillStyle
-                    this.context.strokeRect( -geometry.ratio * geometry.width/2, -geometry.ratio * geometry.height/2, geometry.ratio * geometry.width/2, geometry.ratio * geometry.height/2)
+                    this.context.strokeRect( -geometry.ratio * geometry.width, -geometry.ratio * geometry.height, geometry.ratio * geometry.width, geometry.ratio * geometry.height)
                 }
             }
             else if (selectItem && selectItem.type == VectorType.CustomImage) {
@@ -934,7 +923,7 @@ export default class Draw {
                     this.context.lineWidth = 2/geometry.scale;
                     this.context.strokeStyle = Style.Select.Tag.strokeStyle
                     this.context.fillStyle = Style.Select.Tag.fillStyle
-                    this.context.strokeRect( -geometry.ratio * geometry.width/2, -geometry.ratio * geometry.height/2, geometry.ratio * geometry.width/2, geometry.ratio * geometry.height/2)
+                    this.context.strokeRect( -geometry.ratio * geometry.width, -geometry.ratio * geometry.height, geometry.ratio * geometry.width, geometry.ratio * geometry.height)
                 }
             }
 
@@ -995,7 +984,8 @@ export default class Draw {
             }
         }
 
-        this.context.translate(geometry.center.x,geometry.center.y)
+        this.context.translate(geometry.center.x*coordinate.ratio,geometry.center.y*coordinate.ratio)
+        this.context.scale(coordinate.ratio,coordinate.ratio)
         this.context.translate(16, 36)
         this.context.rotate((geometry.angle)/180 * Math.PI)
         this.context.translate(-16, -36)
@@ -1179,7 +1169,7 @@ export default class Draw {
         this.context.rotate((geometry.angle / 180) * Math.PI)
         this.context.translate(pt.x - center.x, pt.y - center.y)
 
-        this.context.scale((geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom, (geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom)
+        this.context.scale((geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom*coordinate.ratio, (geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom*coordinate.ratio)
         this.context.lineWidth = 1 / ((geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom)
 
         this.context.miterLimit = 4
@@ -1286,7 +1276,7 @@ export default class Draw {
         this.context.translate(center.x, center.y)
         this.context.rotate((geometry.angle / 180) * Math.PI)
         this.context.translate(pt.x - center.x, pt.y - center.y)
-        this.context.scale((geometry.getLen() * geometry.scale * coordinate.res) / 32, (geometry.getLen() * geometry.scale * coordinate.res) / 32)
+        this.context.scale((geometry.getLen() * geometry.scale * coordinate.res) / 32*coordinate.ratio, (geometry.getLen() * geometry.scale * coordinate.res) / 32*coordinate.ratio)
         this.context.lineWidth = 1 / ((geometry.getLen() * geometry.scale * coordinate.res) / 32)
 
         this.context.beginPath();
@@ -1358,7 +1348,7 @@ export default class Draw {
         this.context.translate(center.x, center.y)
         this.context.rotate((geometry.angle / 180) * Math.PI)
         this.context.translate(pt.x - center.x, pt.y - center.y)
-        this.context.scale((geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom, (geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom)
+        this.context.scale((geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom*coordinate.ratio, (geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom*coordinate.ratio)
         this.context.lineWidth = 1 / ((geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom)
 
         this.context.beginPath();
@@ -1469,7 +1459,7 @@ export default class Draw {
         this.context.translate(center.x, center.y)
         this.context.rotate((geometry.angle / 180) * Math.PI)
         this.context.translate(pt.x - center.x, pt.y - center.y)
-        this.context.scale((geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom, (geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom)
+        this.context.scale((geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom*coordinate.ratio, (geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom*coordinate.ratio)
         this.context.lineWidth = 1 / ((geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom)
 
         this.context.beginPath();
@@ -1580,7 +1570,7 @@ export default class Draw {
         this.context.translate(center.x, center.y)
         this.context.rotate((geometry.angle / 180) * Math.PI)
         this.context.translate(pt.x - center.x, pt.y - center.y)
-        this.context.scale((geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom, (geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom)
+        this.context.scale((geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom*coordinate.ratio, (geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom*coordinate.ratio)
         this.context.lineWidth = 1 / ((geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom)
 
         this.context.beginPath();
@@ -1651,7 +1641,7 @@ export default class Draw {
         this.context.translate(center.x, center.y)
         this.context.rotate((geometry.angle / 180) * Math.PI)
         this.context.translate(pt.x - center.x, pt.y - center.y)
-        this.context.scale((geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom, (geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom)
+        this.context.scale((geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom*coordinate.ratio, (geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom*coordinate.ratio)
         this.context.lineWidth = 1 / ((geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom)
 
         this.context.beginPath();
@@ -1722,7 +1712,7 @@ export default class Draw {
         this.context.translate(center.x, center.y)
         this.context.rotate((geometry.angle / 180) * Math.PI)
         this.context.translate(pt.x - center.x, pt.y - center.y)
-        this.context.scale((geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom, (geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom)
+        this.context.scale((geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom*coordinate.ratio, (geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom*coordinate.ratio)
         this.context.lineWidth = 1 / ((geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom)
 
         this.context.beginPath();
@@ -1876,7 +1866,7 @@ export default class Draw {
         this.context.translate(center.x, center.y)
         this.context.rotate((geometry.angle / 180) * Math.PI)
         this.context.translate(pt.x - center.x, pt.y - center.y)
-        this.context.scale((geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom, (geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom)
+        this.context.scale((geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom*coordinate.ratio, (geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom*coordinate.ratio)
         this.context.lineWidth = 1 / ((geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom)
 
         this.context.beginPath();
@@ -1986,7 +1976,7 @@ export default class Draw {
         this.context.translate(center.x, center.y)
         this.context.rotate((geometry.angle / 180) * Math.PI)
         this.context.translate(pt.x - center.x, pt.y - center.y)
-        this.context.scale((geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom, (geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom)
+        this.context.scale((geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom*coordinate.ratio, (geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom*coordinate.ratio)
         this.context.lineWidth = 1 / ((geometry.getLen() * geometry.scale * coordinate.res) / 32 * coordinate.zoom/Constant.defaultZoom)
 
         this.context.beginPath();

+ 1 - 1
src/view/case/draw/board/editCAD/Service/CustomImageService.js

@@ -6,7 +6,7 @@ import Constant from '../Constant'
 
 export default class CustomImageService {
     constructor() {
-        this.defaultPix = 60;  //默认是30像素
+        this.defaultPix = 60;  
         this.url = null;
     }
 

+ 1 - 1
src/view/case/draw/board/editCAD/Service/FloorplanService.js

@@ -304,7 +304,7 @@ export class FloorplanService {
         }
         let customImage = this.getCustomImage(customImageId, floor)
         customImage = null
-        delete floorplanData.floors[floor].customImages[tagId]
+        delete floorplanData.floors[floor].customImages[customImageId]
     }
 
     addTable(table, floor) {

+ 4 - 0
src/view/case/draw/board/editCAD/enum/HistoryEvents.js

@@ -43,6 +43,10 @@ const HistoryEvents = {
     DeleteCustomImage: 'deleteCustomImage',
     ModifyCustomImage: 'modifyCustomImage',
 
+    AddBgImage: 'addBgImage',
+    DeleteBgImage: 'deleteBgImage',
+    ModifyBgImage: 'modifyBgImage',
+
     ModifyTitle: 'modifyTitle',
     ModifyImage: 'modifyImage',
     ModifyCompass: 'modifyCompass',

+ 3 - 0
src/view/case/draw/board/editCAD/enum/LayerEvents.js

@@ -35,6 +35,9 @@ const LayerEvents = {
     AddCustomImage: 'addCustomImage',
     MoveCustomImage: 'moveCustomImage',
 
+    AddBgImage: 'addBgImage',
+    ModifyBgImage: 'modifyBgImage',
+
     AddSign: 'addSign',
     MoveSign: 'moveSign',