Skip to content

Commit

Permalink
Base resize position on transform when possible
Browse files Browse the repository at this point in the history
  • Loading branch information
DustinBrett committed Jul 14, 2024
1 parent e6b9a83 commit 2ce3264
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion components/system/Window/RndWindow/useRnd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,19 @@ const useRnd = (id: string): Props => {
[id, setPosition, setWindowStates, size]
);
const onResizeStop: RndResizeCallback = useCallback(
(_event, _direction, { style: { height, width } }, _delta, newPositon) => {
(
_event,
_direction,
{ style: { height, width, transform } },
_delta,
resizePosition
) => {
const [, x, y] = transform.match(/translate\((\d+)px, (\d+)px\)/) || [];
const newPositon =
typeof x === "string" && typeof y === "string"
? { x: pxToNum(x), y: pxToNum(y) }
: resizePosition;

enableIframeCapture();

const newSize = { height: pxToNum(height), width: pxToNum(width) };
Expand Down

0 comments on commit 2ce3264

Please sign in to comment.