Skip to content
This repository was archived by the owner on Feb 6, 2024. It is now read-only.

Commit a7a59a5

Browse files
Merge pull request #656 from ble/fix-rotation-jump
Fix #655: Calculate center for element correctly
2 parents 267b16d + 9364762 commit a7a59a5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

webcomponents/drag-resize-rotate/src/components/deckdeckgo-drr.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,9 @@ export class DeckdeckgoDragResizeRotate {
214214
}
215215

216216
private initStartPositionsRotation() {
217-
this.centerX = this.el.getBoundingClientRect().left + this.el.offsetWidth / 2;
218-
this.centerY = this.el.getBoundingClientRect().top + this.el.offsetHeight / 2;
217+
let rect = this.el.getBoundingClientRect();
218+
this.centerX = rect.left + rect.width / 2;
219+
this.centerY = rect.top + rect.height / 2;
219220
}
220221

221222
private initStartPositionsResize() {

0 commit comments

Comments
 (0)