Skip to content

Commit

Permalink
fix: apply offset to displayBounds while editing
Browse files Browse the repository at this point in the history
  • Loading branch information
fidelthomet committed Oct 14, 2024
1 parent dd22eb9 commit 54b6c8f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/components/TheGraph.vue
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ const cssProps = computed(() => {
const displayBounds = computed(() => {
if ((displayStore.exactMarker?.bounds == null && displayBoundsTemp.value) == null) return
const { x1, y1, x2, y2 } = displayBoundsTemp.value || displayStore.exactMarker.bounds
return `M${x1},${y1} L${x2},${y1} L${x2},${y2} L${x1},${y2} Z`
return `M${x1 + layoutStore.offset.x},${y1 + layoutStore.offset.y} L${x2 + layoutStore.offset.x},${y1 + layoutStore.offset.y} L${x2 + layoutStore.offset.x},${y2 + layoutStore.offset.y} L${x1 + layoutStore.offset.x},${y2 + layoutStore.offset.y} Z`
})
watch([id, () => dataStore.data], ([value], [oldValue]) => {
Expand Down Expand Up @@ -299,10 +299,10 @@ function onMouseDown(e) {
e.stopPropagation()
const coords = screenToCoordinates(e)
displayBoundsTemp.value = {
x1: coords.x,
y1: coords.y,
x2: coords.x,
y2: coords.y
x1: coords.x - layoutStore.offset.x,
y1: coords.y - layoutStore.offset.y,
x2: coords.x - layoutStore.offset.x,
y2: coords.y - layoutStore.offset.y
}
const controller = new AbortController()
Expand All @@ -326,8 +326,8 @@ function onMouseDown(e) {
'mousemove',
(e) => {
const { x, y } = screenToCoordinates(e)
displayBoundsTemp.value.x2 = x
displayBoundsTemp.value.y2 = y
displayBoundsTemp.value.x2 = x - layoutStore.offset.x
displayBoundsTemp.value.y2 = y - layoutStore.offset.y
},
{ signal: controller.signal }
)
Expand Down

0 comments on commit 54b6c8f

Please sign in to comment.