Skip to content
This repository was archived by the owner on Apr 29, 2021. It is now read-only.

Commit a033f08

Browse files
committed
fix conflict between drag & scroll
1 parent 5442801 commit a033f08

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

Runtime/editor/editor_window.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ void _doOnGUI(Event evt) {
404404
-evt.delta.y * this._devicePixelRatio,
405405
evt.mousePosition.x * this._devicePixelRatio,
406406
evt.mousePosition.y * this._devicePixelRatio,
407-
InputUtils.getMouseButtonKey(evt.button)
407+
InputUtils.getScrollButtonKey()
408408
);
409409
}
410410
else if (evt.type == EventType.DragUpdated) {

Runtime/gestures/binding.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ evt is PointerDragFromEditorReleaseEvent
109109

110110
void _handlePointerScrollEvent(PointerEvent evt) {
111111
this.pointerRouter.clearScrollRoute(evt.pointer);
112+
if (!this.pointerRouter.acceptScroll()) {
113+
return;
114+
}
112115

113116
HitTestResult result = new HitTestResult();
114117
this.hitTest(result, evt.position);

Runtime/gestures/pointer_router.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ public void removeRoute(int pointer, PointerRoute route) {
2525
this._routeMap.Remove(pointer);
2626
}
2727
}
28+
29+
public bool acceptScroll() {
30+
return this._routeMap.Count == 0;
31+
}
2832

2933
public void clearScrollRoute(int pointer) {
3034
if (this._routeMap.ContainsKey(pointer)) {

0 commit comments

Comments
 (0)