@@ -119,56 +119,97 @@ export function useSpace(props: ISpaceProps) {
119119}
120120
121121interface IResizeHandleProps {
122+ id ?: string ;
122123 key : string | number ;
123124 style : CSSProperties ;
124- className : string ;
125+ className ? : string ;
125126 onMouseDown : ( e : React . MouseEvent < HTMLElement , MouseEvent > ) => void ;
126127 onTouchStart : ( e : React . TouchEvent < HTMLElement > ) => void ;
127128}
128129
129130export function useSpaceResizeHandles ( store : ISpaceStore , space : ISpaceDefinition , position : IPositionalProps | undefined , handleSize ?: number ) {
130- const resizeHandles : IResizeHandleProps [ ] = [ ] ;
131- const resizeHandleSize = coalesce ( handleSize , 5 ) ;
131+ const mouseHandles : IResizeHandleProps [ ] = [ ] ;
132+ const touchHandles : IResizeHandleProps [ ] = [ ] ;
133+ const resizeHandleSize = coalesce ( handleSize , 2 ) ;
132134
133135 if ( position && position . rightResizable ) {
134- resizeHandles . push ( {
136+ mouseHandles . push ( {
137+ id : `${ space . id } -m` ,
135138 key : "right" ,
136139 style : { width : resizeHandleSize } ,
137140 className : `spaces-resize-handle resize-right` ,
138141 onMouseDown : ( event ) => store . startMouseResize ( ResizeType . Right , space , space . width , event ) ,
139142 onTouchStart : ( event ) => store . startTouchResize ( ResizeType . Right , space , space . width , event ) ,
140143 } ) ;
144+ touchHandles . push ( {
145+ id : `${ space . id } -t` ,
146+ key : "right" ,
147+ style : { width : 30 } ,
148+ className : `spaces-touch-handle resize-right` ,
149+ onMouseDown : ( event ) => event . preventDefault ( ) ,
150+ onTouchStart : ( event ) => store . startTouchResize ( ResizeType . Right , space , space . width , event ) ,
151+ } ) ;
141152 }
142153
143154 if ( position && position . leftResizable ) {
144- resizeHandles . push ( {
155+ mouseHandles . push ( {
156+ id : `${ space . id } -m` ,
145157 key : "left" ,
146158 style : { width : resizeHandleSize } ,
147159 className : `spaces-resize-handle resize-left` ,
148160 onMouseDown : ( event ) => store . startMouseResize ( ResizeType . Left , space , space . width , event ) ,
149161 onTouchStart : ( event ) => store . startTouchResize ( ResizeType . Left , space , space . width , event ) ,
150162 } ) ;
163+ touchHandles . push ( {
164+ id : `${ space . id } -t` ,
165+ key : "left" ,
166+ style : { width : 30 } ,
167+ className : `spaces-touch-handle resize-left` ,
168+ onMouseDown : ( event ) => event . preventDefault ( ) ,
169+ onTouchStart : ( event ) => store . startTouchResize ( ResizeType . Left , space , space . width , event ) ,
170+ } ) ;
151171 }
152172
153173 if ( position && position . topResizable ) {
154- resizeHandles . push ( {
174+ mouseHandles . push ( {
175+ id : `${ space . id } -m` ,
155176 key : "top" ,
156177 style : { height : resizeHandleSize } ,
157178 className : `spaces-resize-handle resize-top` ,
158179 onMouseDown : ( event ) => store . startMouseResize ( ResizeType . Top , space , space . height , event ) ,
159180 onTouchStart : ( event ) => store . startTouchResize ( ResizeType . Top , space , space . height , event ) ,
160181 } ) ;
182+ touchHandles . push ( {
183+ id : `${ space . id } -t` ,
184+ key : "top" ,
185+ style : { height : 30 } ,
186+ className : `spaces-touch-handle resize-top` ,
187+ onMouseDown : ( event ) => event . preventDefault ( ) ,
188+ onTouchStart : ( event ) => store . startTouchResize ( ResizeType . Top , space , space . height , event ) ,
189+ } ) ;
161190 }
162191
163192 if ( position && position . bottomResizable ) {
164- resizeHandles . push ( {
193+ mouseHandles . push ( {
194+ id : `${ space . id } -m` ,
165195 key : "bottom" ,
166- style : { height : resizeHandleSize } ,
167196 className : `spaces-resize-handle resize-bottom` ,
197+ style : { height : resizeHandleSize } ,
168198 onMouseDown : ( event ) => store . startMouseResize ( ResizeType . Bottom , space , space . height , event ) ,
169199 onTouchStart : ( event ) => store . startTouchResize ( ResizeType . Bottom , space , space . height , event ) ,
170200 } ) ;
201+ touchHandles . push ( {
202+ id : `${ space . id } -t` ,
203+ key : "bottom" ,
204+ style : { height : 30 } ,
205+ className : `spaces-touch-handle resize-bottom` ,
206+ onMouseDown : ( event ) => event . preventDefault ( ) ,
207+ onTouchStart : ( event ) => store . startTouchResize ( ResizeType . Bottom , space , space . height , event ) ,
208+ } ) ;
171209 }
172210
173- return resizeHandles ;
211+ return {
212+ mouseHandles,
213+ touchHandles,
214+ } ;
174215}
0 commit comments