fix safari builder scaling

pull/220/head^2
Pete Matsyburka 2 years ago
parent c2c9bb64b1
commit 493a2108e9

@ -343,7 +343,7 @@ export default {
},
onResizeCell (e) {
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) {
this.area.cell_w = positionX - this.area.x
@ -389,16 +389,16 @@ export default {
},
resize (e) {
if (e.target.id === 'mask') {
this.area.w = e.layerX / e.target.clientWidth - this.area.x
this.area.h = e.layerY / e.target.clientHeight - this.area.y
this.area.w = e.offsetX / e.target.clientWidth - this.area.x
this.area.h = e.offsetY / e.target.clientHeight - this.area.y
}
},
drag (e) {
if (e.target.id === 'mask') {
this.isDragged = true
this.area.x = (e.layerX - this.dragFrom.x) / e.target.clientWidth
this.area.y = (e.layerY - this.dragFrom.y) / e.target.clientHeight
this.area.x = (e.offsetX - this.dragFrom.x) / e.target.clientWidth
this.area.y = (e.offsetY - this.dragFrom.y) / e.target.clientHeight
}
},
startDrag (e) {

@ -162,8 +162,8 @@ export default {
},
onDrop (e) {
this.$emit('drop-field', {
x: e.layerX,
y: e.layerY,
x: e.offsetX,
y: e.offsetY,
maskW: this.$refs.mask.clientWidth,
maskH: this.$refs.mask.clientHeight,
page: this.number
@ -186,10 +186,10 @@ export default {
this.$nextTick(() => {
this.newArea = {
initialX: e.layerX / this.$refs.mask.clientWidth,
initialY: e.layerY / this.$refs.mask.clientHeight,
x: e.layerX / this.$refs.mask.clientWidth,
y: e.layerY / this.$refs.mask.clientHeight,
initialX: e.offsetX / this.$refs.mask.clientWidth,
initialY: e.offsetY / this.$refs.mask.clientHeight,
x: e.offsetX / this.$refs.mask.clientWidth,
y: e.offsetY / this.$refs.mask.clientHeight,
w: 0,
h: 0
}
@ -197,19 +197,19 @@ export default {
},
onPointermove (e) {
if (this.newArea) {
const dx = e.layerX / this.$refs.mask.clientWidth - this.newArea.initialX
const dy = e.layerY / this.$refs.mask.clientHeight - this.newArea.initialY
const dx = e.offsetX / this.$refs.mask.clientWidth - this.newArea.initialX
const dy = e.offsetY / this.$refs.mask.clientHeight - this.newArea.initialY
if (dx > 0) {
this.newArea.x = this.newArea.initialX
} else {
this.newArea.x = e.layerX / this.$refs.mask.clientWidth
this.newArea.x = e.offsetX / this.$refs.mask.clientWidth
}
if (dy > 0) {
this.newArea.y = this.newArea.initialY
} else {
this.newArea.y = e.layerY / this.$refs.mask.clientHeight
this.newArea.y = e.offsetY / this.$refs.mask.clientHeight
}
if (this.drawField?.type === 'cells') {

Loading…
Cancel
Save