超出範圍要拉回

This commit is contained in:
2026-07-01 17:49:37 +08:00
parent 82c9f51bcd
commit 31e382070f
+6
View File
@@ -1076,6 +1076,12 @@
el.style.visibility = el.style.visibility === "hidden" ? "" : "hidden";
//要判斷如果所在位置超出範圍,要拉回來放
console.log("displayItem:", this.paper)
if (el.x > this.paper.width) {
el.x = this.paper.width/2
}
if (el.y>this.paper.height) {
el.y=this.paper.height/2
}
$("#" + id).css({
position: "absolute", left: el.x + "mm", top: el.y + "mm", fontSize: el.style.fontSize + 'pt', fontFamily: el.style.fontFamily, "z-index": 9999, visibility: el.style.visibility
})