超出範圍要拉回
This commit is contained in:
@@ -1076,6 +1076,12 @@
|
|||||||
el.style.visibility = el.style.visibility === "hidden" ? "" : "hidden";
|
el.style.visibility = el.style.visibility === "hidden" ? "" : "hidden";
|
||||||
//要判斷如果所在位置超出範圍,要拉回來放
|
//要判斷如果所在位置超出範圍,要拉回來放
|
||||||
console.log("displayItem:", this.paper)
|
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({
|
$("#" + 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
|
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
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user