@yuneta/gobj-ui 7.23.108 → 7.23.110

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.
@@ -9479,7 +9479,10 @@ function mt_create$15(gobj) {
9479
9479
  let map_settings = (0, _yuneta_gobj_js.json_deep_copy)((0, _yuneta_gobj_js.gobj_read_attr)(gobj, "map_settings"));
9480
9480
  let $map = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$map");
9481
9481
  if ($map) $map.classList.add(GCLASS_NAME$15);
9482
- Object.assign(map_settings, { container: $map });
9482
+ Object.assign(map_settings, {
9483
+ container: $map,
9484
+ cooperativeGestures: true
9485
+ });
9483
9486
  priv.onClick = (ev) => {
9484
9487
  onClick(gobj, ev);
9485
9488
  };
@@ -10766,6 +10769,51 @@ function yui_graph_update_zoom($container, graph) {
10766
10769
  $readout.textContent = yui_graph_zoom_text(graph);
10767
10770
  }
10768
10771
  /************************************************************
10772
+ * THE WHEEL SCROLLS; CTRL + WHEEL ZOOMS. In every graph.
10773
+ *
10774
+ * The vocabulary of a camera is one vocabulary or it is
10775
+ * nothing: this file exists because the three graphs of the
10776
+ * library were each naming the same gestures differently, and
10777
+ * the wheel was the last one left -- `C_G6_NODES_TREE` scrolled
10778
+ * with it since 7.23.75 while the json graph and the gobj tree
10779
+ * went on zooming.
10780
+ *
10781
+ * Why scroll and not zoom: a graph of many nodes is taller than
10782
+ * the screen, and a wheel that zoomed made it a thing to be
10783
+ * looked at from afar or read through a keyhole -- never
10784
+ * scrolled, which is what a wheel does on a map and on every
10785
+ * page. Zoom is Ctrl + wheel (what a trackpad pinch arrives
10786
+ * as), the toolbar's +/-, and the two-finger pinch.
10787
+ *
10788
+ * Two things this pair has learnt, both the hard way:
10789
+ *
10790
+ * - `enable` on the scroll is what keeps the two apart, and the
10791
+ * two must name the SAME key or the gesture falls between
10792
+ * them: the scroll once stood aside for Meta as well while
10793
+ * the zoom listened for Control alone, so Cmd + wheel neither
10794
+ * scrolled nor zoomed. It is ONE key because a G6 `trigger`
10795
+ * is a CHORD, not a list of alternatives -- `Shortcut.match()`
10796
+ * compares the held keys to the bound ones as a SET.
10797
+ * - `animation: false` on the zoom. The house rule first
10798
+ * (nothing here slides), and then the anchor: `aftertransform`
10799
+ * fires while G6's 200ms easing is still running, so a
10800
+ * re-centring measured a camera that was still moving --
10801
+ * passes of -272, +411, +183, oscillating because the ground
10802
+ * moved between two reads.
10803
+ ************************************************************/
10804
+ function yui_graph_camera_behaviors() {
10805
+ return [{
10806
+ type: "scroll-canvas",
10807
+ key: "scroll-canvas",
10808
+ enable: (event) => !(event && event.ctrlKey)
10809
+ }, {
10810
+ type: "zoom-canvas",
10811
+ key: "zoom-canvas",
10812
+ trigger: ["Control"],
10813
+ animation: false
10814
+ }];
10815
+ }
10816
+ /************************************************************
10769
10817
  * The camera cluster: zoom in, zoom out, readout, fit,
10770
10818
  * actual size. Returns createElement2 specs, in order.
10771
10819
  *
@@ -12054,16 +12102,13 @@ function build_cell_html(key, value, type, dark, matched, fold) {
12054
12102
  * forever. `+3` and `−` need no language.
12055
12103
  ************************************************************/
12056
12104
  var FOLD_SPACER = `<span style="width:24px; flex:0 0 auto;"></span>`;
12057
- var ZOOM_CANVAS$1 = {
12058
- type: "zoom-canvas",
12059
- animation: false
12060
- };
12105
+ var CAMERA$1 = yui_graph_camera_behaviors();
12061
12106
  var BEHAVIORS_READING$1 = [
12062
12107
  "drag-canvas",
12063
- ZOOM_CANVAS$1,
12108
+ ...CAMERA$1,
12064
12109
  "drag-element"
12065
12110
  ];
12066
- var BEHAVIORS_PICKING$1 = ["drag-canvas", ZOOM_CANVAS$1];
12111
+ var BEHAVIORS_PICKING$1 = ["drag-canvas", ...CAMERA$1];
12067
12112
  var CARD_HEADER_H$1 = 24;
12068
12113
  var CARD_ROW_H$1 = 22;
12069
12114
  var H_GAP = 60;
@@ -17628,16 +17673,13 @@ var attrs_table$9 = [
17628
17673
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_INTEGER, "collapse_threshold", 0, 10, "Auto-collapse a node whose direct children exceed this number. 0 disables auto-collapse."),
17629
17674
  (0, _yuneta_gobj_js.SDATA_END)()
17630
17675
  ];
17631
- var ZOOM_CANVAS = {
17632
- type: "zoom-canvas",
17633
- animation: false
17634
- };
17676
+ var CAMERA = yui_graph_camera_behaviors();
17635
17677
  var BEHAVIORS_READING = [
17636
17678
  "drag-canvas",
17637
- ZOOM_CANVAS,
17679
+ ...CAMERA,
17638
17680
  "drag-element"
17639
17681
  ];
17640
- var BEHAVIORS_PICKING = ["drag-canvas", ZOOM_CANVAS];
17682
+ var BEHAVIORS_PICKING = ["drag-canvas", ...CAMERA];
17641
17683
  var VIEW_STORE_PREFIX = "yui_gobj_tree_view:";
17642
17684
  function view_store_key(gobj) {
17643
17685
  return VIEW_STORE_PREFIX + (0, _yuneta_gobj_js.gobj_name)(gobj);
@@ -55731,38 +55773,16 @@ function build_ports(gobj, desc) {
55731
55773
  ************************************************************/
55732
55774
  var LR_LAYOUTS = ["dagre"];
55733
55775
  /************************************************************
55734
- * The camera behaviors every operation mode shares.
55735
- *
55736
- * The wheel SCROLLS, as it does on a map and on every page: a
55737
- * graph of many nodes is taller than the screen, and a wheel
55738
- * that zoomed instead made it a thing to be looked at from afar
55739
- * or read through a keyhole -- never scrolled. Zoom is Ctrl +
55740
- * wheel (which is also what a trackpad pinch arrives as), the
55741
- * toolbar's +/-, and the two-finger pinch of g6_touch_gestures.
55742
- * `enable` on the scroll keeps the two apart: a Ctrl wheel is
55743
- * the zoom's, so the scroll stands aside for it.
55744
- *
55745
- * And the two have to name the SAME key, or the gesture falls
55746
- * between them: the scroll stood aside for Meta as well, while
55747
- * the zoom listened for Control alone, so Cmd + wheel neither
55748
- * scrolled nor zoomed. It is ONE key and not two because a G6
55749
- * `trigger` is a CHORD, not a list of alternatives -- its
55750
- * `Shortcut.match()` compares the held keys to the bound ones
55751
- * as a SET, so ["Control", "Meta"] means both keys down at
55752
- * once. Control it is, on every platform: it is what a
55753
- * trackpad pinch arrives as, so a Mac keeps its pinch and
55754
- * gains nothing to press by mistake.
55776
+ * The camera behaviors every operation mode shares: the wheel
55777
+ * SCROLLS and Ctrl + wheel zooms.
55778
+ *
55779
+ * Written in `yui_graph_camera.js` now, with the reasoning and
55780
+ * the two traps, so the json graph and the gobj tree speak it
55781
+ * too. It was the last gesture of the camera that this graph
55782
+ * said one way and its siblings another.
55755
55783
  ************************************************************/
55756
55784
  function camera_behaviors() {
55757
- return [{
55758
- type: "scroll-canvas",
55759
- key: "scroll-canvas",
55760
- enable: (event) => !(event && event.ctrlKey)
55761
- }, {
55762
- type: "zoom-canvas",
55763
- key: "zoom-canvas",
55764
- trigger: ["Control"]
55765
- }];
55785
+ return yui_graph_camera_behaviors();
55766
55786
  }
55767
55787
  function layout_direction(gobj) {
55768
55788
  return (0, _yuneta_gobj_js.str_in_list)(LR_LAYOUTS, gobj.priv.layout) ? "LR" : "TB";
@@ -9474,7 +9474,10 @@ function mt_create$15(gobj) {
9474
9474
  let map_settings = json_deep_copy(gobj_read_attr(gobj, "map_settings"));
9475
9475
  let $map = gobj_read_attr(gobj, "$map");
9476
9476
  if ($map) $map.classList.add(GCLASS_NAME$15);
9477
- Object.assign(map_settings, { container: $map });
9477
+ Object.assign(map_settings, {
9478
+ container: $map,
9479
+ cooperativeGestures: true
9480
+ });
9478
9481
  priv.onClick = (ev) => {
9479
9482
  onClick(gobj, ev);
9480
9483
  };
@@ -10761,6 +10764,51 @@ function yui_graph_update_zoom($container, graph) {
10761
10764
  $readout.textContent = yui_graph_zoom_text(graph);
10762
10765
  }
10763
10766
  /************************************************************
10767
+ * THE WHEEL SCROLLS; CTRL + WHEEL ZOOMS. In every graph.
10768
+ *
10769
+ * The vocabulary of a camera is one vocabulary or it is
10770
+ * nothing: this file exists because the three graphs of the
10771
+ * library were each naming the same gestures differently, and
10772
+ * the wheel was the last one left -- `C_G6_NODES_TREE` scrolled
10773
+ * with it since 7.23.75 while the json graph and the gobj tree
10774
+ * went on zooming.
10775
+ *
10776
+ * Why scroll and not zoom: a graph of many nodes is taller than
10777
+ * the screen, and a wheel that zoomed made it a thing to be
10778
+ * looked at from afar or read through a keyhole -- never
10779
+ * scrolled, which is what a wheel does on a map and on every
10780
+ * page. Zoom is Ctrl + wheel (what a trackpad pinch arrives
10781
+ * as), the toolbar's +/-, and the two-finger pinch.
10782
+ *
10783
+ * Two things this pair has learnt, both the hard way:
10784
+ *
10785
+ * - `enable` on the scroll is what keeps the two apart, and the
10786
+ * two must name the SAME key or the gesture falls between
10787
+ * them: the scroll once stood aside for Meta as well while
10788
+ * the zoom listened for Control alone, so Cmd + wheel neither
10789
+ * scrolled nor zoomed. It is ONE key because a G6 `trigger`
10790
+ * is a CHORD, not a list of alternatives -- `Shortcut.match()`
10791
+ * compares the held keys to the bound ones as a SET.
10792
+ * - `animation: false` on the zoom. The house rule first
10793
+ * (nothing here slides), and then the anchor: `aftertransform`
10794
+ * fires while G6's 200ms easing is still running, so a
10795
+ * re-centring measured a camera that was still moving --
10796
+ * passes of -272, +411, +183, oscillating because the ground
10797
+ * moved between two reads.
10798
+ ************************************************************/
10799
+ function yui_graph_camera_behaviors() {
10800
+ return [{
10801
+ type: "scroll-canvas",
10802
+ key: "scroll-canvas",
10803
+ enable: (event) => !(event && event.ctrlKey)
10804
+ }, {
10805
+ type: "zoom-canvas",
10806
+ key: "zoom-canvas",
10807
+ trigger: ["Control"],
10808
+ animation: false
10809
+ }];
10810
+ }
10811
+ /************************************************************
10764
10812
  * The camera cluster: zoom in, zoom out, readout, fit,
10765
10813
  * actual size. Returns createElement2 specs, in order.
10766
10814
  *
@@ -12049,16 +12097,13 @@ function build_cell_html(key, value, type, dark, matched, fold) {
12049
12097
  * forever. `+3` and `−` need no language.
12050
12098
  ************************************************************/
12051
12099
  var FOLD_SPACER = `<span style="width:24px; flex:0 0 auto;"></span>`;
12052
- var ZOOM_CANVAS$1 = {
12053
- type: "zoom-canvas",
12054
- animation: false
12055
- };
12100
+ var CAMERA$1 = yui_graph_camera_behaviors();
12056
12101
  var BEHAVIORS_READING$1 = [
12057
12102
  "drag-canvas",
12058
- ZOOM_CANVAS$1,
12103
+ ...CAMERA$1,
12059
12104
  "drag-element"
12060
12105
  ];
12061
- var BEHAVIORS_PICKING$1 = ["drag-canvas", ZOOM_CANVAS$1];
12106
+ var BEHAVIORS_PICKING$1 = ["drag-canvas", ...CAMERA$1];
12062
12107
  var CARD_HEADER_H$1 = 24;
12063
12108
  var CARD_ROW_H$1 = 22;
12064
12109
  var H_GAP = 60;
@@ -17623,16 +17668,13 @@ var attrs_table$9 = [
17623
17668
  SDATA(data_type_t.DTP_INTEGER, "collapse_threshold", 0, 10, "Auto-collapse a node whose direct children exceed this number. 0 disables auto-collapse."),
17624
17669
  SDATA_END()
17625
17670
  ];
17626
- var ZOOM_CANVAS = {
17627
- type: "zoom-canvas",
17628
- animation: false
17629
- };
17671
+ var CAMERA = yui_graph_camera_behaviors();
17630
17672
  var BEHAVIORS_READING = [
17631
17673
  "drag-canvas",
17632
- ZOOM_CANVAS,
17674
+ ...CAMERA,
17633
17675
  "drag-element"
17634
17676
  ];
17635
- var BEHAVIORS_PICKING = ["drag-canvas", ZOOM_CANVAS];
17677
+ var BEHAVIORS_PICKING = ["drag-canvas", ...CAMERA];
17636
17678
  var VIEW_STORE_PREFIX = "yui_gobj_tree_view:";
17637
17679
  function view_store_key(gobj) {
17638
17680
  return VIEW_STORE_PREFIX + gobj_name(gobj);
@@ -55726,38 +55768,16 @@ function build_ports(gobj, desc) {
55726
55768
  ************************************************************/
55727
55769
  var LR_LAYOUTS = ["dagre"];
55728
55770
  /************************************************************
55729
- * The camera behaviors every operation mode shares.
55730
- *
55731
- * The wheel SCROLLS, as it does on a map and on every page: a
55732
- * graph of many nodes is taller than the screen, and a wheel
55733
- * that zoomed instead made it a thing to be looked at from afar
55734
- * or read through a keyhole -- never scrolled. Zoom is Ctrl +
55735
- * wheel (which is also what a trackpad pinch arrives as), the
55736
- * toolbar's +/-, and the two-finger pinch of g6_touch_gestures.
55737
- * `enable` on the scroll keeps the two apart: a Ctrl wheel is
55738
- * the zoom's, so the scroll stands aside for it.
55739
- *
55740
- * And the two have to name the SAME key, or the gesture falls
55741
- * between them: the scroll stood aside for Meta as well, while
55742
- * the zoom listened for Control alone, so Cmd + wheel neither
55743
- * scrolled nor zoomed. It is ONE key and not two because a G6
55744
- * `trigger` is a CHORD, not a list of alternatives -- its
55745
- * `Shortcut.match()` compares the held keys to the bound ones
55746
- * as a SET, so ["Control", "Meta"] means both keys down at
55747
- * once. Control it is, on every platform: it is what a
55748
- * trackpad pinch arrives as, so a Mac keeps its pinch and
55749
- * gains nothing to press by mistake.
55771
+ * The camera behaviors every operation mode shares: the wheel
55772
+ * SCROLLS and Ctrl + wheel zooms.
55773
+ *
55774
+ * Written in `yui_graph_camera.js` now, with the reasoning and
55775
+ * the two traps, so the json graph and the gobj tree speak it
55776
+ * too. It was the last gesture of the camera that this graph
55777
+ * said one way and its siblings another.
55750
55778
  ************************************************************/
55751
55779
  function camera_behaviors() {
55752
- return [{
55753
- type: "scroll-canvas",
55754
- key: "scroll-canvas",
55755
- enable: (event) => !(event && event.ctrlKey)
55756
- }, {
55757
- type: "zoom-canvas",
55758
- key: "zoom-canvas",
55759
- trigger: ["Control"]
55760
- }];
55780
+ return yui_graph_camera_behaviors();
55761
55781
  }
55762
55782
  function layout_direction(gobj) {
55763
55783
  return str_in_list(LR_LAYOUTS, gobj.priv.layout) ? "LR" : "TB";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "7.23.108",
3
+ "version": "7.23.110",
4
4
  "type": "module",
5
5
  "main": "dist/gobj-ui.cjs.js",
6
6
  "module": "dist/gobj-ui.es.js",
@@ -110,6 +110,7 @@ import {delete_impact} from "./delete_impact.js";
110
110
  import {
111
111
  yui_graph_center_on,
112
112
  yui_graph_viewport_of,
113
+ yui_graph_camera_behaviors,
113
114
  yui_graph_place_at,
114
115
  } from "./yui_graph_camera.js";
115
116
  import {
@@ -1955,42 +1956,17 @@ function build_ports(gobj, desc)
1955
1956
  const LR_LAYOUTS = ["dagre"];
1956
1957
 
1957
1958
  /************************************************************
1958
- * The camera behaviors every operation mode shares.
1959
+ * The camera behaviors every operation mode shares: the wheel
1960
+ * SCROLLS and Ctrl + wheel zooms.
1959
1961
  *
1960
- * The wheel SCROLLS, as it does on a map and on every page: a
1961
- * graph of many nodes is taller than the screen, and a wheel
1962
- * that zoomed instead made it a thing to be looked at from afar
1963
- * or read through a keyhole -- never scrolled. Zoom is Ctrl +
1964
- * wheel (which is also what a trackpad pinch arrives as), the
1965
- * toolbar's +/-, and the two-finger pinch of g6_touch_gestures.
1966
- * `enable` on the scroll keeps the two apart: a Ctrl wheel is
1967
- * the zoom's, so the scroll stands aside for it.
1968
- *
1969
- * And the two have to name the SAME key, or the gesture falls
1970
- * between them: the scroll stood aside for Meta as well, while
1971
- * the zoom listened for Control alone, so Cmd + wheel neither
1972
- * scrolled nor zoomed. It is ONE key and not two because a G6
1973
- * `trigger` is a CHORD, not a list of alternatives -- its
1974
- * `Shortcut.match()` compares the held keys to the bound ones
1975
- * as a SET, so ["Control", "Meta"] means both keys down at
1976
- * once. Control it is, on every platform: it is what a
1977
- * trackpad pinch arrives as, so a Mac keeps its pinch and
1978
- * gains nothing to press by mistake.
1962
+ * Written in `yui_graph_camera.js` now, with the reasoning and
1963
+ * the two traps, so the json graph and the gobj tree speak it
1964
+ * too. It was the last gesture of the camera that this graph
1965
+ * said one way and its siblings another.
1979
1966
  ************************************************************/
1980
1967
  function camera_behaviors()
1981
1968
  {
1982
- return [
1983
- {
1984
- type: "scroll-canvas",
1985
- key: "scroll-canvas",
1986
- enable: (event) => !(event && event.ctrlKey),
1987
- },
1988
- {
1989
- type: "zoom-canvas",
1990
- key: "zoom-canvas",
1991
- trigger: ["Control"],
1992
- },
1993
- ];
1969
+ return yui_graph_camera_behaviors();
1994
1970
  }
1995
1971
 
1996
1972
  function layout_direction(gobj)
@@ -58,6 +58,7 @@ import {yui_toolbar, yui_toolbar_icon} from "./yui_toolbar.js";
58
58
  import {attach_clear} from "./yui_inputs.js";
59
59
  import {
60
60
  yui_graph_camera_items,
61
+ yui_graph_camera_behaviors,
61
62
  yui_graph_anchor_item,
62
63
  yui_graph_update_anchor,
63
64
  yui_graph_center_on,
@@ -130,10 +131,15 @@ SDATA_END()
130
131
  * reads the easing had moved the ground. With the zoom instantaneous
131
132
  * the camera is still by the time anything measures it.
132
133
  */
133
- const ZOOM_CANVAS = {type: 'zoom-canvas', animation: false};
134
-
135
- const BEHAVIORS_READING = ['drag-canvas', ZOOM_CANVAS, 'drag-element'];
136
- const BEHAVIORS_PICKING = ['drag-canvas', ZOOM_CANVAS];
134
+ /* The wheel SCROLLS and Ctrl + wheel zooms, like every other graph
135
+ * of the library: the pair, and the reasoning, live in
136
+ * `yui_graph_camera.js`. This view used to zoom on a bare wheel --
137
+ * the same gesture meaning two different things in two graphs a
138
+ * reader has open side by side. */
139
+ const CAMERA = yui_graph_camera_behaviors();
140
+
141
+ const BEHAVIORS_READING = ['drag-canvas', ...CAMERA, 'drag-element'];
142
+ const BEHAVIORS_PICKING = ['drag-canvas', ...CAMERA];
137
143
 
138
144
  /*
139
145
  * Where this view is remembered between visits.
@@ -51,6 +51,7 @@ import {yui_toolbar, yui_toolbar_icon} from "./yui_toolbar.js";
51
51
  import {attach_clear} from "./yui_inputs.js";
52
52
  import {
53
53
  yui_graph_camera_items,
54
+ yui_graph_camera_behaviors,
54
55
  yui_graph_anchor_item,
55
56
  yui_graph_update_anchor,
56
57
  yui_graph_center_on,
@@ -978,10 +979,15 @@ const FOLD_SPACER = `<span style="width:24px; flex:0 0 auto;"></span>`;
978
979
  * reads the easing had moved the ground. With the zoom instantaneous
979
980
  * the camera is still by the time anything measures it.
980
981
  */
981
- const ZOOM_CANVAS = {type: 'zoom-canvas', animation: false};
982
-
983
- const BEHAVIORS_READING = ['drag-canvas', ZOOM_CANVAS, 'drag-element'];
984
- const BEHAVIORS_PICKING = ['drag-canvas', ZOOM_CANVAS];
982
+ /* The wheel SCROLLS and Ctrl + wheel zooms, like every other graph
983
+ * of the library: the pair, and the reasoning, live in
984
+ * `yui_graph_camera.js`. This view used to zoom on a bare wheel --
985
+ * the same gesture meaning two different things in two graphs a
986
+ * reader has open side by side. */
987
+ const CAMERA = yui_graph_camera_behaviors();
988
+
989
+ const BEHAVIORS_READING = ['drag-canvas', ...CAMERA, 'drag-element'];
990
+ const BEHAVIORS_PICKING = ['drag-canvas', ...CAMERA];
985
991
 
986
992
  /*
987
993
  * The card's geometry, in ONE place.
package/src/c_yui_map.js CHANGED
@@ -119,6 +119,19 @@ function mt_create(gobj)
119
119
  }
120
120
  Object.assign(map_settings, {
121
121
  container: $map,
122
+ /* THE WHEEL DOES NOT ZOOM; Ctrl + wheel does -- the same
123
+ * vocabulary as the three graphs (`yui_graph_camera.js`), so a
124
+ * reader with a map and a graph open does not have to remember
125
+ * which is which. maplibre calls it `cooperativeGestures`, and
126
+ * it never blocks a wheel carrying ctrlKey, so a trackpad PINCH
127
+ * keeps zooming on every platform (a Mac gets Cmd as well, its
128
+ * own convention, which costs nothing).
129
+ *
130
+ * HERE and not in the attr's default value: a JSON attr is
131
+ * replaced WHOLESALE by a host that passes its own, so a
132
+ * default is a suggestion -- the demo passes `map_settings` and
133
+ * never saw it. This is the house gesture, not a suggestion. */
134
+ cooperativeGestures: true,
122
135
  });
123
136
 
124
137
  /*-----------------------------*
@@ -99,6 +99,56 @@ export function yui_graph_update_zoom($container, graph)
99
99
  $readout.textContent = yui_graph_zoom_text(graph);
100
100
  }
101
101
 
102
+ /************************************************************
103
+ * THE WHEEL SCROLLS; CTRL + WHEEL ZOOMS. In every graph.
104
+ *
105
+ * The vocabulary of a camera is one vocabulary or it is
106
+ * nothing: this file exists because the three graphs of the
107
+ * library were each naming the same gestures differently, and
108
+ * the wheel was the last one left -- `C_G6_NODES_TREE` scrolled
109
+ * with it since 7.23.75 while the json graph and the gobj tree
110
+ * went on zooming.
111
+ *
112
+ * Why scroll and not zoom: a graph of many nodes is taller than
113
+ * the screen, and a wheel that zoomed made it a thing to be
114
+ * looked at from afar or read through a keyhole -- never
115
+ * scrolled, which is what a wheel does on a map and on every
116
+ * page. Zoom is Ctrl + wheel (what a trackpad pinch arrives
117
+ * as), the toolbar's +/-, and the two-finger pinch.
118
+ *
119
+ * Two things this pair has learnt, both the hard way:
120
+ *
121
+ * - `enable` on the scroll is what keeps the two apart, and the
122
+ * two must name the SAME key or the gesture falls between
123
+ * them: the scroll once stood aside for Meta as well while
124
+ * the zoom listened for Control alone, so Cmd + wheel neither
125
+ * scrolled nor zoomed. It is ONE key because a G6 `trigger`
126
+ * is a CHORD, not a list of alternatives -- `Shortcut.match()`
127
+ * compares the held keys to the bound ones as a SET.
128
+ * - `animation: false` on the zoom. The house rule first
129
+ * (nothing here slides), and then the anchor: `aftertransform`
130
+ * fires while G6's 200ms easing is still running, so a
131
+ * re-centring measured a camera that was still moving --
132
+ * passes of -272, +411, +183, oscillating because the ground
133
+ * moved between two reads.
134
+ ************************************************************/
135
+ export function yui_graph_camera_behaviors()
136
+ {
137
+ return [
138
+ {
139
+ type: "scroll-canvas",
140
+ key: "scroll-canvas",
141
+ enable: (event) => !(event && event.ctrlKey),
142
+ },
143
+ {
144
+ type: "zoom-canvas",
145
+ key: "zoom-canvas",
146
+ trigger: ["Control"],
147
+ animation: false,
148
+ },
149
+ ];
150
+ }
151
+
102
152
  /************************************************************
103
153
  * The camera cluster: zoom in, zoom out, readout, fit,
104
154
  * actual size. Returns createElement2 specs, in order.