Skip to content

Commit

Permalink
Merge pull request #1527 from chrisvxd/fix-size-delta-calc
Browse files Browse the repository at this point in the history
  • Loading branch information
clauderic authored Nov 21, 2024
2 parents 7c32663 + 694156d commit 2d207c3
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions packages/dom/src/core/plugins/feedback/Feedback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,20 +153,23 @@ export class Feedback extends Plugin<DragDropManager, FeedbackOptions> {
x: initialCoordinates.x - relativeLeft,
y: initialCoordinates.y - relativeTop,
};

const sizeDelta = {
width:
(initialSize.width / initialFrameTransform.scaleX -
width / frameTransform.scaleX) *
(initialSize.width * initialFrameTransform.scaleX -
width * frameTransform.scaleX) *
transformOrigin.x,
height:
(initialSize.height / initialFrameTransform.scaleY -
height / frameTransform.scaleY) *
(initialSize.height * initialFrameTransform.scaleY -
height * frameTransform.scaleY) *
transformOrigin.y,
};

const delta = {
x: coordinatesDelta.x / frameTransform.scaleX - sizeDelta.width,
y: coordinatesDelta.y / frameTransform.scaleY - sizeDelta.height,
x: coordinatesDelta.x / frameTransform.scaleX + sizeDelta.width,
y: coordinatesDelta.y / frameTransform.scaleY + sizeDelta.height,
};

const projected = {
left: left + delta.x,
top: top + delta.y,
Expand Down

0 comments on commit 2d207c3

Please sign in to comment.