|
@@ -788,12 +788,14 @@ export default {
|
|
|
this.currentStickerColor = item;
|
|
|
},
|
|
|
addSticker(mode) {
|
|
|
+ let layer = this.$store.state.layer;
|
|
|
//新增便利貼物件
|
|
|
let x, y;
|
|
|
let textNode = this.$store.state.currentEditTextNode;
|
|
|
x = mode == "new" ? this.stage.width() * 0.1 + Math.floor(Math.random() * 200) : textNode.attrs.x;
|
|
|
y = mode == "new" ? this.stage.height() * 0.2 + Math.floor(Math.random() * 200) : textNode.attrs.y;
|
|
|
let uuid=this.$jsFn.getUUID()
|
|
|
+ let currentIndex=layer?.children ? JSON.parse(JSON.stringify(layer?.children)).length : 1
|
|
|
let pastText = new Konva.Label({
|
|
|
x: x,
|
|
|
y: y,
|
|
@@ -801,7 +803,8 @@ export default {
|
|
|
draggable: true,
|
|
|
listening: true,
|
|
|
text: this.currentAddTextValue,
|
|
|
- uuid:uuid
|
|
|
+ uuid:uuid,
|
|
|
+ index:currentIndex
|
|
|
});
|
|
|
pastText.add(
|
|
|
new Konva.Tag({
|
|
@@ -861,9 +864,11 @@ export default {
|
|
|
this.addMenuBtnToTr(tr, pastText);
|
|
|
},
|
|
|
addPureText(mode) {
|
|
|
+ let layer = this.$store.state.layer;
|
|
|
//新增便利貼物件
|
|
|
let x, y;
|
|
|
let pastText = this.$store.state.currentEditTextNode;
|
|
|
+ let currentIndex=layer?.children ? JSON.parse(JSON.stringify(layer?.children)).length : 1
|
|
|
x = mode == "new" ? window.innerWidth / 2 - 100 : pastText.attrs.x;
|
|
|
y = mode == "new" ? window.innerHeight / 2 - 100 : pastText.attrs.y;
|
|
|
//新增純文字物件
|
|
@@ -877,7 +882,8 @@ export default {
|
|
|
width: 300,
|
|
|
height: "auto",
|
|
|
name: "text",
|
|
|
- uuid:this.$jsFn.getUUID()
|
|
|
+ uuid:this.$jsFn.getUUID(),
|
|
|
+ index:currentIndex
|
|
|
});
|
|
|
|
|
|
let tr = new Konva.Transformer({
|
|
@@ -1116,6 +1122,7 @@ export default {
|
|
|
pasteTargetByKonvaObj(item, index) {
|
|
|
let stage = this.$store.state.stage;
|
|
|
let layer = this.$store.state.layer;
|
|
|
+ let currentIndex=layer?.children ? JSON.parse(JSON.stringify(layer?.children)).length : 1
|
|
|
this.$store.state.textColor = "black";
|
|
|
let text = item.seat + "\t\t\t" + (this.$store.state.hideStudentName == false ? item.name : "");
|
|
|
|
|
@@ -1168,7 +1175,8 @@ export default {
|
|
|
text: text,
|
|
|
draggable: true,
|
|
|
listening: true,
|
|
|
- uuid:uuid
|
|
|
+ uuid:uuid ,
|
|
|
+ index:currentIndex
|
|
|
});
|
|
|
|
|
|
group.add(image);
|
|
@@ -1928,6 +1936,7 @@ export default {
|
|
|
// image: imageObj,
|
|
|
src: pdfSrc,
|
|
|
name: "boardPdfBg",
|
|
|
+ index: 0,
|
|
|
});
|
|
|
|
|
|
that.layer.add(image);
|
|
@@ -1989,6 +1998,7 @@ export default {
|
|
|
// image: imageObj,
|
|
|
src: finallink,
|
|
|
name: "boardPdfBg",
|
|
|
+ index: 0,
|
|
|
});
|
|
|
|
|
|
that.layer.add(image);
|
|
@@ -2157,6 +2167,7 @@ export default {
|
|
|
// image: imageObj,
|
|
|
src: targetUrl,
|
|
|
name: "boardPdfBg",
|
|
|
+ index: 0,
|
|
|
});
|
|
|
|
|
|
that.layer.add(image);
|
|
@@ -2522,8 +2533,7 @@ export default {
|
|
|
if(mode=='shape'|| mode=='pencil-alt'){
|
|
|
let addElement= layer.children[layer.children.length - 1]
|
|
|
that.$toolbox.saveUndoHistory('add', addElement )//儲存undo記錄
|
|
|
- }
|
|
|
- else if(mode == 'check'){
|
|
|
+ }else if(mode == 'check'){
|
|
|
that.$toolbox.saveUndoUpdate()
|
|
|
}
|
|
|
|
|
@@ -2582,7 +2592,7 @@ export default {
|
|
|
let textSize = that.$store.state.textSize;
|
|
|
let textColor = that.$store.state.textColor;
|
|
|
let pos = stage.getPointerPosition();
|
|
|
-
|
|
|
+
|
|
|
if (mode == "check") {
|
|
|
// 选择工具
|
|
|
document.body.classList.remove("cursor-fdj");
|
|
@@ -2802,7 +2812,8 @@ export default {
|
|
|
shadowBlur: 1,
|
|
|
shadowColor: strokeColor,
|
|
|
tension: 0.5,
|
|
|
- uuid:that.$jsFn.getUUID()
|
|
|
+ uuid:that.$jsFn.getUUID(),
|
|
|
+ index: layer?.children ? layer?.children.length : 1
|
|
|
});
|
|
|
layer.add(lastLine);
|
|
|
} else if (mode == "shape") {
|
|
@@ -2821,7 +2832,8 @@ export default {
|
|
|
name: "line",
|
|
|
lineCap: "round",
|
|
|
lineJoin: "round",
|
|
|
- uuid:that.$jsFn.getUUID()
|
|
|
+ uuid:that.$jsFn.getUUID(),
|
|
|
+ index: layer?.children ? layer?.children.length : 1
|
|
|
});
|
|
|
layer.add(rect);
|
|
|
} else if (shapeType == "long-arrow-alt-right") {
|
|
@@ -2842,7 +2854,8 @@ export default {
|
|
|
lineCap: "round",
|
|
|
lineJoin: "round",
|
|
|
draggable: true,
|
|
|
- uuid:that.$jsFn.getUUID()
|
|
|
+ uuid:that.$jsFn.getUUID(),
|
|
|
+ index: layer?.children ? layer?.children.length : 1
|
|
|
});
|
|
|
} else {
|
|
|
if (shapeType == "square") {
|
|
@@ -2856,7 +2869,8 @@ export default {
|
|
|
stroke: shapeBorderColor,
|
|
|
strokeWidth: 4,
|
|
|
name: "rect",
|
|
|
- uuid:that.$jsFn.getUUID()
|
|
|
+ uuid:that.$jsFn.getUUID(),
|
|
|
+ index: layer?.children ? layer?.children.length : 1
|
|
|
});
|
|
|
} else if (shapeType == "circle") {
|
|
|
// 正圆
|
|
@@ -2869,7 +2883,8 @@ export default {
|
|
|
stroke: shapeBorderColor,
|
|
|
strokeWidth: 4,
|
|
|
name: "circle",
|
|
|
- uuid:that.$jsFn.getUUID()
|
|
|
+ uuid:that.$jsFn.getUUID(),
|
|
|
+ index: layer?.children ? layer?.children.length : 1
|
|
|
});
|
|
|
} else if (shapeType == "ellipse") {
|
|
|
// 椭圆
|
|
@@ -2883,7 +2898,8 @@ export default {
|
|
|
stroke: shapeBorderColor,
|
|
|
strokeWidth: 4,
|
|
|
name: "ellipse",
|
|
|
- uuid:that.$jsFn.getUUID()
|
|
|
+ uuid:that.$jsFn.getUUID(),
|
|
|
+ index: layer?.children ? layer?.children.length : 1
|
|
|
});
|
|
|
} else if (shapeType == "campground") {
|
|
|
// 三角形
|
|
@@ -2896,7 +2912,8 @@ export default {
|
|
|
stroke: shapeBorderColor,
|
|
|
strokeWidth: 4,
|
|
|
name: "campground",
|
|
|
- uuid:that.$jsFn.getUUID()
|
|
|
+ uuid:that.$jsFn.getUUID(),
|
|
|
+ index: layer?.children ? layer?.children.length : 1
|
|
|
});
|
|
|
} else if (shapeType == "star") {
|
|
|
// 五角星
|
|
@@ -2910,7 +2927,8 @@ export default {
|
|
|
stroke: shapeBorderColor,
|
|
|
strokeWidth: 4,
|
|
|
name: "star",
|
|
|
- uuid:that.$jsFn.getUUID()
|
|
|
+ uuid:that.$jsFn.getUUID(),
|
|
|
+ index: layer?.children ? layer?.children.length : 1
|
|
|
});
|
|
|
}
|
|
|
console.log(rect);
|
|
@@ -2927,6 +2945,7 @@ export default {
|
|
|
//trs.nodes();
|
|
|
var selectionRectangle = new Konva.Rect({
|
|
|
fill: "rgba(180,180,180,0.5)",
|
|
|
+ name: "selectionRectangle",
|
|
|
});
|
|
|
console.log(selectionRectangle);
|
|
|
layer.add(selectionRectangle);
|
|
@@ -2988,25 +3007,26 @@ export default {
|
|
|
//console.log(selected, '内容')
|
|
|
//console.log(stage.eventListeners,'点击过后的')
|
|
|
selected.forEach((i) => {
|
|
|
- console.log(i);
|
|
|
+ that.$toolbox.saveUndoHistory("delete", i);
|
|
|
i.destroy();
|
|
|
});
|
|
|
//trs.nodes(selected);
|
|
|
//layer.batchDraw();
|
|
|
});
|
|
|
+ let currentDeleteObj;
|
|
|
document.body.classList.remove("cursor-fdj");
|
|
|
if (e.target != stage && e.target.attrs.name != "boardPdfBg") {
|
|
|
- // stage.find('Transformer').destroy()
|
|
|
- stage.find("Transformer").forEach(function (ele, i) {
|
|
|
- if (ele.attrs.name == "default") {
|
|
|
- ele.destroy();
|
|
|
- }
|
|
|
- });
|
|
|
+
|
|
|
+ that.$toolbox.removeTransformer()
|
|
|
//刪除便利貼,點到文字就殺整個
|
|
|
- if (e.target.className == "Text" && e.target.parent?.className == "Label") {
|
|
|
- e.target.parent.destroy();
|
|
|
+ if (e.target.className == "Text" && e.target.parent?.className == "Label"||e.target.attrs.name=='pastTextPickName'||e.target.attrs.name=='pastImgContent') {
|
|
|
+ currentDeleteObj = e.target.parent;
|
|
|
+
|
|
|
+ }else{
|
|
|
+ currentDeleteObj= e.target
|
|
|
}
|
|
|
- e.target.destroy();
|
|
|
+ that.$toolbox.saveUndoHistory("delete", currentDeleteObj);
|
|
|
+ currentDeleteObj.destroy();
|
|
|
layer.draw();
|
|
|
}
|
|
|
}
|
|
@@ -3229,15 +3249,9 @@ export default {
|
|
|
//that.$store.state.checkvalue='checkbtn'
|
|
|
document.body.style.cursor = "default";
|
|
|
//stage.find('Transformer').destroy()
|
|
|
- if(val!='undo'){
|
|
|
- stage.find("Transformer").forEach(function (ele, i) {
|
|
|
- console.log(ele, i, "查看执行的内容");
|
|
|
- if (ele.attrs.name == "default") {
|
|
|
- ele.destroy();
|
|
|
- }
|
|
|
- });
|
|
|
+ that.$toolbox.removeTransformer()
|
|
|
layer.draw();
|
|
|
- }
|
|
|
+
|
|
|
}
|
|
|
if (val == "zooms") {
|
|
|
// console.log('点击了缩放工具!')
|
|
@@ -7591,6 +7605,7 @@ export default {
|
|
|
x: stageX,
|
|
|
y: locationY ? parseInt(locationY) : 0,
|
|
|
image: imageObj,
|
|
|
+ index: 0,
|
|
|
},
|
|
|
className: "Image",
|
|
|
},
|