@@ -36,7 +36,7 @@ const containerWidth = ref(0);
3636const leftPaneWidth = ref (Number (localStorage .getItem (` ${ props .id } .leftPaneWidth` )) || defaultLeftPaneWidth);
3737const rightPaneWidth = ref (Number (localStorage .getItem (` ${ props .id } .rightPaneWidth` )) || defaultRightPaneWidth);
3838
39- let dragging = null ; // 'sidebar ' | 'inspector ' | null
39+ const dragging = ref ( null ) ; // 'leftPane ' | 'rightPane ' | null
4040let containerRect = null ;
4141
4242function clampLeftPane (width , totalInnerWidth ) {
@@ -50,33 +50,35 @@ function clampRightPane(width, totalInnerWidth) {
5050}
5151
5252function onWindowMouseMove (e ) {
53- if (! dragging || ! containerRect) return ;
53+ if (! dragging . value || ! containerRect) return ;
5454 const totalInnerWidth = containerRect .width ; // grid area width
5555 containerWidth .value = totalInnerWidth;
56- if (dragging === ' leftPane' ) {
56+ if (dragging . value === ' leftPane' ) {
5757 const newWidth = clampLeftPane (e .clientX - containerRect .left , totalInnerWidth);
5858 leftPaneWidth .value = Math .round (newWidth);
5959 localStorage .setItem (` ${ props .id } .leftPaneWidth` , String (leftPaneWidth .value ));
60- } else if (dragging === ' rightPane' ) {
60+ } else if (dragging . value === ' rightPane' ) {
6161 const newWidth = clampRightPane (containerRect .right - e .clientX - 4 , totalInnerWidth);
6262 rightPaneWidth .value = Math .round (newWidth);
6363 localStorage .setItem (` ${ props .id } .rightPaneWidth` , String (rightPaneWidth .value ));
6464 }
65- updateCenterHidden (dragging === ' rightPane' );
65+ updateCenterHidden (dragging . value === ' rightPane' );
6666 // Notify canvas to resize while dragging
6767 window .dispatchEvent (new Event (' resize' ));
6868}
6969
7070function onWindowMouseUp () {
71- if (dragging) {
72- dragging = null ;
71+ if (dragging . value ) {
72+ dragging . value = null ;
7373 containerRect = null ;
74+ document .body .style .cursor = ' ' ;
7475 }
7576}
7677
7778function startDragging (which ) {
78- dragging = which;
79+ dragging . value = which;
7980 containerRect = rootEl .value .getBoundingClientRect ();
81+ document .body .style .cursor = ' col-resize' ;
8082}
8183
8284// Attach listeners on mount, remove on unmount
@@ -175,7 +177,7 @@ const gridStyle = computed(() => {
175177 }
176178});
177179
178- defineExpose ({startDragging, centerPaneHidden});
180+ defineExpose ({startDragging, centerPaneHidden, dragging });
179181
180182 </script >
181183
0 commit comments