From de20528938cc3fd5edf41c62cb8c97d30c6999d8 Mon Sep 17 00:00:00 2001 From: Dave Workman <davidworkman9@gmail.com> Date: Wed, 07 Feb 2018 06:17:25 +0100 Subject: [PATCH] added touch support. --- src/TimeView.js | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/TimeView.js b/src/TimeView.js index 5c226bb..3e03740 100644 --- a/src/TimeView.js +++ b/src/TimeView.js @@ -59,9 +59,9 @@ } } return React.createElement('div', { key: type, className: 'rdtCounter' }, [ - React.createElement('span', { key: 'up', className: 'rdtBtn', onMouseDown: this.onStartClicking( 'increase', type ), onContextMenu: this.disableContextMenu }, '���' ), + React.createElement('span', { key: 'up', className: 'rdtBtn', onTouchStart: this.onStartClicking('increase', type), onMouseDown: this.onStartClicking( 'increase', type ), onContextMenu: this.disableContextMenu }, '���' ), React.createElement('div', { key: 'c', className: 'rdtCount' }, value ), - React.createElement('span', { key: 'do', className: 'rdtBtn', onMouseDown: this.onStartClicking( 'decrease', type ), onContextMenu: this.disableContextMenu }, '���' ) + React.createElement('span', { key: 'do', className: 'rdtBtn', onTouchStart: this.onStartClicking('decrease', type), onMouseDown: this.onStartClicking( 'decrease', type ), onContextMenu: this.disableContextMenu }, '���' ) ]); } return ''; @@ -69,9 +69,9 @@ renderDayPart: function() { return React.createElement('div', { key: 'dayPart', className: 'rdtCounter' }, [ - React.createElement('span', { key: 'up', className: 'rdtBtn', onMouseDown: this.onStartClicking( 'toggleDayPart', 'hours'), onContextMenu: this.disableContextMenu }, '���' ), + React.createElement('span', { key: 'up', className: 'rdtBtn', onTouchStart: this.onStartClicking('toggleDayPart', 'hours'), onMouseDown: this.onStartClicking( 'toggleDayPart', 'hours'), onContextMenu: this.disableContextMenu }, '���' ), React.createElement('div', { key: this.state.daypart, className: 'rdtCount' }, this.state.daypart ), - React.createElement('span', { key: 'do', className: 'rdtBtn', onMouseDown: this.onStartClicking( 'toggleDayPart', 'hours'), onContextMenu: this.disableContextMenu }, '���' ) + React.createElement('span', { key: 'do', className: 'rdtBtn', onTouchStart: this.onStartClicking('toggleDayPart', 'hours'), onMouseDown: this.onStartClicking( 'toggleDayPart', 'hours'), onContextMenu: this.disableContextMenu }, '���' ) ]); }, @@ -181,9 +181,11 @@ clearInterval( me.increaseTimer ); me.props.setTime( type, me.state[ type ] ); document.body.removeEventListener( 'mouseup', me.mouseUpListener ); + document.body.removeEventListener( 'touchend', me.mouseUpListener ); }; document.body.addEventListener( 'mouseup', me.mouseUpListener ); + document.body.addEventListener( 'touchend', me.mouseUpListener ); }; }, -- Gitblit v1.9.3