@@ -74,14 +74,6 @@ export default function DialogSurface({
7474 return visible && ! dragging ? x : x - 12 ;
7575 } , [ offset . x , dragging , visible , rndPosition . x , rndWidth , editingWidthPercent ] ) ;
7676
77- const alignedTop = useMemo ( ( ) => offset . y + rndPosition . y , [
78- offset . y ,
79- rndPosition . y ,
80- ] ) ;
81- const alignedBottom = useMemo (
82- ( ) => offset . y + rndPosition . y - bounds . height + rndHeight ,
83- [ offset . y , rndPosition . y , bounds . height , rndHeight ]
84- ) ;
8577 const alignedCenter = useMemo (
8678 ( ) => offset . y + rndPosition . y - 0.5 * ( bounds . height - rndHeight ) ,
8779 [ offset . y , rndPosition . y , bounds . height , rndHeight ]
@@ -92,10 +84,10 @@ export default function DialogSurface({
9284 document . documentElement . clientHeight || 0 ,
9385 window . innerHeight || 0
9486 ) ;
95- if ( alignedCenter < 0 ) return alignedTop ;
96- if ( alignedCenter + bounds . height > vh ) return alignedBottom ;
87+ if ( alignedCenter < 0 ) return PREVIEW_MARGIN ;
88+ if ( alignedCenter + bounds . height > vh ) return vh - bounds . height - PREVIEW_MARGIN ;
9789 return alignedCenter ;
98- } , [ alignedTop , alignedCenter , alignedBottom , bounds . height ] ) ;
90+ } , [ alignedCenter , bounds . height ] ) ;
9991
10092 const props = useSpring ( {
10193 onRest : ( ) => ( ! visible && measured . current ? setDialog ( false ) : undefined ) ,
0 commit comments