From 1e1e5f612f252d66b0d0386cf52873bb1f3f7d7b Mon Sep 17 00:00:00 2001 From: haoxuan <haoxuan> Date: 星期五, 01 九月 2023 16:10:37 +0800 Subject: [PATCH] 系统维护+系统监控器+调试工具的app 增加 --- src/components/canvas/Dialog.vue | 36 ++++++++++++++++++++++++++++-------- 1 files changed, 28 insertions(+), 8 deletions(-) diff --git a/src/components/canvas/Dialog.vue b/src/components/canvas/Dialog.vue index 8245db6..da99d2b 100644 --- a/src/components/canvas/Dialog.vue +++ b/src/components/canvas/Dialog.vue @@ -97,11 +97,7 @@ width="960" height="540" :style=" - `position:static;background:url(${ - snapshot_url - ? `/httpImage/${snapshot_url}` - : backImg - }) 0% 0%/960px 540px no-repeat;` + `position:static;background:url(${snapshot_url}) 0% 0%/960px 540px no-repeat;` " ></canvas> <p @@ -202,7 +198,8 @@ methods: { // 鍒濆鍖栧嚱鏁� init() { - this.c = document.querySelector("#canvasDialog"); + //this.c = document.querySelector("#canvasDialog"); + this.c = this.$refs['canvasDialog']; this.ctx = this.c.getContext("2d"); this.drawCanvasInit(); this.canvasData = JSON.parse(JSON.stringify(this.canvasDataToChild)); @@ -222,7 +219,8 @@ cancel() { this.changeType('0') this.undisabled() - this.delCursor = {} + //this.delCursor = {} + this.delCursor = { type: -1, index: -1, remarksName: "", id: "" }; this.canvasHistory.length = 0; this.step = -1; this.canvasData = JSON.parse(JSON.stringify(this.canvasDataToChild)); @@ -524,6 +522,7 @@ } }); _this.canvasData.rect.forEach(function (v, i) { + _this.ctx.strokeStyle = "yellow"; _this.ctx.beginPath(); _this.ctx.moveTo(v.location[0].x, v.location[0].y); @@ -790,6 +789,7 @@ // console.log("鎾ら攢锛�",this.canvasData); }, disabledOthers(type) { + console.log("褰撳墠type:", type) switch (type) { case "1": @@ -827,6 +827,7 @@ console.log("绂佺敤澶氳竟褰細", this.disablePolygon) }, undisabled() { + this.disableLine = false this.disableRect = false this.disableArrow = false @@ -856,6 +857,7 @@ width = typeof width !== "undefined" ? width : 1; // color = typeof color !== 'undefined' ? color : 'yellow' // 璁$畻鍚勮搴﹀拰瀵瑰簲鐨凱2,P3鍧愭爣 + let angle = (Math.atan2(fromY - toY, fromX - toX) * 180) / Math.PI; let angle1 = ((angle + theta) * Math.PI) / 180; let angle2 = ((angle - theta) * Math.PI) / 180; @@ -885,6 +887,7 @@ }, // 鑾峰彇鐩稿鍧愭爣(鏆備笉鐢�) getLocation(x, y, c) { + let bbox = c.getBoundingClientRect(); return { x: (x - bbox.left) * (c.width / bbox.width), @@ -899,6 +902,7 @@ }, // 鐢熸垚鍥惧舰澶囨敞 remarks(x, y, type) { + this.ctx.moveTo(x, y - 20); this.ctx.fillStyle = "green"; // 璁剧疆濉厖棰滆壊涓虹豢鑹� this.ctx.font = '20px "寰蒋闆呴粦"'; // 璁剧疆瀛椾綋 @@ -928,6 +932,7 @@ }, // 鍥炴樉鍥惧舰澶囨敞 showRemarks(x, y, remarks, isHightlight) { + this.ctx.moveTo(x, y - 20); if (isHightlight) { this.ctx.fillStyle = "#8ae22e"; // 璁剧疆濉厖棰滆壊涓虹豢鑹� @@ -941,6 +946,7 @@ }, // 閲嶇幇淇濆瓨鐢婚潰 loadImage() { + if (this.step > -1) { let img = new Image(); img.src = this.canvasHistory[this.step].src; @@ -949,6 +955,7 @@ }, // 鍒囨崲鐢荤嚎绫诲瀷 changeType(num) { + if (num === '0') { this.c.style.cursor = "pointer"; } else { @@ -958,6 +965,7 @@ }, // 缁樺埗澶氳竟褰㈡柟娉� drawPolygonUtil(points) { + this.ctx.strokeStyle = "yellow"; this.ctx.lineWidth = 2; this.ctx.beginPath(); @@ -984,6 +992,7 @@ }, // 鐢荤煩褰㈢Щ鍔ㄥ嚱鏁� drawRect(e) { + if (this.flag) { this.ctx.clearRect(0, 0, this.c.width, this.c.height); this.loadImage(); @@ -1018,11 +1027,13 @@ } }, twoPointDistance(p1, p2) { + let dep = Math.sqrt(Math.pow((p1.x - p2.x), 2) + Math.pow((p1.y - p2.y), 2)); return dep; }, // 鐢诲杈瑰舰绉诲姩鍑芥暟 drawPolygon(e) { + if (this.flag) { this.ctx.clearRect(0, 0, this.c.width, this.c.height); this.loadImage(); @@ -1041,6 +1052,7 @@ }, // 鐢荤洿绾挎姮璧� lineMouseUp(e) { + if ( Math.abs(this.originX - e.offsetX) < 5 && Math.abs(this.originY - e.offsetY) < 5 @@ -1097,6 +1109,7 @@ }, // 鐢荤煩褰㈡姮璧� rectMouseUp(e) { + if ( Math.abs(this.originX - e.offsetX) < 5 && Math.abs(this.originY - e.offsetY) < 5 @@ -1219,6 +1232,7 @@ }, // 鐢诲杈瑰舰缁撴潫鏃跺弻鍑� polygonDblclick(e) { + this.flag = false; this.points.pop(); // 鍙屽嚮涔嬪悗澶氫竴涓偣鐨勯噸澶嶅潗鏍囷紝闇�瑕佸垹闄� let Id @@ -1266,6 +1280,7 @@ }, // 閲婃斁缂栬緫鐘舵�� freedEdit() { + this.editObj = {} }, // 鍥炴樉鍘嗗彶鏁版嵁鏃惰绠椾竴涓嬪洖鏄剧殑姣忕鍏冪礌鐨勬暟閲忎互渚跨敓鎴愬浘褰㈡敞瑙f椂鑾峰緱姝g‘鐨勫紑澶� @@ -1273,10 +1288,14 @@ this.lineIndex = this.canvasData.line.length; this.rectIndex = this.canvasData.rect.length; this.arrowIndex = this.canvasData.arrow.length; - this.polygonIndex = this.canvasData.polygon.length; + //鎺掗櫎this.canvasData.polygon鍏ㄩ儴鍖哄煙(鍏ㄩ儴鍖哄煙鐨刬d灏辨槸鎽勫儚鏈虹殑id) + + let filterPolygonArr = this.canvasData.polygon.filter(item=>item.id != this.TreeDataPool.selectedNode.id) + this.polygonIndex = filterPolygonArr.length; }, // 鐢熸垚uuid getUuid() { + let originStr = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"; let originChar = "0123456789abcdef"; let len = originChar.length; @@ -1286,6 +1305,7 @@ }, // 鍒ゆ柇涓�涓偣鏄惁绂讳竴涓浘褰㈢殑鏈�灏忚窛绂讳负n鍍忕礌浠ュ唴 minDistance(x, y, locations, n) { + let flag = false for (let i = 0; i < locations.length; i++) { if (i == locations.length - 1) { -- Gitblit v1.8.0