fix safari builder scaling
This commit is contained in:
@@ -343,7 +343,7 @@ export default {
|
|||||||
},
|
},
|
||||||
onResizeCell (e) {
|
onResizeCell (e) {
|
||||||
if (e.target.id === 'mask') {
|
if (e.target.id === 'mask') {
|
||||||
const positionX = e.layerX / (e.target.clientWidth - 1)
|
const positionX = e.offsetX / (e.target.clientWidth - 1)
|
||||||
|
|
||||||
if (positionX > this.area.x) {
|
if (positionX > this.area.x) {
|
||||||
this.area.cell_w = positionX - this.area.x
|
this.area.cell_w = positionX - this.area.x
|
||||||
@@ -389,16 +389,16 @@ export default {
|
|||||||
},
|
},
|
||||||
resize (e) {
|
resize (e) {
|
||||||
if (e.target.id === 'mask') {
|
if (e.target.id === 'mask') {
|
||||||
this.area.w = e.layerX / e.target.clientWidth - this.area.x
|
this.area.w = e.offsetX / e.target.clientWidth - this.area.x
|
||||||
this.area.h = e.layerY / e.target.clientHeight - this.area.y
|
this.area.h = e.offsetY / e.target.clientHeight - this.area.y
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
drag (e) {
|
drag (e) {
|
||||||
if (e.target.id === 'mask') {
|
if (e.target.id === 'mask') {
|
||||||
this.isDragged = true
|
this.isDragged = true
|
||||||
|
|
||||||
this.area.x = (e.layerX - this.dragFrom.x) / e.target.clientWidth
|
this.area.x = (e.offsetX - this.dragFrom.x) / e.target.clientWidth
|
||||||
this.area.y = (e.layerY - this.dragFrom.y) / e.target.clientHeight
|
this.area.y = (e.offsetY - this.dragFrom.y) / e.target.clientHeight
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
startDrag (e) {
|
startDrag (e) {
|
||||||
|
|||||||
@@ -162,8 +162,8 @@ export default {
|
|||||||
},
|
},
|
||||||
onDrop (e) {
|
onDrop (e) {
|
||||||
this.$emit('drop-field', {
|
this.$emit('drop-field', {
|
||||||
x: e.layerX,
|
x: e.offsetX,
|
||||||
y: e.layerY,
|
y: e.offsetY,
|
||||||
maskW: this.$refs.mask.clientWidth,
|
maskW: this.$refs.mask.clientWidth,
|
||||||
maskH: this.$refs.mask.clientHeight,
|
maskH: this.$refs.mask.clientHeight,
|
||||||
page: this.number
|
page: this.number
|
||||||
@@ -186,10 +186,10 @@ export default {
|
|||||||
|
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.newArea = {
|
this.newArea = {
|
||||||
initialX: e.layerX / this.$refs.mask.clientWidth,
|
initialX: e.offsetX / this.$refs.mask.clientWidth,
|
||||||
initialY: e.layerY / this.$refs.mask.clientHeight,
|
initialY: e.offsetY / this.$refs.mask.clientHeight,
|
||||||
x: e.layerX / this.$refs.mask.clientWidth,
|
x: e.offsetX / this.$refs.mask.clientWidth,
|
||||||
y: e.layerY / this.$refs.mask.clientHeight,
|
y: e.offsetY / this.$refs.mask.clientHeight,
|
||||||
w: 0,
|
w: 0,
|
||||||
h: 0
|
h: 0
|
||||||
}
|
}
|
||||||
@@ -197,19 +197,19 @@ export default {
|
|||||||
},
|
},
|
||||||
onPointermove (e) {
|
onPointermove (e) {
|
||||||
if (this.newArea) {
|
if (this.newArea) {
|
||||||
const dx = e.layerX / this.$refs.mask.clientWidth - this.newArea.initialX
|
const dx = e.offsetX / this.$refs.mask.clientWidth - this.newArea.initialX
|
||||||
const dy = e.layerY / this.$refs.mask.clientHeight - this.newArea.initialY
|
const dy = e.offsetY / this.$refs.mask.clientHeight - this.newArea.initialY
|
||||||
|
|
||||||
if (dx > 0) {
|
if (dx > 0) {
|
||||||
this.newArea.x = this.newArea.initialX
|
this.newArea.x = this.newArea.initialX
|
||||||
} else {
|
} else {
|
||||||
this.newArea.x = e.layerX / this.$refs.mask.clientWidth
|
this.newArea.x = e.offsetX / this.$refs.mask.clientWidth
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dy > 0) {
|
if (dy > 0) {
|
||||||
this.newArea.y = this.newArea.initialY
|
this.newArea.y = this.newArea.initialY
|
||||||
} else {
|
} else {
|
||||||
this.newArea.y = e.layerY / this.$refs.mask.clientHeight
|
this.newArea.y = e.offsetY / this.$refs.mask.clientHeight
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.drawField?.type === 'cells') {
|
if (this.drawField?.type === 'cells') {
|
||||||
|
|||||||
Reference in New Issue
Block a user