master
fanluyan 1 year ago
parent 5cb1f01702
commit d5b604a2be

@ -163,7 +163,7 @@ export default {
if (isProduction) {
// 使IP
this.hostName = window.location.origin;
console.log(this.hostName)
console.log(this.hostName);
console.log("aaaaaaaaaaaa");
} else {
// 使 target
@ -184,6 +184,7 @@ export default {
.then((res) => {
console.log(res);
this.markOptions = res.data;
this.typeMap = res.data;
})
.catch((err) => {});
},
@ -429,6 +430,44 @@ export default {
},
//
drawOldRect() {
var colors = {
0: "rgb(255, 0, 0)", // -
1: "rgb(0, 128, 0)", // - 绿
2: "rgb(0, 0, 255)", // -
3: "rgb(255, 165, 0)", // -
4: "rgb(255, 0, 255)", // -
5: "rgb(0, 0, 128)", // -
6: "rgb(0, 255, 255)", // -
7: "rgb(173, 216, 230)", // -
8: "rgb(255, 128, 0)", // -
9: "rgb(220, 220, 220)", // -
10: "rgb(128, 0, 128)", // -
11: "rgb(255, 255, 0)", // -
12: "rgb(100, 149, 237)", // -
13: "rgb(255, 192, 203)", // -
14: "rgb(128, 128, 0)", // - 绿
15: "rgb(240, 128, 128)", // -
16: "rgb(255, 69, 0)", // -
};
var bgcolors = {
0: "rgb(255, 0, 0,0.2)", // -
1: "rgb(0, 128, 0,0.2)", // - 绿
2: "rgb(0, 0, 255,0.2)", // -
3: "rgb(255, 165, 0,0.2)", // -
4: "rgb(255, 0, 255,0.2)", // -
5: "rgb(0, 0, 128,0.2)", // -
6: "rgb(0, 255, 255,0.2)", // -
7: "rgb(173, 216, 230,0.2)", // -
8: "rgb(255, 128, 0,0.2)", // -
9: "rgb(220, 220, 220,0.2)", // -
10: "rgb(128, 0, 128,0.2)", // -
11: "rgb(255, 255, 0,0.2)", // -
12: "rgb(100, 149, 237,0.2)", // -
13: "rgb(255, 192, 203,0.2)", // -
14: "rgb(128, 128, 0,0.2)", // - 绿
15: "rgb(240, 128, 128,0.2)", // -
16: "rgb(255, 69, 0,0.2)", // -
};
let canvasDom = document.getElementById("canvasDom");
let ctx2d = canvasDom.getContext("2d");
const canvasHeight = canvasDom.width;
@ -439,9 +478,18 @@ export default {
if (this.recArrs[i].w > 2 && this.recArrs[i].h > 2) {
ctx2d.beginPath();
ctx2d.lineWidth = 2; // 线
ctx2d.strokeStyle = "rgb(255, 0, 0)"; // 线
//
ctx2d.fillStyle = "rgba(22, 158, 140, 0.4)"; //
// type
var typeColor = colors[this.recArrs[i].type] || "rgb(255, 0, 0)";
var bgcolors =
bgcolors[this.recArrs[i].type] || "rgba(22, 158, 140, 0.2)";
console.log(typeColor);
ctx2d.strokeStyle = typeColor; // 线
ctx2d.fillStyle = bgcolors; // 线
// ctx2d.strokeStyle = "rgb(255, 0, 0)"; // 线
// //
// ctx2d.fillStyle = "rgba(22, 158, 140, 0.4)"; //
ctx2d.strokeRect(
this.recArrs[i].x,
@ -457,9 +505,10 @@ export default {
); //
//
if (this.recArrs[i].text) {
ctx2d.font = "100 18px 微软雅黑";
ctx2d.font = "100 13px 微软雅黑";
ctx2d.lineWidth = 1;
ctx2d.strokeStyle = "rgb(255,0,0)";
//ctx2d.strokeStyle = "rgb(255,0,0)";
ctx2d.strokeStyle = colors[this.recArrs[i].type] || "rgb(255,0,0)";
ctx2d.strokeText(
this.recArrs[i].text,
this.recArrs[i].x +
@ -878,7 +927,7 @@ export default {
img {
position: absolute;
max-width: 100%;
max-height: calc(100% - 10px);
// max-height: calc(100% - 10px);
cursor: move;
-moz-user-select: none; /*火狐*/
-webkit-user-select: none; /*webkit浏览器*/

Loading…
Cancel
Save