@@ -93,25 +93,33 @@ export function App() {
9393
9494 function handleDividerDown ( e : MouseEvent ) {
9595 e . preventDefault ( ) ;
96- setDraggingDivider ( true ) ;
96+ if ( ! bodyRef ) return ;
97+
98+ // Cache rect once at start — no layout thrashing during drag
99+ const rect = bodyRef . getBoundingClientRect ( ) ;
100+ const vert = isVertical ( ) ;
101+
102+ // Add dragging class directly on DOM — no SolidJS reactivity
103+ bodyRef . classList . add ( "dragging" ) ;
104+ document . body . style . cursor = vert ? "row-resize" : "col-resize" ;
105+ document . body . style . userSelect = "none" ;
106+
97107 const onMove = ( ev : MouseEvent ) => {
98- if ( ! bodyRef ) return ;
99- const rect = bodyRef . getBoundingClientRect ( ) ;
100108 let pct : number ;
101- if ( isVertical ( ) ) {
109+ if ( vert ) {
102110 pct = ( ( ev . clientY - rect . top ) / rect . height ) * 100 ;
103111 } else {
104112 pct = ( ( ev . clientX - rect . left ) / rect . width ) * 100 ;
105113 }
106114 pct = Math . min ( Math . max ( pct , 25 ) , 80 ) ;
107- // Set CSS custom property directly — bypasses SolidJS reactivity for smooth drag
108- bodyRef . style . setProperty ( "--chat-pct" , `${ pct } %` ) ;
109- bodyRef . style . setProperty ( "--side-pct" , `${ 100 - pct } %` ) ;
115+ bodyRef ! . style . setProperty ( "--chat-pct" , `${ pct } %` ) ;
116+ bodyRef ! . style . setProperty ( "--side-pct" , `${ 100 - pct } %` ) ;
110117 chatPercentRef = pct ;
111118 } ;
112119 const onUp = ( ) => {
113- setDraggingDivider ( false ) ;
114- // Sync back to signal for persistence
120+ bodyRef ?. classList . remove ( "dragging" ) ;
121+ document . body . style . cursor = "" ;
122+ document . body . style . userSelect = "" ;
115123 setChatPercent ( chatPercentRef ) ;
116124 window . removeEventListener ( "mousemove" , onMove ) ;
117125 window . removeEventListener ( "mouseup" , onUp ) ;
@@ -193,7 +201,7 @@ export function App() {
193201 class = "main-panel-body"
194202 classList = { {
195203 vertical : isVertical ( ) ,
196- dragging : draggingDivider ( ) ,
204+ /* dragging class added/removed via DOM directly for performance */
197205 } }
198206 >
199207 < div class = "main-panel-chat" style = { hasSidePane ( ) ? chatStyle ( ) : { flex : "1" } } >
0 commit comments