@yuneta/gobj-ui 7.23.108 → 7.23.109
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/dist/gobj-ui.cjs.js +59 -42
- package/dist/gobj-ui.es.js +59 -42
- package/package.json +1 -1
- package/src/c_g6_nodes_tree.js +8 -32
- package/src/c_yui_gobj_tree_js.js +10 -4
- package/src/c_yui_json_graph.js +10 -4
- package/src/yui_graph_camera.js +50 -0
package/dist/gobj-ui.cjs.js
CHANGED
|
@@ -10766,6 +10766,51 @@ function yui_graph_update_zoom($container, graph) {
|
|
|
10766
10766
|
$readout.textContent = yui_graph_zoom_text(graph);
|
|
10767
10767
|
}
|
|
10768
10768
|
/************************************************************
|
|
10769
|
+
* THE WHEEL SCROLLS; CTRL + WHEEL ZOOMS. In every graph.
|
|
10770
|
+
*
|
|
10771
|
+
* The vocabulary of a camera is one vocabulary or it is
|
|
10772
|
+
* nothing: this file exists because the three graphs of the
|
|
10773
|
+
* library were each naming the same gestures differently, and
|
|
10774
|
+
* the wheel was the last one left -- `C_G6_NODES_TREE` scrolled
|
|
10775
|
+
* with it since 7.23.75 while the json graph and the gobj tree
|
|
10776
|
+
* went on zooming.
|
|
10777
|
+
*
|
|
10778
|
+
* Why scroll and not zoom: a graph of many nodes is taller than
|
|
10779
|
+
* the screen, and a wheel that zoomed made it a thing to be
|
|
10780
|
+
* looked at from afar or read through a keyhole -- never
|
|
10781
|
+
* scrolled, which is what a wheel does on a map and on every
|
|
10782
|
+
* page. Zoom is Ctrl + wheel (what a trackpad pinch arrives
|
|
10783
|
+
* as), the toolbar's +/-, and the two-finger pinch.
|
|
10784
|
+
*
|
|
10785
|
+
* Two things this pair has learnt, both the hard way:
|
|
10786
|
+
*
|
|
10787
|
+
* - `enable` on the scroll is what keeps the two apart, and the
|
|
10788
|
+
* two must name the SAME key or the gesture falls between
|
|
10789
|
+
* them: the scroll once stood aside for Meta as well while
|
|
10790
|
+
* the zoom listened for Control alone, so Cmd + wheel neither
|
|
10791
|
+
* scrolled nor zoomed. It is ONE key because a G6 `trigger`
|
|
10792
|
+
* is a CHORD, not a list of alternatives -- `Shortcut.match()`
|
|
10793
|
+
* compares the held keys to the bound ones as a SET.
|
|
10794
|
+
* - `animation: false` on the zoom. The house rule first
|
|
10795
|
+
* (nothing here slides), and then the anchor: `aftertransform`
|
|
10796
|
+
* fires while G6's 200ms easing is still running, so a
|
|
10797
|
+
* re-centring measured a camera that was still moving --
|
|
10798
|
+
* passes of -272, +411, +183, oscillating because the ground
|
|
10799
|
+
* moved between two reads.
|
|
10800
|
+
************************************************************/
|
|
10801
|
+
function yui_graph_camera_behaviors() {
|
|
10802
|
+
return [{
|
|
10803
|
+
type: "scroll-canvas",
|
|
10804
|
+
key: "scroll-canvas",
|
|
10805
|
+
enable: (event) => !(event && event.ctrlKey)
|
|
10806
|
+
}, {
|
|
10807
|
+
type: "zoom-canvas",
|
|
10808
|
+
key: "zoom-canvas",
|
|
10809
|
+
trigger: ["Control"],
|
|
10810
|
+
animation: false
|
|
10811
|
+
}];
|
|
10812
|
+
}
|
|
10813
|
+
/************************************************************
|
|
10769
10814
|
* The camera cluster: zoom in, zoom out, readout, fit,
|
|
10770
10815
|
* actual size. Returns createElement2 specs, in order.
|
|
10771
10816
|
*
|
|
@@ -12054,16 +12099,13 @@ function build_cell_html(key, value, type, dark, matched, fold) {
|
|
|
12054
12099
|
* forever. `+3` and `−` need no language.
|
|
12055
12100
|
************************************************************/
|
|
12056
12101
|
var FOLD_SPACER = `<span style="width:24px; flex:0 0 auto;"></span>`;
|
|
12057
|
-
var
|
|
12058
|
-
type: "zoom-canvas",
|
|
12059
|
-
animation: false
|
|
12060
|
-
};
|
|
12102
|
+
var CAMERA$1 = yui_graph_camera_behaviors();
|
|
12061
12103
|
var BEHAVIORS_READING$1 = [
|
|
12062
12104
|
"drag-canvas",
|
|
12063
|
-
|
|
12105
|
+
...CAMERA$1,
|
|
12064
12106
|
"drag-element"
|
|
12065
12107
|
];
|
|
12066
|
-
var BEHAVIORS_PICKING$1 = ["drag-canvas",
|
|
12108
|
+
var BEHAVIORS_PICKING$1 = ["drag-canvas", ...CAMERA$1];
|
|
12067
12109
|
var CARD_HEADER_H$1 = 24;
|
|
12068
12110
|
var CARD_ROW_H$1 = 22;
|
|
12069
12111
|
var H_GAP = 60;
|
|
@@ -17628,16 +17670,13 @@ var attrs_table$9 = [
|
|
|
17628
17670
|
(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
17671
|
(0, _yuneta_gobj_js.SDATA_END)()
|
|
17630
17672
|
];
|
|
17631
|
-
var
|
|
17632
|
-
type: "zoom-canvas",
|
|
17633
|
-
animation: false
|
|
17634
|
-
};
|
|
17673
|
+
var CAMERA = yui_graph_camera_behaviors();
|
|
17635
17674
|
var BEHAVIORS_READING = [
|
|
17636
17675
|
"drag-canvas",
|
|
17637
|
-
|
|
17676
|
+
...CAMERA,
|
|
17638
17677
|
"drag-element"
|
|
17639
17678
|
];
|
|
17640
|
-
var BEHAVIORS_PICKING = ["drag-canvas",
|
|
17679
|
+
var BEHAVIORS_PICKING = ["drag-canvas", ...CAMERA];
|
|
17641
17680
|
var VIEW_STORE_PREFIX = "yui_gobj_tree_view:";
|
|
17642
17681
|
function view_store_key(gobj) {
|
|
17643
17682
|
return VIEW_STORE_PREFIX + (0, _yuneta_gobj_js.gobj_name)(gobj);
|
|
@@ -55731,38 +55770,16 @@ function build_ports(gobj, desc) {
|
|
|
55731
55770
|
************************************************************/
|
|
55732
55771
|
var LR_LAYOUTS = ["dagre"];
|
|
55733
55772
|
/************************************************************
|
|
55734
|
-
* The camera behaviors every operation mode shares
|
|
55735
|
-
*
|
|
55736
|
-
*
|
|
55737
|
-
*
|
|
55738
|
-
*
|
|
55739
|
-
*
|
|
55740
|
-
*
|
|
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.
|
|
55773
|
+
* The camera behaviors every operation mode shares: the wheel
|
|
55774
|
+
* SCROLLS and Ctrl + wheel zooms.
|
|
55775
|
+
*
|
|
55776
|
+
* Written in `yui_graph_camera.js` now, with the reasoning and
|
|
55777
|
+
* the two traps, so the json graph and the gobj tree speak it
|
|
55778
|
+
* too. It was the last gesture of the camera that this graph
|
|
55779
|
+
* said one way and its siblings another.
|
|
55755
55780
|
************************************************************/
|
|
55756
55781
|
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
|
-
}];
|
|
55782
|
+
return yui_graph_camera_behaviors();
|
|
55766
55783
|
}
|
|
55767
55784
|
function layout_direction(gobj) {
|
|
55768
55785
|
return (0, _yuneta_gobj_js.str_in_list)(LR_LAYOUTS, gobj.priv.layout) ? "LR" : "TB";
|
package/dist/gobj-ui.es.js
CHANGED
|
@@ -10761,6 +10761,51 @@ function yui_graph_update_zoom($container, graph) {
|
|
|
10761
10761
|
$readout.textContent = yui_graph_zoom_text(graph);
|
|
10762
10762
|
}
|
|
10763
10763
|
/************************************************************
|
|
10764
|
+
* THE WHEEL SCROLLS; CTRL + WHEEL ZOOMS. In every graph.
|
|
10765
|
+
*
|
|
10766
|
+
* The vocabulary of a camera is one vocabulary or it is
|
|
10767
|
+
* nothing: this file exists because the three graphs of the
|
|
10768
|
+
* library were each naming the same gestures differently, and
|
|
10769
|
+
* the wheel was the last one left -- `C_G6_NODES_TREE` scrolled
|
|
10770
|
+
* with it since 7.23.75 while the json graph and the gobj tree
|
|
10771
|
+
* went on zooming.
|
|
10772
|
+
*
|
|
10773
|
+
* Why scroll and not zoom: a graph of many nodes is taller than
|
|
10774
|
+
* the screen, and a wheel that zoomed made it a thing to be
|
|
10775
|
+
* looked at from afar or read through a keyhole -- never
|
|
10776
|
+
* scrolled, which is what a wheel does on a map and on every
|
|
10777
|
+
* page. Zoom is Ctrl + wheel (what a trackpad pinch arrives
|
|
10778
|
+
* as), the toolbar's +/-, and the two-finger pinch.
|
|
10779
|
+
*
|
|
10780
|
+
* Two things this pair has learnt, both the hard way:
|
|
10781
|
+
*
|
|
10782
|
+
* - `enable` on the scroll is what keeps the two apart, and the
|
|
10783
|
+
* two must name the SAME key or the gesture falls between
|
|
10784
|
+
* them: the scroll once stood aside for Meta as well while
|
|
10785
|
+
* the zoom listened for Control alone, so Cmd + wheel neither
|
|
10786
|
+
* scrolled nor zoomed. It is ONE key because a G6 `trigger`
|
|
10787
|
+
* is a CHORD, not a list of alternatives -- `Shortcut.match()`
|
|
10788
|
+
* compares the held keys to the bound ones as a SET.
|
|
10789
|
+
* - `animation: false` on the zoom. The house rule first
|
|
10790
|
+
* (nothing here slides), and then the anchor: `aftertransform`
|
|
10791
|
+
* fires while G6's 200ms easing is still running, so a
|
|
10792
|
+
* re-centring measured a camera that was still moving --
|
|
10793
|
+
* passes of -272, +411, +183, oscillating because the ground
|
|
10794
|
+
* moved between two reads.
|
|
10795
|
+
************************************************************/
|
|
10796
|
+
function yui_graph_camera_behaviors() {
|
|
10797
|
+
return [{
|
|
10798
|
+
type: "scroll-canvas",
|
|
10799
|
+
key: "scroll-canvas",
|
|
10800
|
+
enable: (event) => !(event && event.ctrlKey)
|
|
10801
|
+
}, {
|
|
10802
|
+
type: "zoom-canvas",
|
|
10803
|
+
key: "zoom-canvas",
|
|
10804
|
+
trigger: ["Control"],
|
|
10805
|
+
animation: false
|
|
10806
|
+
}];
|
|
10807
|
+
}
|
|
10808
|
+
/************************************************************
|
|
10764
10809
|
* The camera cluster: zoom in, zoom out, readout, fit,
|
|
10765
10810
|
* actual size. Returns createElement2 specs, in order.
|
|
10766
10811
|
*
|
|
@@ -12049,16 +12094,13 @@ function build_cell_html(key, value, type, dark, matched, fold) {
|
|
|
12049
12094
|
* forever. `+3` and `−` need no language.
|
|
12050
12095
|
************************************************************/
|
|
12051
12096
|
var FOLD_SPACER = `<span style="width:24px; flex:0 0 auto;"></span>`;
|
|
12052
|
-
var
|
|
12053
|
-
type: "zoom-canvas",
|
|
12054
|
-
animation: false
|
|
12055
|
-
};
|
|
12097
|
+
var CAMERA$1 = yui_graph_camera_behaviors();
|
|
12056
12098
|
var BEHAVIORS_READING$1 = [
|
|
12057
12099
|
"drag-canvas",
|
|
12058
|
-
|
|
12100
|
+
...CAMERA$1,
|
|
12059
12101
|
"drag-element"
|
|
12060
12102
|
];
|
|
12061
|
-
var BEHAVIORS_PICKING$1 = ["drag-canvas",
|
|
12103
|
+
var BEHAVIORS_PICKING$1 = ["drag-canvas", ...CAMERA$1];
|
|
12062
12104
|
var CARD_HEADER_H$1 = 24;
|
|
12063
12105
|
var CARD_ROW_H$1 = 22;
|
|
12064
12106
|
var H_GAP = 60;
|
|
@@ -17623,16 +17665,13 @@ var attrs_table$9 = [
|
|
|
17623
17665
|
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
17666
|
SDATA_END()
|
|
17625
17667
|
];
|
|
17626
|
-
var
|
|
17627
|
-
type: "zoom-canvas",
|
|
17628
|
-
animation: false
|
|
17629
|
-
};
|
|
17668
|
+
var CAMERA = yui_graph_camera_behaviors();
|
|
17630
17669
|
var BEHAVIORS_READING = [
|
|
17631
17670
|
"drag-canvas",
|
|
17632
|
-
|
|
17671
|
+
...CAMERA,
|
|
17633
17672
|
"drag-element"
|
|
17634
17673
|
];
|
|
17635
|
-
var BEHAVIORS_PICKING = ["drag-canvas",
|
|
17674
|
+
var BEHAVIORS_PICKING = ["drag-canvas", ...CAMERA];
|
|
17636
17675
|
var VIEW_STORE_PREFIX = "yui_gobj_tree_view:";
|
|
17637
17676
|
function view_store_key(gobj) {
|
|
17638
17677
|
return VIEW_STORE_PREFIX + gobj_name(gobj);
|
|
@@ -55726,38 +55765,16 @@ function build_ports(gobj, desc) {
|
|
|
55726
55765
|
************************************************************/
|
|
55727
55766
|
var LR_LAYOUTS = ["dagre"];
|
|
55728
55767
|
/************************************************************
|
|
55729
|
-
* The camera behaviors every operation mode shares
|
|
55730
|
-
*
|
|
55731
|
-
*
|
|
55732
|
-
*
|
|
55733
|
-
*
|
|
55734
|
-
*
|
|
55735
|
-
*
|
|
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.
|
|
55768
|
+
* The camera behaviors every operation mode shares: the wheel
|
|
55769
|
+
* SCROLLS and Ctrl + wheel zooms.
|
|
55770
|
+
*
|
|
55771
|
+
* Written in `yui_graph_camera.js` now, with the reasoning and
|
|
55772
|
+
* the two traps, so the json graph and the gobj tree speak it
|
|
55773
|
+
* too. It was the last gesture of the camera that this graph
|
|
55774
|
+
* said one way and its siblings another.
|
|
55750
55775
|
************************************************************/
|
|
55751
55776
|
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
|
-
}];
|
|
55777
|
+
return yui_graph_camera_behaviors();
|
|
55761
55778
|
}
|
|
55762
55779
|
function layout_direction(gobj) {
|
|
55763
55780
|
return str_in_list(LR_LAYOUTS, gobj.priv.layout) ? "LR" : "TB";
|
package/package.json
CHANGED
package/src/c_g6_nodes_tree.js
CHANGED
|
@@ -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
|
-
*
|
|
1961
|
-
*
|
|
1962
|
-
*
|
|
1963
|
-
*
|
|
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
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
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.
|
package/src/c_yui_json_graph.js
CHANGED
|
@@ -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
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
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/yui_graph_camera.js
CHANGED
|
@@ -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.
|