@@ -244,7 +244,9 @@ export default class Dock extends Component {
244
244
} ;
245
245
246
246
componentDidMount ( ) {
247
+ window . addEventListener ( 'touchend' , this . handleMouseUp ) ;
247
248
window . addEventListener ( 'mouseup' , this . handleMouseUp ) ;
249
+ window . addEventListener ( 'touchmove' , this . handleMouseMove ) ;
248
250
window . addEventListener ( 'mousemove' , this . handleMouseMove ) ;
249
251
window . addEventListener ( 'resize' , this . handleResize ) ;
250
252
@@ -254,7 +256,9 @@ export default class Dock extends Component {
254
256
}
255
257
256
258
componentWillUnmount ( ) {
259
+ window . removeEventListener ( 'touchend' , this . handleMouseUp ) ;
257
260
window . removeEventListener ( 'mouseup' , this . handleMouseUp ) ;
261
+ window . removeEventListener ( 'touchmove' , this . handleMouseMove ) ;
258
262
window . removeEventListener ( 'mousemove' , this . handleMouseMove ) ;
259
263
window . removeEventListener ( 'resize' , this . handleResize ) ;
260
264
}
@@ -329,7 +333,11 @@ export default class Dock extends Component {
329
333
< div style = { dimStyles } onClick = { this . handleDimClick } />
330
334
) }
331
335
< div style = { dockStyles } >
332
- < div style = { resizerStyles } onMouseDown = { this . handleMouseDown } />
336
+ < div
337
+ style = { resizerStyles }
338
+ onMouseDown = { this . handleMouseDown }
339
+ onTouchStart = { this . handleMouseDown }
340
+ />
333
341
< div style = { styles . dockContent } >
334
342
{ typeof children === 'function'
335
343
? children ( {
@@ -401,11 +409,18 @@ export default class Dock extends Component {
401
409
402
410
handleMouseMove = ( e ) => {
403
411
if ( ! this . state . isResizing || this . state . isWindowResizing ) return ;
404
- e . preventDefault ( ) ;
412
+
413
+ if ( ! e . touches ) e . preventDefault ( ) ;
405
414
406
415
const { position, fluid } = this . props ;
407
416
const { fullWidth, fullHeight, isControlled } = this . state ;
408
- const { clientX : x , clientY : y } = e ;
417
+ let { clientX : x , clientY : y } = e ;
418
+
419
+ if ( e . touches ) {
420
+ x = e . touches [ 0 ] . clientX ;
421
+ y = e . touches [ 0 ] . clientY ;
422
+ }
423
+
409
424
let size ;
410
425
411
426
switch ( position ) {
0 commit comments