You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// During selection, use an I-beam regardless of the content beneath the cursor.// If a drag may be starting or we're capturing mouse events for a particular node, don't treat this as a selection.if (m_mousePressed
&& mouseDownMayStartSelect()
#if ENABLE(DRAG_SUPPORT)
&& !m_mouseDownMayStartDrag
#endif
&& m_frame.selection().isCaretOrRange()
&& !m_capturingMouseEventsElement)
return iBeam;
According to the safari(webkit) source code, we need to call setPointerCapture to update m_capturingMouseEventsElement.
The new web implementation already does this in PointerEventManager.ts.
I'm just not sure when the new web implementation will officially replace web_hammer.
If it still takes a long time, could we also add setPointerCapture in the web_hammer?
Changes may be like this:
diff --git a/src/web_hammer/GestureHandler.ts b/src/web_hammer/GestureHandler.ts
index 75632ab8..b8701e00 100644
--- a/src/web_hammer/GestureHandler.ts+++ b/src/web_hammer/GestureHandler.ts@@ -258,10 +258,17 @@ abstract class GestureHandler {
this.onGestureEnded(event);
}
- onRawEvent({ isFirst }: HammerInputExt) {+ onRawEvent({ isFirst, srcEvent }: HammerInputExt) {
if (isFirst) {
this.hasGestureFailed = false;
}
+ const { type } = srcEvent;+ const target = srcEvent.target as HTMLElement;+ if (type === 'pointerdown') {+ target.setPointerCapture((srcEvent as PointerEvent).pointerId)+ } else if (type === 'pointerup') {+ target.releasePointerCapture((srcEvent as PointerEvent).pointerId);+ }
}
or
diff --git a/src/web_hammer/GestureHandler.ts b/src/web_hammer/GestureHandler.ts
index 75632ab8..9491f249 100644
--- a/src/web_hammer/GestureHandler.ts+++ b/src/web_hammer/GestureHandler.ts@@ -346,6 +346,13 @@ abstract class GestureHandler {
this.hammer!.on(this.name, (ev: HammerInput) =>
this.onGestureActivated(ev as unknown as HammerInputExt)
); // TODO(TS) remove cast after https://github.com/DefinitelyTyped/DefinitelyTyped/pull/50438 is merged
+ const element = this.view as any;+ element.addEventListener('pointerdown', (e: PointerEvent) => {+ element.setPointerCapture(e.pointerId);+ });+ element.addEventListener('pointerup', (e: PointerEvent) => {+ element.releasePointerCapture(e.pointerId);+ });
}
onStart({ deltaX, deltaY, rotation }: HammerInputExt) {
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
https://snack.expo.dev/@ntdiary/safari-cursor-i-beam
i-beam.mp4
According to the safari(webkit) source code, we need to call
setPointerCapture
to updatem_capturingMouseEventsElement
.The new web implementation already does this in
PointerEventManager.ts
.I'm just not sure when the new web implementation will officially replace
web_hammer
.If it still takes a long time, could we also add
setPointerCapture
in theweb_hammer
?Changes may be like this:
or
Beta Was this translation helpful? Give feedback.
All reactions