Skip to content

Commit

Permalink
Merge pull request #67 from zhuimengfb/main
Browse files Browse the repository at this point in the history
refactor: remove event dispatch throttle
  • Loading branch information
andycall committed Oct 14, 2022
2 parents 8e92104 + e2c22a9 commit df3351e
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions webf/lib/src/gesture/gesture_dispatcher.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:webf/dom.dart';
import 'package:webf/gesture.dart';
import 'package:webf/src/scheduler/throttle.dart';

const int _MAX_STEP_MS = 16;

class _DragEventInfo extends Drag {
_DragEventInfo(this.gestureDispatcher);
Expand Down Expand Up @@ -101,8 +98,6 @@ class GestureDispatcher {
// Collect the events in the event path list.
final Map<String, bool> _eventsInPath = {};

final Throttling _throttler = Throttling(duration: Duration(milliseconds: _MAX_STEP_MS));

final Map<int, EventTarget> _pointTargets = {};
void _bindEventTargetWithTouchPoint(TouchPoint touchPoint, EventTarget eventTarget) {
_pointTargets[touchPoint.id] = eventTarget;
Expand Down Expand Up @@ -402,13 +397,7 @@ class GestureDispatcher {
e.touches.append(touch);
}

if (eventType == EVENT_TOUCH_MOVE) {
_throttler.throttle(() {
_pointTargets[currentTouchPoint.id]?.dispatchEvent(e);
});
} else {
_pointTargets[currentTouchPoint.id]?.dispatchEvent(e);
}
_pointTargets[currentTouchPoint.id]?.dispatchEvent(e);
}
}
}

0 comments on commit df3351e

Please sign in to comment.