Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/web/tools/GestureHandlerOrchestrator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,6 @@ export default class GestureHandlerOrchestrator {
}

if (handler.awaiting || handler.state === State.ACTIVE) {
// For now it always returns false
return handler.shouldBeCancelledByOther(otherHandler);
}

Expand Down
10 changes: 9 additions & 1 deletion src/web/tools/InteractionManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export default class InteractionManager {
}

public shouldHandlerBeCancelledBy(
_handler: IGestureHandler,
handler: IGestureHandler,
otherHandler: IGestureHandler
): boolean {
// We check constructor name instead of using `instanceof` in order do avoid circular dependencies
Expand All @@ -111,6 +111,14 @@ export default class InteractionManager {
const isActive = otherHandler.state === State.ACTIVE;
const isButton = otherHandler.isButton?.() === true;

if (
this.blocksHandlersRelations
.get(handler.handlerTag)
?.includes(otherHandler.handlerTag)
) {
return false;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this allow for the situation where both of the gestures are active?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, depends how do you understand active. If by having state set to 4 then yes, it is possible due to current Gesture Handler implementation.

But looking at the example code, NativeViewGestureHandler won't send event in active state since tryActivate for this handler will be called only once and it will be marked as awaitingHandler

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to do the reverse? I.e. when a handler tries to activate, check if there's already an active one that is blocking the current one. If so, cancel/fail instead of activating.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I recall correctly there were some complications with this approach, but I'll double-check that


return isNativeHandler && isActive && !isButton;
}

Expand Down
Loading