@@ -32,7 +32,9 @@ BottomResizable.propTypes = {...publicProps, ...anchoredProps, ...resizableProps
3232export const RightResizable : React . FC < IPublicProps & IAnchoredProps & IResizableProps > = ( props ) => < SpaceInternal { ...props } anchor = { AnchorType . Right } anchorSize = { props . size } resizable = { true } />
3333RightResizable . propTypes = { ...publicProps , ...anchoredProps , ...resizableProps } ;
3434export const Positioned : React . FC < IPublicProps & IResizableProps & IPositionedProps > = ( props ) => < SpaceInternal { ...props } />
35- RightResizable . propTypes = { ...publicProps , ...resizableProps , ...positionedProps } ;
35+ Positioned . propTypes = { ...publicProps , ...resizableProps , ...positionedProps } ;
36+ export const Custom : React . FC < AllProps > = ( props ) => < SpaceInternal { ...props } />
37+ Custom . propTypes = allProps ;
3638
3739export const SpaceInternal : React . FC < AllProps > = React . memo ( ( props ) => {
3840
@@ -42,7 +44,8 @@ export const SpaceInternal : React.FC<AllProps> = React.memo((props) => {
4244 space,
4345 parentContext,
4446 currentContext,
45- currentSize
47+ currentSize,
48+ resizing
4649 } = useSpace ( props , divElementRef ) ;
4750
4851 const handleSize = props . handleSize === undefined ? 5 : props . handleSize ;
@@ -95,6 +98,15 @@ export const SpaceInternal : React.FC<AllProps> = React.memo((props) => {
9598 if ( ! divElementRef . current ) {
9699 return ;
97100 }
101+
102+ if ( props . onResizeStart ) {
103+ const result = props . onResizeStart ( ) ;
104+ if ( typeof result === "boolean" && ! result ) {
105+ return ;
106+ }
107+ }
108+
109+ parentContext . updateResizing ( true ) ;
98110
99111 var rect = divElementRef . current . getBoundingClientRect ( ) ;
100112 var size = isHorizontalSpace ( props . anchor ) ? rect . width : rect . height ;
@@ -115,27 +127,36 @@ export const SpaceInternal : React.FC<AllProps> = React.memo((props) => {
115127 lastY = e . touches [ 0 ] . pageY ;
116128 e . preventDefault ( ) ;
117129 e . stopImmediatePropagation ( ) ;
118- throttledTouchResize ( lastX , lastY ) ;
130+ throttledTouchResize ( lastX , lastY ) ;
119131 } ;
120132 const removeListener = ( ) => {
121133 if ( moved ) {
122134 touchResize ( lastX , lastY ) ;
123135 }
124136 window . removeEventListener ( 'touchmove' , withPreventDefault ) ;
125137 window . removeEventListener ( 'touchend' , removeListener ) ;
138+ parentContext . updateResizing ( false ) ;
126139 onResizeEnd ( ) ;
127140 } ;
128141 window . addEventListener ( 'touchmove' , withPreventDefault ) ;
129142 window . addEventListener ( 'touchend' , removeListener ) ;
130143 e . preventDefault ( ) ;
131144 e . stopPropagation ( ) ;
132- props . onResizeStart && props . onResizeStart ( ) ;
133145 } ;
134146
135147 const startResize = ( e : React . MouseEvent < HTMLDivElement , MouseEvent > ) => {
136148 if ( ! divElementRef . current ) {
137149 return ;
138150 }
151+
152+ if ( props . onResizeStart ) {
153+ const result = props . onResizeStart ( ) ;
154+ if ( typeof result === "boolean" && ! result ) {
155+ return ;
156+ }
157+ }
158+
159+ parentContext . updateResizing ( true ) ;
139160
140161 var rect = divElementRef . current . getBoundingClientRect ( ) ;
141162 var size = isHorizontalSpace ( props . anchor ) ? rect . width : rect . height ;
@@ -164,13 +185,13 @@ export const SpaceInternal : React.FC<AllProps> = React.memo((props) => {
164185 }
165186 window . removeEventListener ( 'mousemove' , withPreventDefault ) ;
166187 window . removeEventListener ( 'mouseup' , removeListener ) ;
188+ parentContext . updateResizing ( false ) ;
167189 onResizeEnd ( ) ;
168190 } ;
169191 window . addEventListener ( 'mousemove' , withPreventDefault ) ;
170192 window . addEventListener ( 'mouseup' , removeListener ) ;
171193 e . preventDefault ( ) ;
172194 e . stopPropagation ( ) ;
173- props . onResizeStart && props . onResizeStart ( ) ;
174195 } ;
175196
176197 resizeHandle =
@@ -213,7 +234,8 @@ export const SpaceInternal : React.FC<AllProps> = React.memo((props) => {
213234 [
214235 ...[
215236 "spaces-space" ,
216- props . scrollable ? ( resizeHandle ? "scrollable" : "scrollable-a" ) : undefined
237+ props . scrollable ? ( resizeHandle ? "scrollable" : "scrollable-a" ) : undefined ,
238+ resizing ? "spaces-resizing" : undefined
217239 ] ,
218240 ...( resizeHandle && props . scrollable ? userClasses . map ( c => `${ c } -container` ) : userClasses )
219241 ] . filter ( c => c ) ;
0 commit comments