Skip to content

Commit e0b91d5

Browse files
authored
fix: resizing along the edge should affect only one axis (#37)
1 parent 2f10dc8 commit e0b91d5

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/components/grid-item.vue

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,16 @@ function handleResize(event: MouseEvent) {
487487
break
488488
}
489489
case 'resizemove': {
490+
// A vertical resize ignores the horizontal delta
491+
if (!event.edges.right && !event.edges.left) {
492+
lastW = x
493+
}
494+
495+
// An horizontal resize ignores the vertical delta
496+
if (!event.edges.top && !event.edges.bottom) {
497+
lastH = y
498+
}
499+
490500
const coreEvent = createCoreData(lastW, lastH, x, y)
491501
if (renderRtl.value) {
492502
newSize.width = state.resizing.width - coreEvent.deltaX / state.transformScale

0 commit comments

Comments
 (0)