@@ -56,6 +56,7 @@ import {
5656 dragAfterIntent ,
5757 keepTouchRefusable ,
5858 markDragSource ,
59+ standDownFromPress ,
5960} from "./drag_after_intent.js" ;
6061import { initDragConstraints } from "./drag_constraint.js" ;
6162import { createDragElementPositioner } from "./drag_element_positioner.js" ;
@@ -67,7 +68,7 @@ import {
6768 getDropTargetInfo ,
6869 rectangleAreIntersecting ,
6970} from "./drop_target_detection.js" ;
70- import { standDownFromPanZoomSurface } from "./pan_zoom.js" ;
71+ import { findPanZoomSurface } from "./pan_zoom.js" ;
7172import { applyStickyFrontiersToAutoScrollArea } from "./sticky_frontiers.js" ;
7273
7374const dragStyleController = createStyleController ( "drag_to_move" ) ;
@@ -921,16 +922,21 @@ export const startDragTo = (
921922 * says nothing reads as a screen that is broken, and the hand pulls harder; the
922923 * refusal has to be told where the grab would have been felt.
923924 *
924- * WHO KEEPS THE PRESS: whoever else it was for. Nothing is carried here, so no
925- * axis is walked and nothing is disputed — the press is kept only because, over
926- * a list or a page, nobody else wanted it (and the click it leaves behind has to
927- * be swallowed, something pulled and told to stay put must not also be clicked).
928- * Over a surface that pans, somebody does: "I cannot be carried" and "I want to
929- * look around" are two sentences, and the second is the one the hand says nine
930- * times out of ten — a thing that cannot be taken hold of is exactly the one a
931- * finger rests on without thinking. So the surface keeps the press, whole (see
932- * standDownFromPanZoomSurface), and the refusal is only told: no pointer taken,
933- * no click swallowed, nothing prevented.
925+ * WHAT IT GIVES UP, ALWAYS: the axes. Nothing is carried, so nothing is walked,
926+ * and everything that reads what a drag source walks to know what is left for
927+ * itself steps over this one (see standDownFromPress) — a swipe that starts on a
928+ * locked row is the swipe of the box it stands in, a drag that starts on a
929+ * pinned object pans the surface under it. A locked thing must not be a hole in
930+ * what holds it.
931+ *
932+ * WHAT IT KEEPS: the press, unless a surface that pans was after it. Over a list
933+ * or a page nobody else was, so the press is settled here like any gesture
934+ * settles one — the pointer is taken (a `longpress` on the same finger must not
935+ * answer afterwards), and the click the release leaves behind is swallowed:
936+ * something pulled and told to stay put must not also be clicked. A surface is
937+ * the one thing that takes it whole and in every direction, so there it is the
938+ * surface's and the refusal takes nothing at all: no pointer, no click, nothing
939+ * prevented.
934940 *
935941 * @param {PointerEvent } event The `pointerdown` that would have become a drag.
936942 * @param {object } [options]
@@ -953,14 +959,21 @@ export const refuseDragTo = (
953959 if ( ! isPrimaryButtonEvent ( event ) ) {
954960 return ;
955961 }
956- const stoodDown = standDownFromPanZoomSurface ( event , draggedElement ) ;
957- if ( ! stoodDown ) {
962+ // Nothing will be carried, so no axis is walked: whatever reads a drag
963+ // source's axes to know what is left for itself must find none here.
964+ standDownFromPress ( event , draggedElement ) ;
965+ // And over a surface that pans, the press was never this element's to keep:
966+ // "this one cannot be carried" and "I want to look around" are two sentences,
967+ // and the hand says the second nine times out of ten — a thing that cannot be
968+ // taken hold of is exactly the one a finger rests on without thinking.
969+ const surfaceKeepsThePress = Boolean ( findPanZoomSurface ( draggedElement ) ) ;
970+ if ( ! surfaceKeepsThePress ) {
958971 event . preventDefault ( ) ;
959972 }
960973 dragAfterIntent (
961974 event ,
962975 ( ) => {
963- if ( stoodDown ) {
976+ if ( surfaceKeepsThePress ) {
964977 // The surface is holding the hand: taking the pointer or the click from
965978 // it would be taking the gesture it is answering. The word is all that
966979 // is owed.
0 commit comments