fix ios pressure helper and android click handler

This commit is contained in:
xmcp
2019-05-24 14:41:17 +08:00
parent 978d688f3f
commit dc8cf97384
5 changed files with 17 additions and 30 deletions

View File

@@ -155,6 +155,7 @@ export class ClickHandler extends PureComponent {
this.on_end_bound=this.on_end.bind(this);
this.MOVE_THRESHOLD=3;
this.last_fire=0;
}
on_begin(e) {
@@ -178,12 +179,18 @@ export class ClickHandler extends PureComponent {
on_end(event) {
//console.log('end');
if(!this.state.moved)
this.props.callback(event);
this.do_callback(event);
this.setState({
moved: true,
});
}
do_callback(event) {
if(this.last_fire+100>+new Date()) return;
this.last_fire=+new Date();
this.props.callback(event);
}
render() {
return (
<div onTouchStart={this.on_begin_bound} onMouseDown={this.on_begin_bound}