@yuneta/gobj-ui 7.23.8 → 7.23.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -830,6 +830,59 @@ so it survived that — two light islands over a dark canvas.
830
830
  (all tooltips, so a host that has not defined them shows the key on hover and
831
831
  nothing else breaks).
832
832
 
833
+ ### The graphs on a touch screen
834
+
835
+ The three G6 graphs (`C_G6_NODES_TREE` under the treedb view,
836
+ `C_YUI_JSON_GRAPH`, `C_YUI_GOBJ_TREE_JS`) have always DRAWN correctly on a
837
+ phone. What they could not be was **operated** on one, for reasons that were
838
+ structural rather than cosmetic — and none of them is visible in the CSS:
839
+
840
+ - **There is no wheel on a phone**, and `zoom-canvas` binds the wheel and
841
+ nothing else, so the only zoom was the toolbar's `+`/`−`. G6 ships a pinch
842
+ recogniser, but `trigger: ['pinch']` REPLACES the wheel (its `bindEvents` is
843
+ an `if/else`), and its `PinchHandler` keeps its instance and callbacks in
844
+ **statics** — with two graphs on a page the second registers against the
845
+ first one's emitter, so pinching one zooms both and pinching the other does
846
+ nothing. `g6_touch_gestures.js` recognises the gesture per graph and
847
+ registers a `zoom-canvas` that keeps the wheel, the same pattern
848
+ `g6_drag_canvas_touch.js` already uses for `drag-canvas`. **Every graph gets
849
+ it with no change to its `behaviors` list.**
850
+ - **G6 does not read the DOM's `contextmenu` event.** Its `BehaviorController`
851
+ synthesises the event from `pointerdown` with `button === 2`, so the context
852
+ menu was a right click and only a right click, whatever the browser does
853
+ with a long press. The same module gives it a **long press** (500ms, 10px of
854
+ slop) that re-emits G6's own forwarded event under the name the plugin
855
+ listens for — so `getItems(e)` sees exactly what a right click gives it,
856
+ including the port under the finger.
857
+
858
+ Everything a finger has to LAND on is sized off `(pointer: coarse)`, which
859
+ means **a mouse sees no change at all**: node resize handles become a 14px
860
+ mark in a 44px box and drop to the four corners (eight fingertip-sized boxes
861
+ around a 90px node overlap into one blob, and a corner resizes both axes);
862
+ `node properties` and `delete node` go from two 28px circles 4px apart —
863
+ one fingertip covered both, with the destructive one underneath — to 44px
864
+ and 12px apart; a port's hit area stops being a flat `+4` in **world** units
865
+ (a different target at every zoom, and 5 screen px at the 50% a phone lands
866
+ on after fit) and becomes a screen measurement converted to world; popover
867
+ controls and context-menu rows get a 44px floor at 16px, under which iOS
868
+ Safari zooms the page on focus and never zooms back.
869
+
870
+ And the two **floating toolbars fold**. They are drawn inside the canvas, one
871
+ on each edge: on a 356px-wide phone canvas they took a third of the drawing
872
+ area and stood on top of the nodes. Under **480px of container** — measured on
873
+ the container, not the window, because the same graph is a full page in one
874
+ app and a card in a column in another — they collapse behind a single `⋮`,
875
+ and the edit strip is removed rather than emptied (an empty toolbar is still
876
+ a card with a border sitting on the graph). Above that width nothing changes.
877
+
878
+ **New keys for consumers: `show toolbar`, `hide toolbar`.**
879
+
880
+ What is still desktop-only, deliberately: **multi-selection**. `brush-select`
881
+ is bound to `shift`, and `drag-canvas` stands aside for the same key — there
882
+ is no shift on a phone, and giving the rubber band a touch gesture means
883
+ taking one away from panning. Selecting nodes one at a time works on a phone;
884
+ selecting a region does not.
885
+
833
886
  ### Tabs opened at runtime, and the two decisions their url costs
834
887
 
835
888
  `yui_tab_routes.js`. A workspace whose tabs are opened by the operator —
@@ -911,12 +964,28 @@ gone wrong:
911
964
  work — so a marquee shows up in the `machine` trace like every other action.
912
965
  Shift+click is not G6's `click-select` at all: this gclass already owns
913
966
  `EV_NODE_CLICK`, and adding a second selection owner outside the FSM is how
914
- the two end up disagreeing.
915
-
916
- Panning gives way while **Shift** is held (`drag-canvas` takes an `enable`
917
- predicate), or the canvas would pan under the rubber band — G6 binds
918
- `drag-canvas` straight to the drag events, and its own docs warn that the two
919
- gestures cannot both be a plain drag.
967
+ the two end up disagreeing. The band comes from `g6_brush_select_owned.js`,
968
+ a `brush-select` under our own id with ONE half removed: the built-in also
969
+ rewrites the `selected` state of every node and every edge on each canvas
970
+ click, behind the gclass and outside the history pause with which it sets
971
+ and clears the selection — a recorded command whose before and after are
972
+ identical, which is a lit Save on a graph nobody has touched (`7.23.10`).
973
+
974
+ Panning gives way while **Shift** is held AND while the pointer is on a card
975
+ (`drag-canvas` takes an `enable` predicate) — the first because the canvas
976
+ would otherwise pan under the rubber band, the second because it would
977
+ otherwise pan under the node being dragged. That second half is G6's own
978
+ default, and an `enable` REPLACES the default rather than adding to it: while
979
+ it was missing, a drag moved the card at twice the pointer and slid the whole
980
+ graph underneath it (`7.23.10`).
981
+
982
+ **Undo, Redo and Save are the history plugin, and it follows the MODE.** It is
983
+ installed on entering edition and removed on leaving it — including when
984
+ edition is reached through the mode selector on a graph whose data is already
985
+ loaded, which is the ordinary way in. Before `7.23.10` it was installed at the
986
+ arrival of the last topic of the load and only if the graph was in edition
987
+ right then, so that ordinary way left the graph with dead Undo/Redo buttons
988
+ and a `history_pause()` nothing answered, while Save still lit on its own.
920
989
 
921
990
  **A delete says what it takes, whether it is one or twenty.** The Delete key
922
991
  asks the same question the per-node delete icon asks, built by the same