Skip to content

Commit

Permalink
fix(cdk:resizable): position should be set at start of resizing (#1889)
Browse files Browse the repository at this point in the history
  • Loading branch information
sallerli1 committed Apr 12, 2024
1 parent 62b606a commit aaf85b6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/cdk/resize/src/resizable/useResizable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,12 @@ export function useResizable(

const handleResizeStart = (placement: ResizableHandlePlacement, evt: PointerEvent) => {
activePlacement.value = placement
resizing.value = true
const { width, height, left, top } = convertElement(target)!.getBoundingClientRect()
const { clientX, clientY } = evt
startPosition.value = { width, height, left, top, clientX, clientY }
const position = { width, height, offsetWidth: 0, offsetHeight: 0 }
currPosition.value = position
callEmit(options.onResizeStart, position, evt)
}

Expand All @@ -138,7 +140,6 @@ export function useResizable(
return
}
setBodyCursor(currPlacement)
resizing.value = true

const { width: currWidth, height: currHeight } = calcSizeByEvent(currPlacement, evt)
const { width: newWidth, height: newHeight } = calcSizeByBounds(currPlacement, currWidth, currHeight, -1)
Expand Down

0 comments on commit aaf85b6

Please sign in to comment.