@yuneta/gobj-ui 7.23.159 → 7.23.160
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 +35 -0
- package/dist/gobj-ui.cjs.js +214 -43
- package/dist/gobj-ui.es.js +214 -43
- package/package.json +1 -1
- package/src/c_yui_treedb_schema.js +134 -10
- package/src/yui_graph_camera.js +64 -0
package/dist/gobj-ui.es.js
CHANGED
|
@@ -11500,6 +11500,64 @@ function yui_graph_camera_behaviors() {
|
|
|
11500
11500
|
}];
|
|
11501
11501
|
}
|
|
11502
11502
|
/************************************************************
|
|
11503
|
+
* Make the wheel work over HTML nodes too.
|
|
11504
|
+
*
|
|
11505
|
+
* G6's HTML nodes live in a DOM layer BESIDE the canvas
|
|
11506
|
+
* element, not in it, and they forward six pointer events and
|
|
11507
|
+
* not the wheel. `scroll-canvas` listens on the canvas element
|
|
11508
|
+
* and `zoom-canvas` reads G's own wheel event, which is fed
|
|
11509
|
+
* from that same element -- so a wheel over a card reaches
|
|
11510
|
+
* neither, and on a graph drawn with big cards the wheel only
|
|
11511
|
+
* works in the gaps between them.
|
|
11512
|
+
*
|
|
11513
|
+
* The wheel is caught on `$host` (the element G6 was mounted
|
|
11514
|
+
* in) and dispatched again ON the canvas element, carrying the
|
|
11515
|
+
* deltas, the position and the modifiers: both behaviors then
|
|
11516
|
+
* take it exactly as a wheel over empty canvas. Control is
|
|
11517
|
+
* read by G6 from the real keydown, which is still held.
|
|
11518
|
+
*
|
|
11519
|
+
* A wheel whose target is the canvas passes untouched, which
|
|
11520
|
+
* is also what keeps the re-dispatched one from looping. An
|
|
11521
|
+
* element that must scroll by itself (a popover) stops the
|
|
11522
|
+
* wheel before it gets here.
|
|
11523
|
+
*
|
|
11524
|
+
* Returns the function that removes the listener.
|
|
11525
|
+
************************************************************/
|
|
11526
|
+
function yui_graph_forward_wheel(graph, $host) {
|
|
11527
|
+
if (!graph || !$host) return () => {};
|
|
11528
|
+
const on_wheel = (e) => {
|
|
11529
|
+
let dom = null;
|
|
11530
|
+
try {
|
|
11531
|
+
dom = graph.getCanvas().getContextService().getDomElement();
|
|
11532
|
+
} catch (err) {
|
|
11533
|
+
return;
|
|
11534
|
+
}
|
|
11535
|
+
if (!dom || e.target === dom) return;
|
|
11536
|
+
e.preventDefault();
|
|
11537
|
+
e.stopPropagation();
|
|
11538
|
+
dom.dispatchEvent(new WheelEvent("wheel", {
|
|
11539
|
+
deltaX: e.deltaX,
|
|
11540
|
+
deltaY: e.deltaY,
|
|
11541
|
+
deltaZ: e.deltaZ,
|
|
11542
|
+
deltaMode: e.deltaMode,
|
|
11543
|
+
clientX: e.clientX,
|
|
11544
|
+
clientY: e.clientY,
|
|
11545
|
+
screenX: e.screenX,
|
|
11546
|
+
screenY: e.screenY,
|
|
11547
|
+
ctrlKey: e.ctrlKey,
|
|
11548
|
+
shiftKey: e.shiftKey,
|
|
11549
|
+
altKey: e.altKey,
|
|
11550
|
+
metaKey: e.metaKey,
|
|
11551
|
+
bubbles: true,
|
|
11552
|
+
cancelable: true
|
|
11553
|
+
}));
|
|
11554
|
+
};
|
|
11555
|
+
$host.addEventListener("wheel", on_wheel, { passive: false });
|
|
11556
|
+
return () => {
|
|
11557
|
+
$host.removeEventListener("wheel", on_wheel);
|
|
11558
|
+
};
|
|
11559
|
+
}
|
|
11560
|
+
/************************************************************
|
|
11503
11561
|
* The camera cluster: zoom in, zoom out, readout, fit,
|
|
11504
11562
|
* actual size. Returns createElement2 specs, in order.
|
|
11505
11563
|
*
|
|
@@ -13561,7 +13619,7 @@ function ac_toggle_anchor$2(gobj, event, kw, src) {
|
|
|
13561
13619
|
/************************************************************
|
|
13562
13620
|
*
|
|
13563
13621
|
************************************************************/
|
|
13564
|
-
function ac_zoom_in$
|
|
13622
|
+
function ac_zoom_in$4(gobj, event, kw, src) {
|
|
13565
13623
|
let graph = gobj.priv.graph;
|
|
13566
13624
|
if (graph) {
|
|
13567
13625
|
let z = graph.getZoom();
|
|
@@ -13572,7 +13630,7 @@ function ac_zoom_in$3(gobj, event, kw, src) {
|
|
|
13572
13630
|
/************************************************************
|
|
13573
13631
|
*
|
|
13574
13632
|
************************************************************/
|
|
13575
|
-
function ac_zoom_out$
|
|
13633
|
+
function ac_zoom_out$4(gobj, event, kw, src) {
|
|
13576
13634
|
let graph = gobj.priv.graph;
|
|
13577
13635
|
if (graph) {
|
|
13578
13636
|
let z = graph.getZoom();
|
|
@@ -13583,7 +13641,7 @@ function ac_zoom_out$3(gobj, event, kw, src) {
|
|
|
13583
13641
|
/************************************************************
|
|
13584
13642
|
*
|
|
13585
13643
|
************************************************************/
|
|
13586
|
-
function ac_zoom_reset$
|
|
13644
|
+
function ac_zoom_reset$4(gobj, event, kw, src) {
|
|
13587
13645
|
let priv = gobj.priv;
|
|
13588
13646
|
let graph = priv.graph;
|
|
13589
13647
|
if (graph && graph.rendered) {
|
|
@@ -13598,7 +13656,7 @@ function ac_zoom_reset$3(gobj, event, kw, src) {
|
|
|
13598
13656
|
/************************************************************
|
|
13599
13657
|
*
|
|
13600
13658
|
************************************************************/
|
|
13601
|
-
function ac_center$
|
|
13659
|
+
function ac_center$4(gobj, event, kw, src) {
|
|
13602
13660
|
let graph = gobj.priv.graph;
|
|
13603
13661
|
if (graph) {
|
|
13604
13662
|
graph.fitCenter();
|
|
@@ -13734,22 +13792,22 @@ function create_gclass$14(gclass_name) {
|
|
|
13734
13792
|
],
|
|
13735
13793
|
[
|
|
13736
13794
|
"EV_ZOOM_IN",
|
|
13737
|
-
ac_zoom_in$
|
|
13795
|
+
ac_zoom_in$4,
|
|
13738
13796
|
null
|
|
13739
13797
|
],
|
|
13740
13798
|
[
|
|
13741
13799
|
"EV_ZOOM_OUT",
|
|
13742
|
-
ac_zoom_out$
|
|
13800
|
+
ac_zoom_out$4,
|
|
13743
13801
|
null
|
|
13744
13802
|
],
|
|
13745
13803
|
[
|
|
13746
13804
|
"EV_ZOOM_RESET",
|
|
13747
|
-
ac_zoom_reset$
|
|
13805
|
+
ac_zoom_reset$4,
|
|
13748
13806
|
null
|
|
13749
13807
|
],
|
|
13750
13808
|
[
|
|
13751
13809
|
"EV_CENTER",
|
|
13752
|
-
ac_center$
|
|
13810
|
+
ac_center$4,
|
|
13753
13811
|
null
|
|
13754
13812
|
],
|
|
13755
13813
|
[
|
|
@@ -16846,16 +16904,16 @@ function ac_language_changed$7(gobj, event, kw, src) {
|
|
|
16846
16904
|
/************************************************************
|
|
16847
16905
|
* The camera.
|
|
16848
16906
|
************************************************************/
|
|
16849
|
-
function ac_zoom_in$
|
|
16907
|
+
function ac_zoom_in$3(gobj, event, kw, src) {
|
|
16850
16908
|
return camera(gobj, "zoom in", (graph) => graph.zoomBy(1.2));
|
|
16851
16909
|
}
|
|
16852
|
-
function ac_zoom_out$
|
|
16910
|
+
function ac_zoom_out$3(gobj, event, kw, src) {
|
|
16853
16911
|
return camera(gobj, "zoom out", (graph) => graph.zoomBy(1 / 1.2));
|
|
16854
16912
|
}
|
|
16855
|
-
function ac_zoom_reset$
|
|
16913
|
+
function ac_zoom_reset$3(gobj, event, kw, src) {
|
|
16856
16914
|
return camera(gobj, "reset the zoom", (graph) => graph.zoomTo(1));
|
|
16857
16915
|
}
|
|
16858
|
-
function ac_center$
|
|
16916
|
+
function ac_center$3(gobj, event, kw, src) {
|
|
16859
16917
|
return camera(gobj, "fit the graph", (graph) => fit_readable(graph));
|
|
16860
16918
|
}
|
|
16861
16919
|
/************************************************************
|
|
@@ -16914,22 +16972,22 @@ function create_gclass$11(gclass_name) {
|
|
|
16914
16972
|
],
|
|
16915
16973
|
[
|
|
16916
16974
|
"EV_ZOOM_IN",
|
|
16917
|
-
ac_zoom_in$
|
|
16975
|
+
ac_zoom_in$3,
|
|
16918
16976
|
null
|
|
16919
16977
|
],
|
|
16920
16978
|
[
|
|
16921
16979
|
"EV_ZOOM_OUT",
|
|
16922
|
-
ac_zoom_out$
|
|
16980
|
+
ac_zoom_out$3,
|
|
16923
16981
|
null
|
|
16924
16982
|
],
|
|
16925
16983
|
[
|
|
16926
16984
|
"EV_ZOOM_RESET",
|
|
16927
|
-
ac_zoom_reset$
|
|
16985
|
+
ac_zoom_reset$3,
|
|
16928
16986
|
null
|
|
16929
16987
|
],
|
|
16930
16988
|
[
|
|
16931
16989
|
"EV_CENTER",
|
|
16932
|
-
ac_center$
|
|
16990
|
+
ac_center$3,
|
|
16933
16991
|
null
|
|
16934
16992
|
],
|
|
16935
16993
|
[
|
|
@@ -21037,7 +21095,7 @@ function ac_toggle_anchor$1(gobj, event, kw, src) {
|
|
|
21037
21095
|
/************************************************************
|
|
21038
21096
|
*
|
|
21039
21097
|
************************************************************/
|
|
21040
|
-
function ac_zoom_in$
|
|
21098
|
+
function ac_zoom_in$2(gobj, event, kw, src) {
|
|
21041
21099
|
let graph = gobj.priv.graph;
|
|
21042
21100
|
if (graph) {
|
|
21043
21101
|
let z = graph.getZoom();
|
|
@@ -21048,7 +21106,7 @@ function ac_zoom_in$1(gobj, event, kw, src) {
|
|
|
21048
21106
|
/************************************************************
|
|
21049
21107
|
*
|
|
21050
21108
|
************************************************************/
|
|
21051
|
-
function ac_zoom_out$
|
|
21109
|
+
function ac_zoom_out$2(gobj, event, kw, src) {
|
|
21052
21110
|
let graph = gobj.priv.graph;
|
|
21053
21111
|
if (graph) {
|
|
21054
21112
|
let z = graph.getZoom();
|
|
@@ -21059,7 +21117,7 @@ function ac_zoom_out$1(gobj, event, kw, src) {
|
|
|
21059
21117
|
/************************************************************
|
|
21060
21118
|
*
|
|
21061
21119
|
************************************************************/
|
|
21062
|
-
function ac_zoom_reset$
|
|
21120
|
+
function ac_zoom_reset$2(gobj, event, kw, src) {
|
|
21063
21121
|
let priv = gobj.priv;
|
|
21064
21122
|
let graph = priv.graph;
|
|
21065
21123
|
if (graph && graph.rendered) {
|
|
@@ -21074,7 +21132,7 @@ function ac_zoom_reset$1(gobj, event, kw, src) {
|
|
|
21074
21132
|
/************************************************************
|
|
21075
21133
|
*
|
|
21076
21134
|
************************************************************/
|
|
21077
|
-
function ac_center$
|
|
21135
|
+
function ac_center$2(gobj, event, kw, src) {
|
|
21078
21136
|
let graph = gobj.priv.graph;
|
|
21079
21137
|
if (graph) {
|
|
21080
21138
|
graph.fitCenter();
|
|
@@ -21280,22 +21338,22 @@ function create_gclass$9(gclass_name) {
|
|
|
21280
21338
|
],
|
|
21281
21339
|
[
|
|
21282
21340
|
"EV_ZOOM_IN",
|
|
21283
|
-
ac_zoom_in$
|
|
21341
|
+
ac_zoom_in$2,
|
|
21284
21342
|
null
|
|
21285
21343
|
],
|
|
21286
21344
|
[
|
|
21287
21345
|
"EV_ZOOM_OUT",
|
|
21288
|
-
ac_zoom_out$
|
|
21346
|
+
ac_zoom_out$2,
|
|
21289
21347
|
null
|
|
21290
21348
|
],
|
|
21291
21349
|
[
|
|
21292
21350
|
"EV_ZOOM_RESET",
|
|
21293
|
-
ac_zoom_reset$
|
|
21351
|
+
ac_zoom_reset$2,
|
|
21294
21352
|
null
|
|
21295
21353
|
],
|
|
21296
21354
|
[
|
|
21297
21355
|
"EV_CENTER",
|
|
21298
|
-
ac_center$
|
|
21356
|
+
ac_center$2,
|
|
21299
21357
|
null
|
|
21300
21358
|
],
|
|
21301
21359
|
[
|
|
@@ -64008,15 +64066,15 @@ function ac_theme$1(gobj, event, kw, src) {
|
|
|
64008
64066
|
/************************************************************
|
|
64009
64067
|
* Zoom controls
|
|
64010
64068
|
************************************************************/
|
|
64011
|
-
function ac_zoom_in(gobj, event, kw, src) {
|
|
64069
|
+
function ac_zoom_in$1(gobj, event, kw, src) {
|
|
64012
64070
|
graph_zoom_in(gobj);
|
|
64013
64071
|
return 0;
|
|
64014
64072
|
}
|
|
64015
|
-
function ac_zoom_out(gobj, event, kw, src) {
|
|
64073
|
+
function ac_zoom_out$1(gobj, event, kw, src) {
|
|
64016
64074
|
graph_zoom_out(gobj);
|
|
64017
64075
|
return 0;
|
|
64018
64076
|
}
|
|
64019
|
-
function ac_zoom_reset(gobj, event, kw, src) {
|
|
64077
|
+
function ac_zoom_reset$1(gobj, event, kw, src) {
|
|
64020
64078
|
let priv = gobj.priv;
|
|
64021
64079
|
let graph = priv.graph;
|
|
64022
64080
|
if (priv.anchor_state === "on" && priv.anchor_id) after_camera(gobj, graph.zoomTo(1));
|
|
@@ -64404,7 +64462,7 @@ function ac_find_next$1(gobj, event, kw, src) {
|
|
|
64404
64462
|
graph_find_step(gobj, !!(kw && kw.back));
|
|
64405
64463
|
return 0;
|
|
64406
64464
|
}
|
|
64407
|
-
function ac_center(gobj, event, kw, src) {
|
|
64465
|
+
function ac_center$1(gobj, event, kw, src) {
|
|
64408
64466
|
graph_center(gobj);
|
|
64409
64467
|
return 0;
|
|
64410
64468
|
}
|
|
@@ -64814,17 +64872,17 @@ function create_gclass$4(gclass_name) {
|
|
|
64814
64872
|
],
|
|
64815
64873
|
[
|
|
64816
64874
|
"EV_ZOOM_IN",
|
|
64817
|
-
ac_zoom_in,
|
|
64875
|
+
ac_zoom_in$1,
|
|
64818
64876
|
null
|
|
64819
64877
|
],
|
|
64820
64878
|
[
|
|
64821
64879
|
"EV_ZOOM_OUT",
|
|
64822
|
-
ac_zoom_out,
|
|
64880
|
+
ac_zoom_out$1,
|
|
64823
64881
|
null
|
|
64824
64882
|
],
|
|
64825
64883
|
[
|
|
64826
64884
|
"EV_ZOOM_RESET",
|
|
64827
|
-
ac_zoom_reset,
|
|
64885
|
+
ac_zoom_reset$1,
|
|
64828
64886
|
null
|
|
64829
64887
|
],
|
|
64830
64888
|
[
|
|
@@ -64924,7 +64982,7 @@ function create_gclass$4(gclass_name) {
|
|
|
64924
64982
|
],
|
|
64925
64983
|
[
|
|
64926
64984
|
"EV_CENTER",
|
|
64927
|
-
ac_center,
|
|
64985
|
+
ac_center$1,
|
|
64928
64986
|
null
|
|
64929
64987
|
],
|
|
64930
64988
|
[
|
|
@@ -67640,6 +67698,12 @@ function register_c_yui_treedb_graph() {
|
|
|
67640
67698
|
* via the host-supplied `node_route`). An alternate landing to the
|
|
67641
67699
|
* topic cards, in the spirit of "every treedb is a graph".
|
|
67642
67700
|
*
|
|
67701
|
+
* The CAMERA is the family's (yui_graph_camera.js): the same
|
|
67702
|
+
* toolbar cluster -- zoom in/out, readout, fit, 1:1 -- and the
|
|
67703
|
+
* same wheel: it SCROLLS, and Ctrl + wheel zooms, over the cards
|
|
67704
|
+
* too (yui_graph_forward_wheel). This view zoomed on a bare wheel
|
|
67705
|
+
* and had no toolbar, beside graphs that did neither.
|
|
67706
|
+
*
|
|
67643
67707
|
* Copyright (c) 2026, ArtGins.
|
|
67644
67708
|
* All Rights Reserved.
|
|
67645
67709
|
***********************************************************************/
|
|
@@ -67677,19 +67741,23 @@ var attrs_table$2 = [
|
|
|
67677
67741
|
SDATA(data_type_t.DTP_STRING, "node_route", 0, "", "Hash-route template with a {topic} placeholder: a node click opens that topic (e.g. '#/topics/db/<sel>/{topic}')"),
|
|
67678
67742
|
SDATA(data_type_t.DTP_BOOLEAN, "with_node_click", 0, false, "With no `node_route`, PUBLISH a node click as EV_NODE_CLICK instead of dropping it. Opt-in, because a subscriber has to DECLARE the event: the hosts that route by hash, and the ones that want nothing, must not have it appear underneath them"),
|
|
67679
67743
|
SDATA(data_type_t.DTP_BOOLEAN, "system", 0, false, "Include system topics (__*__) too"),
|
|
67744
|
+
SDATA(data_type_t.DTP_STRING, "wide", 0, "40px", "Height of the toolbar buttons: the family's (C_YUI_TREEDB_GRAPH, C_YUI_JSON_GRAPH, C_YUI_GOBJ_TREE_JS)"),
|
|
67680
67745
|
SDATA(data_type_t.DTP_POINTER, "$container", 0, null, "Root HTML element"),
|
|
67681
67746
|
SDATA_END()
|
|
67682
67747
|
];
|
|
67683
67748
|
var PRIVATE_DATA$2 = {
|
|
67684
67749
|
$container: null,
|
|
67750
|
+
$canvas: null,
|
|
67685
67751
|
graph: null,
|
|
67686
|
-
theme_observer: null
|
|
67752
|
+
theme_observer: null,
|
|
67753
|
+
unforward_wheel: null
|
|
67687
67754
|
};
|
|
67688
67755
|
var __gclass__$2 = null;
|
|
67689
67756
|
/******************************
|
|
67690
67757
|
* Framework Methods
|
|
67691
67758
|
******************************/
|
|
67692
67759
|
function mt_create$2(gobj) {
|
|
67760
|
+
ensure_pinch_zoom_patch();
|
|
67693
67761
|
build_ui$2(gobj);
|
|
67694
67762
|
let subscriber = gobj_read_pointer_attr(gobj, "subscriber");
|
|
67695
67763
|
if (!subscriber) subscriber = gobj_parent(gobj);
|
|
@@ -67719,13 +67787,47 @@ function mt_destroy$2(gobj) {
|
|
|
67719
67787
|
* Build UI
|
|
67720
67788
|
************************************************************/
|
|
67721
67789
|
function build_ui$2(gobj) {
|
|
67790
|
+
let priv = gobj.priv;
|
|
67791
|
+
const $toolbar = yui_toolbar({}, [
|
|
67792
|
+
[
|
|
67793
|
+
"div",
|
|
67794
|
+
{ class: "yui-horizontal-toolbar-section left" },
|
|
67795
|
+
[]
|
|
67796
|
+
],
|
|
67797
|
+
[
|
|
67798
|
+
"div",
|
|
67799
|
+
{ class: "yui-horizontal-toolbar-section center" },
|
|
67800
|
+
yui_graph_camera_items(gobj, null, gobj_read_str_attr(gobj, "wide"))
|
|
67801
|
+
],
|
|
67802
|
+
[
|
|
67803
|
+
"div",
|
|
67804
|
+
{ class: "yui-horizontal-toolbar-section right" },
|
|
67805
|
+
[]
|
|
67806
|
+
]
|
|
67807
|
+
]);
|
|
67808
|
+
refresh_language($toolbar, t);
|
|
67809
|
+
priv.$canvas = createElement2([
|
|
67810
|
+
"div",
|
|
67811
|
+
{
|
|
67812
|
+
class: "TREEDB_SCHEMA_CANVAS",
|
|
67813
|
+
style: "position:relative; flex:1 1 auto; min-height:0;"
|
|
67814
|
+
},
|
|
67815
|
+
[]
|
|
67816
|
+
]);
|
|
67722
67817
|
let $container = createElement2([
|
|
67723
67818
|
"div",
|
|
67724
67819
|
{
|
|
67725
67820
|
class: "C_YUI_TREEDB_SCHEMA TREEDB_SCHEMA_VIEW",
|
|
67726
|
-
style: "position:relative; height:100%; min-height:0;"
|
|
67821
|
+
style: "position:relative; height:100%; min-height:0; display:flex; flex-direction:column;"
|
|
67727
67822
|
},
|
|
67728
|
-
[
|
|
67823
|
+
[[
|
|
67824
|
+
"div",
|
|
67825
|
+
{
|
|
67826
|
+
class: "TREEDB_SCHEMA_TOOLBAR",
|
|
67827
|
+
style: "flex:0 0 auto;"
|
|
67828
|
+
},
|
|
67829
|
+
[$toolbar]
|
|
67830
|
+
], priv.$canvas]
|
|
67729
67831
|
]);
|
|
67730
67832
|
gobj_write_attr(gobj, "$container", $container);
|
|
67731
67833
|
}
|
|
@@ -68019,7 +68121,10 @@ function edge_style(dark) {
|
|
|
68019
68121
|
function build_graph(gobj) {
|
|
68020
68122
|
let priv = gobj.priv;
|
|
68021
68123
|
let $container = gobj_read_attr(gobj, "$container");
|
|
68022
|
-
if (!$container)
|
|
68124
|
+
if (!$container || !priv.$canvas) {
|
|
68125
|
+
log_error(`${gobj_short_name(gobj)}: no UI to draw the schema in`);
|
|
68126
|
+
return;
|
|
68127
|
+
}
|
|
68023
68128
|
destroy_graph(gobj);
|
|
68024
68129
|
let data = schema_to_graph(gobj);
|
|
68025
68130
|
if (data.nodes.length === 0) {
|
|
@@ -68031,15 +68136,16 @@ function build_graph(gobj) {
|
|
|
68031
68136
|
},
|
|
68032
68137
|
t("no topics", { defaultValue: "No topics" })
|
|
68033
68138
|
]);
|
|
68034
|
-
|
|
68139
|
+
priv.$canvas.appendChild($empty);
|
|
68035
68140
|
return;
|
|
68036
68141
|
}
|
|
68037
68142
|
let dark = yui_is_dark();
|
|
68038
68143
|
let graph;
|
|
68039
68144
|
try {
|
|
68040
68145
|
graph = new Graph({
|
|
68041
|
-
container:
|
|
68146
|
+
container: priv.$canvas,
|
|
68042
68147
|
autoResize: true,
|
|
68148
|
+
animation: false,
|
|
68043
68149
|
data,
|
|
68044
68150
|
edge: { style: edge_style(dark) },
|
|
68045
68151
|
layout: {
|
|
@@ -68049,8 +68155,8 @@ function build_graph(gobj) {
|
|
|
68049
68155
|
ranksep: 90
|
|
68050
68156
|
},
|
|
68051
68157
|
behaviors: [
|
|
68052
|
-
"zoom-canvas",
|
|
68053
68158
|
"drag-canvas",
|
|
68159
|
+
...yui_graph_camera_behaviors(),
|
|
68054
68160
|
"drag-element"
|
|
68055
68161
|
]
|
|
68056
68162
|
});
|
|
@@ -68060,11 +68166,17 @@ function build_graph(gobj) {
|
|
|
68060
68166
|
}
|
|
68061
68167
|
priv.graph = graph;
|
|
68062
68168
|
graph.setTheme(dark ? "dark" : "light");
|
|
68169
|
+
graph.on("aftertransform", () => {
|
|
68170
|
+
yui_graph_update_zoom($container, priv.graph);
|
|
68171
|
+
});
|
|
68172
|
+
priv.unforward_wheel = yui_graph_forward_wheel(graph, priv.$canvas);
|
|
68063
68173
|
graph.on(NodeEvent.CLICK, (evt) => {
|
|
68064
68174
|
let node_id = evt && evt.target && evt.target.id;
|
|
68065
68175
|
gobj_send_event(gobj, "EV_NODE_CLICK", { node_id }, gobj);
|
|
68066
68176
|
});
|
|
68067
|
-
graph.render().
|
|
68177
|
+
graph.render().then(() => {
|
|
68178
|
+
yui_graph_update_zoom($container, priv.graph);
|
|
68179
|
+
}).catch((e) => {
|
|
68068
68180
|
log_error(`${gobj_short_name(gobj)}: schema graph render failed: ${e}`);
|
|
68069
68181
|
});
|
|
68070
68182
|
}
|
|
@@ -68073,14 +68185,17 @@ function build_graph(gobj) {
|
|
|
68073
68185
|
************************************************************/
|
|
68074
68186
|
function destroy_graph(gobj) {
|
|
68075
68187
|
let priv = gobj.priv;
|
|
68188
|
+
if (priv.unforward_wheel) {
|
|
68189
|
+
priv.unforward_wheel();
|
|
68190
|
+
priv.unforward_wheel = null;
|
|
68191
|
+
}
|
|
68076
68192
|
if (priv.graph) {
|
|
68077
68193
|
try {
|
|
68078
68194
|
priv.graph.destroy();
|
|
68079
68195
|
} catch (e) {}
|
|
68080
68196
|
priv.graph = null;
|
|
68081
68197
|
}
|
|
68082
|
-
|
|
68083
|
-
if ($container) while ($container.firstChild) $container.removeChild($container.firstChild);
|
|
68198
|
+
if (priv.$canvas) while (priv.$canvas.firstChild) priv.$canvas.removeChild(priv.$canvas.firstChild);
|
|
68084
68199
|
}
|
|
68085
68200
|
/***************************
|
|
68086
68201
|
* Actions
|
|
@@ -68170,6 +68285,38 @@ function ac_theme(gobj, event, kw, src) {
|
|
|
68170
68285
|
return 0;
|
|
68171
68286
|
}
|
|
68172
68287
|
/************************************************************
|
|
68288
|
+
* The camera, from the toolbar. Same moves as the family's
|
|
68289
|
+
* (C_YUI_GOBJ_TREE_JS): +/- 20%, fit, and actual size at the
|
|
68290
|
+
* layout's origin.
|
|
68291
|
+
************************************************************/
|
|
68292
|
+
function camera_move(gobj, what, promise) {
|
|
68293
|
+
Promise.resolve(promise).then(() => {
|
|
68294
|
+
yui_graph_update_zoom(gobj_read_attr(gobj, "$container"), gobj.priv.graph);
|
|
68295
|
+
}).catch((e) => {
|
|
68296
|
+
log_error(`${gobj_short_name(gobj)}: schema graph ${what} failed: ${e}`);
|
|
68297
|
+
});
|
|
68298
|
+
}
|
|
68299
|
+
function ac_zoom_in(gobj, event, kw, src) {
|
|
68300
|
+
let graph = gobj.priv.graph;
|
|
68301
|
+
if (graph) camera_move(gobj, "zoom in", graph.zoomTo(graph.getZoom() * 1.2));
|
|
68302
|
+
return 0;
|
|
68303
|
+
}
|
|
68304
|
+
function ac_zoom_out(gobj, event, kw, src) {
|
|
68305
|
+
let graph = gobj.priv.graph;
|
|
68306
|
+
if (graph) camera_move(gobj, "zoom out", graph.zoomTo(graph.getZoom() * .8));
|
|
68307
|
+
return 0;
|
|
68308
|
+
}
|
|
68309
|
+
function ac_zoom_reset(gobj, event, kw, src) {
|
|
68310
|
+
let graph = gobj.priv.graph;
|
|
68311
|
+
if (graph && graph.rendered) camera_move(gobj, "actual size", Promise.resolve(graph.zoomTo(1)).then(() => graph.translateTo([0, 0])));
|
|
68312
|
+
return 0;
|
|
68313
|
+
}
|
|
68314
|
+
function ac_center(gobj, event, kw, src) {
|
|
68315
|
+
let graph = gobj.priv.graph;
|
|
68316
|
+
if (graph) camera_move(gobj, "fit", graph.fitView());
|
|
68317
|
+
return 0;
|
|
68318
|
+
}
|
|
68319
|
+
/************************************************************
|
|
68173
68320
|
* Rebuild from a fresh schema (descs arrived / changed).
|
|
68174
68321
|
************************************************************/
|
|
68175
68322
|
function ac_rebuild(gobj, event, kw, src) {
|
|
@@ -68211,13 +68358,37 @@ function create_gclass$2(gclass_name) {
|
|
|
68211
68358
|
"EV_REBUILD",
|
|
68212
68359
|
ac_rebuild,
|
|
68213
68360
|
null
|
|
68361
|
+
],
|
|
68362
|
+
[
|
|
68363
|
+
"EV_ZOOM_IN",
|
|
68364
|
+
ac_zoom_in,
|
|
68365
|
+
null
|
|
68366
|
+
],
|
|
68367
|
+
[
|
|
68368
|
+
"EV_ZOOM_OUT",
|
|
68369
|
+
ac_zoom_out,
|
|
68370
|
+
null
|
|
68371
|
+
],
|
|
68372
|
+
[
|
|
68373
|
+
"EV_ZOOM_RESET",
|
|
68374
|
+
ac_zoom_reset,
|
|
68375
|
+
null
|
|
68376
|
+
],
|
|
68377
|
+
[
|
|
68378
|
+
"EV_CENTER",
|
|
68379
|
+
ac_center,
|
|
68380
|
+
null
|
|
68214
68381
|
]
|
|
68215
68382
|
]]];
|
|
68216
68383
|
const event_types = [
|
|
68217
68384
|
["EV_NODE_CLICK", event_flag_t.EVF_OUTPUT_EVENT | event_flag_t.EVF_NO_WARN_SUBS],
|
|
68218
68385
|
["EV_SHOW", 0],
|
|
68219
68386
|
["EV_THEME", 0],
|
|
68220
|
-
["EV_REBUILD", 0]
|
|
68387
|
+
["EV_REBUILD", 0],
|
|
68388
|
+
["EV_ZOOM_IN", 0],
|
|
68389
|
+
["EV_ZOOM_OUT", 0],
|
|
68390
|
+
["EV_ZOOM_RESET", 0],
|
|
68391
|
+
["EV_CENTER", 0]
|
|
68221
68392
|
];
|
|
68222
68393
|
__gclass__$2 = gclass_create(gclass_name, event_types, states, gmt$2, 0, attrs_table$2, PRIVATE_DATA$2, 0, 0, 0, 0);
|
|
68223
68394
|
if (!__gclass__$2) return -1;
|