Skip to content

Commit

Permalink
fix: initial nested transform (#491)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremiasjutz authored Oct 29, 2024
1 parent ef51e9f commit 5bccd2c
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 @@ -680,15 +680,15 @@ export function Root({
function onNestedOpenChange(o: boolean) {
const scale = o ? (window.innerWidth - NESTED_DISPLACEMENT) / window.innerWidth : 1;

const y = o ? -NESTED_DISPLACEMENT : 0;
const initialTranslate = o ? -NESTED_DISPLACEMENT : 0;

if (nestedOpenChangeTimer.current) {
window.clearTimeout(nestedOpenChangeTimer.current);
}

set(drawerRef.current, {
transition: `transform ${TRANSITIONS.DURATION}s cubic-bezier(${TRANSITIONS.EASE.join(',')})`,
transform: `scale(${scale}) translate3d(0, ${y}px, 0)`,
transform: isVertical(direction) ? `scale(${scale}) translate3d(0, ${initialTranslate}px, 0)` : `scale(${scale}) translate3d(${initialTranslate}, 0, 0)`,
});

if (!o && drawerRef.current) {
Expand Down

0 comments on commit 5bccd2c

Please sign in to comment.