Skip to content

Commit

Permalink
Merge pull request #277 from alexandercerutti/main
Browse files Browse the repository at this point in the history
fix: fix frame resizable computed size on devices with different devicePixelRatio
  • Loading branch information
riccardoperra authored Jun 10, 2022
2 parents 91b4086 + 9903fb6 commit d09a0c0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/happy-dodos-matter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@codeimage/app": patch
---

fix: fix resize issue on Mac with different devicePixelRatio
7 changes: 3 additions & 4 deletions apps/codeimage/src/core/hooks/resizable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,9 @@ export function createHorizontalResize(
const max = maxWidth();
const isLTR = state.startX > middle;

const computedWidth =
(isLTR
? state.startWidth + x - state.startX
: state.startWidth - x + state.startX) * window.devicePixelRatio;
const computedWidth = isLTR
? state.startWidth + x - state.startX
: state.startWidth - x + state.startX;

setState({width: clamp(computedWidth, min, max)});
};
Expand Down

0 comments on commit d09a0c0

Please sign in to comment.