Skip to content

Commit

Permalink
fix: nested drawers drag (#439)
Browse files Browse the repository at this point in the history
  • Loading branch information
emilkowalski authored Sep 24, 2024
1 parent ab988a5 commit d0162ed
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,7 @@ export function Root({

function onNestedOpenChange(o: boolean) {
const scale = o ? (window.innerWidth - NESTED_DISPLACEMENT) / window.innerWidth : 1;

const y = o ? -NESTED_DISPLACEMENT : 0;

if (nestedOpenChangeTimer.current) {
Expand Down Expand Up @@ -606,8 +607,7 @@ export function Root({
function onNestedDrag(_event: React.PointerEvent<HTMLDivElement>, percentageDragged: number) {
if (percentageDragged < 0) return;

const initialDim = isVertical(direction) ? window.innerHeight : window.innerWidth;
const initialScale = (initialDim - NESTED_DISPLACEMENT) / initialDim;
const initialScale = (window.innerWidth - NESTED_DISPLACEMENT) / window.innerWidth;
const newScale = initialScale + percentageDragged * (1 - initialScale);
const newTranslate = -NESTED_DISPLACEMENT + percentageDragged * NESTED_DISPLACEMENT;

Expand Down

0 comments on commit d0162ed

Please sign in to comment.