From e01873ebcc69acc322c1432a10ed18c570441841 Mon Sep 17 00:00:00 2001
From: zhangzengfei <zhangzengfei@smartai.com>
Date: 星期三, 23 三月 2022 23:26:17 +0800
Subject: [PATCH] 修复检索视频选择下一个,播放器未重新加载的问题
---
src/components/canvas/Dialog.vue | 26 ++++++++++++++++++++++----
1 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/src/components/canvas/Dialog.vue b/src/components/canvas/Dialog.vue
index e0f11e1..da99d2b 100644
--- a/src/components/canvas/Dialog.vue
+++ b/src/components/canvas/Dialog.vue
@@ -198,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));
@@ -394,7 +395,6 @@
},
// 鍒犻櫎鍏冪礌
del() {
- debugger
let delEle = {};
switch (this.delCursor.type) {
case "1":
@@ -411,7 +411,7 @@
break;
case "5":
delEle = this.canvasData.polygon[this.delCursor.index];
- this.canvasData.polygon.splice(this.delCursor.index+1, 1);
+ this.canvasData.polygon.splice(this.delCursor.index, 1);
break;
}
this.clickSelect();
@@ -522,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);
@@ -788,6 +789,7 @@
// console.log("鎾ら攢锛�",this.canvasData);
},
disabledOthers(type) {
+
console.log("褰撳墠type:", type)
switch (type) {
case "1":
@@ -825,6 +827,7 @@
console.log("绂佺敤澶氳竟褰細", this.disablePolygon)
},
undisabled() {
+
this.disableLine = false
this.disableRect = false
this.disableArrow = false
@@ -854,7 +857,7 @@
width = typeof width !== "undefined" ? width : 1;
// color = typeof color !== 'undefined' ? color : 'yellow'
// 璁$畻鍚勮搴﹀拰瀵瑰簲鐨凱2,P3鍧愭爣
- debugger
+
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;
@@ -884,6 +887,7 @@
},
// 鑾峰彇鐩稿鍧愭爣(鏆備笉鐢�)
getLocation(x, y, c) {
+
let bbox = c.getBoundingClientRect();
return {
x: (x - bbox.left) * (c.width / bbox.width),
@@ -898,6 +902,7 @@
},
// 鐢熸垚鍥惧舰澶囨敞
remarks(x, y, type) {
+
this.ctx.moveTo(x, y - 20);
this.ctx.fillStyle = "green"; // 璁剧疆濉厖棰滆壊涓虹豢鑹�
this.ctx.font = '20px "寰蒋闆呴粦"'; // 璁剧疆瀛椾綋
@@ -927,6 +932,7 @@
},
// 鍥炴樉鍥惧舰澶囨敞
showRemarks(x, y, remarks, isHightlight) {
+
this.ctx.moveTo(x, y - 20);
if (isHightlight) {
this.ctx.fillStyle = "#8ae22e"; // 璁剧疆濉厖棰滆壊涓虹豢鑹�
@@ -940,6 +946,7 @@
},
// 閲嶇幇淇濆瓨鐢婚潰
loadImage() {
+
if (this.step > -1) {
let img = new Image();
img.src = this.canvasHistory[this.step].src;
@@ -948,6 +955,7 @@
},
// 鍒囨崲鐢荤嚎绫诲瀷
changeType(num) {
+
if (num === '0') {
this.c.style.cursor = "pointer";
} else {
@@ -957,6 +965,7 @@
},
// 缁樺埗澶氳竟褰㈡柟娉�
drawPolygonUtil(points) {
+
this.ctx.strokeStyle = "yellow";
this.ctx.lineWidth = 2;
this.ctx.beginPath();
@@ -983,6 +992,7 @@
},
// 鐢荤煩褰㈢Щ鍔ㄥ嚱鏁�
drawRect(e) {
+
if (this.flag) {
this.ctx.clearRect(0, 0, this.c.width, this.c.height);
this.loadImage();
@@ -1017,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();
@@ -1040,6 +1052,7 @@
},
// 鐢荤洿绾挎姮璧�
lineMouseUp(e) {
+
if (
Math.abs(this.originX - e.offsetX) < 5 &&
Math.abs(this.originY - e.offsetY) < 5
@@ -1096,6 +1109,7 @@
},
// 鐢荤煩褰㈡姮璧�
rectMouseUp(e) {
+
if (
Math.abs(this.originX - e.offsetX) < 5 &&
Math.abs(this.originY - e.offsetY) < 5
@@ -1218,6 +1232,7 @@
},
// 鐢诲杈瑰舰缁撴潫鏃跺弻鍑�
polygonDblclick(e) {
+
this.flag = false;
this.points.pop(); // 鍙屽嚮涔嬪悗澶氫竴涓偣鐨勯噸澶嶅潗鏍囷紝闇�瑕佸垹闄�
let Id
@@ -1265,6 +1280,7 @@
},
// 閲婃斁缂栬緫鐘舵��
freedEdit() {
+
this.editObj = {}
},
// 鍥炴樉鍘嗗彶鏁版嵁鏃惰绠椾竴涓嬪洖鏄剧殑姣忕鍏冪礌鐨勬暟閲忎互渚跨敓鎴愬浘褰㈡敞瑙f椂鑾峰緱姝g‘鐨勫紑澶�
@@ -1279,6 +1295,7 @@
},
// 鐢熸垚uuid
getUuid() {
+
let originStr = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
let originChar = "0123456789abcdef";
let len = originChar.length;
@@ -1288,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