@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 CHANGED
@@ -925,6 +925,30 @@ so it survived that — two light islands over a dark canvas.
925
925
  (all tooltips, so a host that has not defined them shows the key on hover and
926
926
  nothing else breaks).
927
927
 
928
+ ### The wheel over HTML nodes: `yui_graph_forward_wheel`
929
+
930
+ G6's HTML nodes are drawn in a DOM layer **beside** the canvas element, and
931
+ they pass on six pointer events and not the wheel. `scroll-canvas` listens on
932
+ the canvas element and `zoom-canvas` reads G's wheel, which comes from that
933
+ same element. So a wheel over an HTML card reaches neither: the graph does not
934
+ scroll and does not zoom.
935
+
936
+ `yui_graph_forward_wheel(graph, $host)` catches the wheel on the element G6 was
937
+ mounted in and dispatches it again on the canvas element, with its deltas, its
938
+ position and its modifiers. Both behaviors then take it as a wheel over empty
939
+ canvas. It returns the function that removes the listener; call it before the
940
+ graph is destroyed.
941
+
942
+ ```js
943
+ priv.unforward_wheel = yui_graph_forward_wheel(graph, priv.$canvas);
944
+ // ... in the teardown, before graph.destroy():
945
+ priv.unforward_wheel();
946
+ ```
947
+
948
+ An element that must scroll by itself inside the graph (a popover) stops the
949
+ wheel with `stopPropagation()` before it reaches `$host`.
950
+ `C_YUI_TREEDB_SCHEMA` uses it; `C_G6_NODES_TREE` does not yet.
951
+
928
952
  ### The anchor: one element the camera holds
929
953
 
930
954
  The same crosshairs button is in all three graphs' toolbars, drawn once in
@@ -1797,6 +1821,17 @@ schema question; that one answers the data question.
1797
1821
  The demo `test-app/schema.html` mounts it alone against the real yuneta agent
1798
1822
  schema, so the drawing can be held against the ASCII one in its `.c`.
1799
1823
 
1824
+ **Its camera is the family's** (since `7.23.160`). It has a toolbar with the
1825
+ `yui_graph_camera.js` cluster (zoom in, zoom out, the readout, fit, `1:1`), and
1826
+ it takes the wheel the same way as the other graphs: the wheel **scrolls**,
1827
+ Ctrl + wheel zooms, and a pinch zooms on a touch screen. This is true over the
1828
+ cards too, through `yui_graph_forward_wheel()`: the cards cover most of this
1829
+ drawing, and without it the wheel worked only in the gaps. It still never fits
1830
+ itself when it appears; fit is a button. The toolbar buttons fire
1831
+ `EV_ZOOM_IN`, `EV_ZOOM_OUT`, `EV_ZOOM_RESET` and `EV_CENTER` to the view
1832
+ itself, so a host declares nothing. `wide` (default `40px`) sets the button
1833
+ height.
1834
+
1800
1835
  **Contract:**
1801
1836
 
1802
1837
  - Attributes: `subscriber`, `descs` (`{topic_name: desc}`, the schema),
@@ -11505,6 +11505,64 @@ function yui_graph_camera_behaviors() {
11505
11505
  }];
11506
11506
  }
11507
11507
  /************************************************************
11508
+ * Make the wheel work over HTML nodes too.
11509
+ *
11510
+ * G6's HTML nodes live in a DOM layer BESIDE the canvas
11511
+ * element, not in it, and they forward six pointer events and
11512
+ * not the wheel. `scroll-canvas` listens on the canvas element
11513
+ * and `zoom-canvas` reads G's own wheel event, which is fed
11514
+ * from that same element -- so a wheel over a card reaches
11515
+ * neither, and on a graph drawn with big cards the wheel only
11516
+ * works in the gaps between them.
11517
+ *
11518
+ * The wheel is caught on `$host` (the element G6 was mounted
11519
+ * in) and dispatched again ON the canvas element, carrying the
11520
+ * deltas, the position and the modifiers: both behaviors then
11521
+ * take it exactly as a wheel over empty canvas. Control is
11522
+ * read by G6 from the real keydown, which is still held.
11523
+ *
11524
+ * A wheel whose target is the canvas passes untouched, which
11525
+ * is also what keeps the re-dispatched one from looping. An
11526
+ * element that must scroll by itself (a popover) stops the
11527
+ * wheel before it gets here.
11528
+ *
11529
+ * Returns the function that removes the listener.
11530
+ ************************************************************/
11531
+ function yui_graph_forward_wheel(graph, $host) {
11532
+ if (!graph || !$host) return () => {};
11533
+ const on_wheel = (e) => {
11534
+ let dom = null;
11535
+ try {
11536
+ dom = graph.getCanvas().getContextService().getDomElement();
11537
+ } catch (err) {
11538
+ return;
11539
+ }
11540
+ if (!dom || e.target === dom) return;
11541
+ e.preventDefault();
11542
+ e.stopPropagation();
11543
+ dom.dispatchEvent(new WheelEvent("wheel", {
11544
+ deltaX: e.deltaX,
11545
+ deltaY: e.deltaY,
11546
+ deltaZ: e.deltaZ,
11547
+ deltaMode: e.deltaMode,
11548
+ clientX: e.clientX,
11549
+ clientY: e.clientY,
11550
+ screenX: e.screenX,
11551
+ screenY: e.screenY,
11552
+ ctrlKey: e.ctrlKey,
11553
+ shiftKey: e.shiftKey,
11554
+ altKey: e.altKey,
11555
+ metaKey: e.metaKey,
11556
+ bubbles: true,
11557
+ cancelable: true
11558
+ }));
11559
+ };
11560
+ $host.addEventListener("wheel", on_wheel, { passive: false });
11561
+ return () => {
11562
+ $host.removeEventListener("wheel", on_wheel);
11563
+ };
11564
+ }
11565
+ /************************************************************
11508
11566
  * The camera cluster: zoom in, zoom out, readout, fit,
11509
11567
  * actual size. Returns createElement2 specs, in order.
11510
11568
  *
@@ -13566,7 +13624,7 @@ function ac_toggle_anchor$2(gobj, event, kw, src) {
13566
13624
  /************************************************************
13567
13625
  *
13568
13626
  ************************************************************/
13569
- function ac_zoom_in$3(gobj, event, kw, src) {
13627
+ function ac_zoom_in$4(gobj, event, kw, src) {
13570
13628
  let graph = gobj.priv.graph;
13571
13629
  if (graph) {
13572
13630
  let z = graph.getZoom();
@@ -13577,7 +13635,7 @@ function ac_zoom_in$3(gobj, event, kw, src) {
13577
13635
  /************************************************************
13578
13636
  *
13579
13637
  ************************************************************/
13580
- function ac_zoom_out$3(gobj, event, kw, src) {
13638
+ function ac_zoom_out$4(gobj, event, kw, src) {
13581
13639
  let graph = gobj.priv.graph;
13582
13640
  if (graph) {
13583
13641
  let z = graph.getZoom();
@@ -13588,7 +13646,7 @@ function ac_zoom_out$3(gobj, event, kw, src) {
13588
13646
  /************************************************************
13589
13647
  *
13590
13648
  ************************************************************/
13591
- function ac_zoom_reset$3(gobj, event, kw, src) {
13649
+ function ac_zoom_reset$4(gobj, event, kw, src) {
13592
13650
  let priv = gobj.priv;
13593
13651
  let graph = priv.graph;
13594
13652
  if (graph && graph.rendered) {
@@ -13603,7 +13661,7 @@ function ac_zoom_reset$3(gobj, event, kw, src) {
13603
13661
  /************************************************************
13604
13662
  *
13605
13663
  ************************************************************/
13606
- function ac_center$3(gobj, event, kw, src) {
13664
+ function ac_center$4(gobj, event, kw, src) {
13607
13665
  let graph = gobj.priv.graph;
13608
13666
  if (graph) {
13609
13667
  graph.fitCenter();
@@ -13739,22 +13797,22 @@ function create_gclass$14(gclass_name) {
13739
13797
  ],
13740
13798
  [
13741
13799
  "EV_ZOOM_IN",
13742
- ac_zoom_in$3,
13800
+ ac_zoom_in$4,
13743
13801
  null
13744
13802
  ],
13745
13803
  [
13746
13804
  "EV_ZOOM_OUT",
13747
- ac_zoom_out$3,
13805
+ ac_zoom_out$4,
13748
13806
  null
13749
13807
  ],
13750
13808
  [
13751
13809
  "EV_ZOOM_RESET",
13752
- ac_zoom_reset$3,
13810
+ ac_zoom_reset$4,
13753
13811
  null
13754
13812
  ],
13755
13813
  [
13756
13814
  "EV_CENTER",
13757
- ac_center$3,
13815
+ ac_center$4,
13758
13816
  null
13759
13817
  ],
13760
13818
  [
@@ -16851,16 +16909,16 @@ function ac_language_changed$7(gobj, event, kw, src) {
16851
16909
  /************************************************************
16852
16910
  * The camera.
16853
16911
  ************************************************************/
16854
- function ac_zoom_in$2(gobj, event, kw, src) {
16912
+ function ac_zoom_in$3(gobj, event, kw, src) {
16855
16913
  return camera(gobj, "zoom in", (graph) => graph.zoomBy(1.2));
16856
16914
  }
16857
- function ac_zoom_out$2(gobj, event, kw, src) {
16915
+ function ac_zoom_out$3(gobj, event, kw, src) {
16858
16916
  return camera(gobj, "zoom out", (graph) => graph.zoomBy(1 / 1.2));
16859
16917
  }
16860
- function ac_zoom_reset$2(gobj, event, kw, src) {
16918
+ function ac_zoom_reset$3(gobj, event, kw, src) {
16861
16919
  return camera(gobj, "reset the zoom", (graph) => graph.zoomTo(1));
16862
16920
  }
16863
- function ac_center$2(gobj, event, kw, src) {
16921
+ function ac_center$3(gobj, event, kw, src) {
16864
16922
  return camera(gobj, "fit the graph", (graph) => fit_readable(graph));
16865
16923
  }
16866
16924
  /************************************************************
@@ -16919,22 +16977,22 @@ function create_gclass$11(gclass_name) {
16919
16977
  ],
16920
16978
  [
16921
16979
  "EV_ZOOM_IN",
16922
- ac_zoom_in$2,
16980
+ ac_zoom_in$3,
16923
16981
  null
16924
16982
  ],
16925
16983
  [
16926
16984
  "EV_ZOOM_OUT",
16927
- ac_zoom_out$2,
16985
+ ac_zoom_out$3,
16928
16986
  null
16929
16987
  ],
16930
16988
  [
16931
16989
  "EV_ZOOM_RESET",
16932
- ac_zoom_reset$2,
16990
+ ac_zoom_reset$3,
16933
16991
  null
16934
16992
  ],
16935
16993
  [
16936
16994
  "EV_CENTER",
16937
- ac_center$2,
16995
+ ac_center$3,
16938
16996
  null
16939
16997
  ],
16940
16998
  [
@@ -21042,7 +21100,7 @@ function ac_toggle_anchor$1(gobj, event, kw, src) {
21042
21100
  /************************************************************
21043
21101
  *
21044
21102
  ************************************************************/
21045
- function ac_zoom_in$1(gobj, event, kw, src) {
21103
+ function ac_zoom_in$2(gobj, event, kw, src) {
21046
21104
  let graph = gobj.priv.graph;
21047
21105
  if (graph) {
21048
21106
  let z = graph.getZoom();
@@ -21053,7 +21111,7 @@ function ac_zoom_in$1(gobj, event, kw, src) {
21053
21111
  /************************************************************
21054
21112
  *
21055
21113
  ************************************************************/
21056
- function ac_zoom_out$1(gobj, event, kw, src) {
21114
+ function ac_zoom_out$2(gobj, event, kw, src) {
21057
21115
  let graph = gobj.priv.graph;
21058
21116
  if (graph) {
21059
21117
  let z = graph.getZoom();
@@ -21064,7 +21122,7 @@ function ac_zoom_out$1(gobj, event, kw, src) {
21064
21122
  /************************************************************
21065
21123
  *
21066
21124
  ************************************************************/
21067
- function ac_zoom_reset$1(gobj, event, kw, src) {
21125
+ function ac_zoom_reset$2(gobj, event, kw, src) {
21068
21126
  let priv = gobj.priv;
21069
21127
  let graph = priv.graph;
21070
21128
  if (graph && graph.rendered) {
@@ -21079,7 +21137,7 @@ function ac_zoom_reset$1(gobj, event, kw, src) {
21079
21137
  /************************************************************
21080
21138
  *
21081
21139
  ************************************************************/
21082
- function ac_center$1(gobj, event, kw, src) {
21140
+ function ac_center$2(gobj, event, kw, src) {
21083
21141
  let graph = gobj.priv.graph;
21084
21142
  if (graph) {
21085
21143
  graph.fitCenter();
@@ -21285,22 +21343,22 @@ function create_gclass$9(gclass_name) {
21285
21343
  ],
21286
21344
  [
21287
21345
  "EV_ZOOM_IN",
21288
- ac_zoom_in$1,
21346
+ ac_zoom_in$2,
21289
21347
  null
21290
21348
  ],
21291
21349
  [
21292
21350
  "EV_ZOOM_OUT",
21293
- ac_zoom_out$1,
21351
+ ac_zoom_out$2,
21294
21352
  null
21295
21353
  ],
21296
21354
  [
21297
21355
  "EV_ZOOM_RESET",
21298
- ac_zoom_reset$1,
21356
+ ac_zoom_reset$2,
21299
21357
  null
21300
21358
  ],
21301
21359
  [
21302
21360
  "EV_CENTER",
21303
- ac_center$1,
21361
+ ac_center$2,
21304
21362
  null
21305
21363
  ],
21306
21364
  [
@@ -64013,15 +64071,15 @@ function ac_theme$1(gobj, event, kw, src) {
64013
64071
  /************************************************************
64014
64072
  * Zoom controls
64015
64073
  ************************************************************/
64016
- function ac_zoom_in(gobj, event, kw, src) {
64074
+ function ac_zoom_in$1(gobj, event, kw, src) {
64017
64075
  graph_zoom_in(gobj);
64018
64076
  return 0;
64019
64077
  }
64020
- function ac_zoom_out(gobj, event, kw, src) {
64078
+ function ac_zoom_out$1(gobj, event, kw, src) {
64021
64079
  graph_zoom_out(gobj);
64022
64080
  return 0;
64023
64081
  }
64024
- function ac_zoom_reset(gobj, event, kw, src) {
64082
+ function ac_zoom_reset$1(gobj, event, kw, src) {
64025
64083
  let priv = gobj.priv;
64026
64084
  let graph = priv.graph;
64027
64085
  if (priv.anchor_state === "on" && priv.anchor_id) after_camera(gobj, graph.zoomTo(1));
@@ -64409,7 +64467,7 @@ function ac_find_next$1(gobj, event, kw, src) {
64409
64467
  graph_find_step(gobj, !!(kw && kw.back));
64410
64468
  return 0;
64411
64469
  }
64412
- function ac_center(gobj, event, kw, src) {
64470
+ function ac_center$1(gobj, event, kw, src) {
64413
64471
  graph_center(gobj);
64414
64472
  return 0;
64415
64473
  }
@@ -64819,17 +64877,17 @@ function create_gclass$4(gclass_name) {
64819
64877
  ],
64820
64878
  [
64821
64879
  "EV_ZOOM_IN",
64822
- ac_zoom_in,
64880
+ ac_zoom_in$1,
64823
64881
  null
64824
64882
  ],
64825
64883
  [
64826
64884
  "EV_ZOOM_OUT",
64827
- ac_zoom_out,
64885
+ ac_zoom_out$1,
64828
64886
  null
64829
64887
  ],
64830
64888
  [
64831
64889
  "EV_ZOOM_RESET",
64832
- ac_zoom_reset,
64890
+ ac_zoom_reset$1,
64833
64891
  null
64834
64892
  ],
64835
64893
  [
@@ -64929,7 +64987,7 @@ function create_gclass$4(gclass_name) {
64929
64987
  ],
64930
64988
  [
64931
64989
  "EV_CENTER",
64932
- ac_center,
64990
+ ac_center$1,
64933
64991
  null
64934
64992
  ],
64935
64993
  [
@@ -67645,6 +67703,12 @@ function register_c_yui_treedb_graph() {
67645
67703
  * via the host-supplied `node_route`). An alternate landing to the
67646
67704
  * topic cards, in the spirit of "every treedb is a graph".
67647
67705
  *
67706
+ * The CAMERA is the family's (yui_graph_camera.js): the same
67707
+ * toolbar cluster -- zoom in/out, readout, fit, 1:1 -- and the
67708
+ * same wheel: it SCROLLS, and Ctrl + wheel zooms, over the cards
67709
+ * too (yui_graph_forward_wheel). This view zoomed on a bare wheel
67710
+ * and had no toolbar, beside graphs that did neither.
67711
+ *
67648
67712
  * Copyright (c) 2026, ArtGins.
67649
67713
  * All Rights Reserved.
67650
67714
  ***********************************************************************/
@@ -67682,19 +67746,23 @@ var attrs_table$2 = [
67682
67746
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.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}')"),
67683
67747
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.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"),
67684
67748
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "system", 0, false, "Include system topics (__*__) too"),
67749
+ (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.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)"),
67685
67750
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_POINTER, "$container", 0, null, "Root HTML element"),
67686
67751
  (0, _yuneta_gobj_js.SDATA_END)()
67687
67752
  ];
67688
67753
  var PRIVATE_DATA$2 = {
67689
67754
  $container: null,
67755
+ $canvas: null,
67690
67756
  graph: null,
67691
- theme_observer: null
67757
+ theme_observer: null,
67758
+ unforward_wheel: null
67692
67759
  };
67693
67760
  var __gclass__$2 = null;
67694
67761
  /******************************
67695
67762
  * Framework Methods
67696
67763
  ******************************/
67697
67764
  function mt_create$2(gobj) {
67765
+ ensure_pinch_zoom_patch();
67698
67766
  build_ui$2(gobj);
67699
67767
  let subscriber = (0, _yuneta_gobj_js.gobj_read_pointer_attr)(gobj, "subscriber");
67700
67768
  if (!subscriber) subscriber = (0, _yuneta_gobj_js.gobj_parent)(gobj);
@@ -67724,13 +67792,47 @@ function mt_destroy$2(gobj) {
67724
67792
  * Build UI
67725
67793
  ************************************************************/
67726
67794
  function build_ui$2(gobj) {
67795
+ let priv = gobj.priv;
67796
+ const $toolbar = yui_toolbar({}, [
67797
+ [
67798
+ "div",
67799
+ { class: "yui-horizontal-toolbar-section left" },
67800
+ []
67801
+ ],
67802
+ [
67803
+ "div",
67804
+ { class: "yui-horizontal-toolbar-section center" },
67805
+ yui_graph_camera_items(gobj, null, (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "wide"))
67806
+ ],
67807
+ [
67808
+ "div",
67809
+ { class: "yui-horizontal-toolbar-section right" },
67810
+ []
67811
+ ]
67812
+ ]);
67813
+ (0, _yuneta_gobj_js.refresh_language)($toolbar, i18next.t);
67814
+ priv.$canvas = (0, _yuneta_gobj_js.createElement2)([
67815
+ "div",
67816
+ {
67817
+ class: "TREEDB_SCHEMA_CANVAS",
67818
+ style: "position:relative; flex:1 1 auto; min-height:0;"
67819
+ },
67820
+ []
67821
+ ]);
67727
67822
  let $container = (0, _yuneta_gobj_js.createElement2)([
67728
67823
  "div",
67729
67824
  {
67730
67825
  class: "C_YUI_TREEDB_SCHEMA TREEDB_SCHEMA_VIEW",
67731
- style: "position:relative; height:100%; min-height:0;"
67826
+ style: "position:relative; height:100%; min-height:0; display:flex; flex-direction:column;"
67732
67827
  },
67733
- []
67828
+ [[
67829
+ "div",
67830
+ {
67831
+ class: "TREEDB_SCHEMA_TOOLBAR",
67832
+ style: "flex:0 0 auto;"
67833
+ },
67834
+ [$toolbar]
67835
+ ], priv.$canvas]
67734
67836
  ]);
67735
67837
  (0, _yuneta_gobj_js.gobj_write_attr)(gobj, "$container", $container);
67736
67838
  }
@@ -68024,7 +68126,10 @@ function edge_style(dark) {
68024
68126
  function build_graph(gobj) {
68025
68127
  let priv = gobj.priv;
68026
68128
  let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
68027
- if (!$container) return;
68129
+ if (!$container || !priv.$canvas) {
68130
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: no UI to draw the schema in`);
68131
+ return;
68132
+ }
68028
68133
  destroy_graph(gobj);
68029
68134
  let data = schema_to_graph(gobj);
68030
68135
  if (data.nodes.length === 0) {
@@ -68036,15 +68141,16 @@ function build_graph(gobj) {
68036
68141
  },
68037
68142
  (0, i18next.t)("no topics", { defaultValue: "No topics" })
68038
68143
  ]);
68039
- $container.appendChild($empty);
68144
+ priv.$canvas.appendChild($empty);
68040
68145
  return;
68041
68146
  }
68042
68147
  let dark = yui_is_dark();
68043
68148
  let graph;
68044
68149
  try {
68045
68150
  graph = new _antv_g6.Graph({
68046
- container: $container,
68151
+ container: priv.$canvas,
68047
68152
  autoResize: true,
68153
+ animation: false,
68048
68154
  data,
68049
68155
  edge: { style: edge_style(dark) },
68050
68156
  layout: {
@@ -68054,8 +68160,8 @@ function build_graph(gobj) {
68054
68160
  ranksep: 90
68055
68161
  },
68056
68162
  behaviors: [
68057
- "zoom-canvas",
68058
68163
  "drag-canvas",
68164
+ ...yui_graph_camera_behaviors(),
68059
68165
  "drag-element"
68060
68166
  ]
68061
68167
  });
@@ -68065,11 +68171,17 @@ function build_graph(gobj) {
68065
68171
  }
68066
68172
  priv.graph = graph;
68067
68173
  graph.setTheme(dark ? "dark" : "light");
68174
+ graph.on("aftertransform", () => {
68175
+ yui_graph_update_zoom($container, priv.graph);
68176
+ });
68177
+ priv.unforward_wheel = yui_graph_forward_wheel(graph, priv.$canvas);
68068
68178
  graph.on(_antv_g6.NodeEvent.CLICK, (evt) => {
68069
68179
  let node_id = evt && evt.target && evt.target.id;
68070
68180
  (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_NODE_CLICK", { node_id }, gobj);
68071
68181
  });
68072
- graph.render().catch((e) => {
68182
+ graph.render().then(() => {
68183
+ yui_graph_update_zoom($container, priv.graph);
68184
+ }).catch((e) => {
68073
68185
  (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: schema graph render failed: ${e}`);
68074
68186
  });
68075
68187
  }
@@ -68078,14 +68190,17 @@ function build_graph(gobj) {
68078
68190
  ************************************************************/
68079
68191
  function destroy_graph(gobj) {
68080
68192
  let priv = gobj.priv;
68193
+ if (priv.unforward_wheel) {
68194
+ priv.unforward_wheel();
68195
+ priv.unforward_wheel = null;
68196
+ }
68081
68197
  if (priv.graph) {
68082
68198
  try {
68083
68199
  priv.graph.destroy();
68084
68200
  } catch (e) {}
68085
68201
  priv.graph = null;
68086
68202
  }
68087
- let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
68088
- if ($container) while ($container.firstChild) $container.removeChild($container.firstChild);
68203
+ if (priv.$canvas) while (priv.$canvas.firstChild) priv.$canvas.removeChild(priv.$canvas.firstChild);
68089
68204
  }
68090
68205
  /***************************
68091
68206
  * Actions
@@ -68175,6 +68290,38 @@ function ac_theme(gobj, event, kw, src) {
68175
68290
  return 0;
68176
68291
  }
68177
68292
  /************************************************************
68293
+ * The camera, from the toolbar. Same moves as the family's
68294
+ * (C_YUI_GOBJ_TREE_JS): +/- 20%, fit, and actual size at the
68295
+ * layout's origin.
68296
+ ************************************************************/
68297
+ function camera_move(gobj, what, promise) {
68298
+ Promise.resolve(promise).then(() => {
68299
+ yui_graph_update_zoom((0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container"), gobj.priv.graph);
68300
+ }).catch((e) => {
68301
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: schema graph ${what} failed: ${e}`);
68302
+ });
68303
+ }
68304
+ function ac_zoom_in(gobj, event, kw, src) {
68305
+ let graph = gobj.priv.graph;
68306
+ if (graph) camera_move(gobj, "zoom in", graph.zoomTo(graph.getZoom() * 1.2));
68307
+ return 0;
68308
+ }
68309
+ function ac_zoom_out(gobj, event, kw, src) {
68310
+ let graph = gobj.priv.graph;
68311
+ if (graph) camera_move(gobj, "zoom out", graph.zoomTo(graph.getZoom() * .8));
68312
+ return 0;
68313
+ }
68314
+ function ac_zoom_reset(gobj, event, kw, src) {
68315
+ let graph = gobj.priv.graph;
68316
+ if (graph && graph.rendered) camera_move(gobj, "actual size", Promise.resolve(graph.zoomTo(1)).then(() => graph.translateTo([0, 0])));
68317
+ return 0;
68318
+ }
68319
+ function ac_center(gobj, event, kw, src) {
68320
+ let graph = gobj.priv.graph;
68321
+ if (graph) camera_move(gobj, "fit", graph.fitView());
68322
+ return 0;
68323
+ }
68324
+ /************************************************************
68178
68325
  * Rebuild from a fresh schema (descs arrived / changed).
68179
68326
  ************************************************************/
68180
68327
  function ac_rebuild(gobj, event, kw, src) {
@@ -68216,13 +68363,37 @@ function create_gclass$2(gclass_name) {
68216
68363
  "EV_REBUILD",
68217
68364
  ac_rebuild,
68218
68365
  null
68366
+ ],
68367
+ [
68368
+ "EV_ZOOM_IN",
68369
+ ac_zoom_in,
68370
+ null
68371
+ ],
68372
+ [
68373
+ "EV_ZOOM_OUT",
68374
+ ac_zoom_out,
68375
+ null
68376
+ ],
68377
+ [
68378
+ "EV_ZOOM_RESET",
68379
+ ac_zoom_reset,
68380
+ null
68381
+ ],
68382
+ [
68383
+ "EV_CENTER",
68384
+ ac_center,
68385
+ null
68219
68386
  ]
68220
68387
  ]]];
68221
68388
  const event_types = [
68222
68389
  ["EV_NODE_CLICK", _yuneta_gobj_js.event_flag_t.EVF_OUTPUT_EVENT | _yuneta_gobj_js.event_flag_t.EVF_NO_WARN_SUBS],
68223
68390
  ["EV_SHOW", 0],
68224
68391
  ["EV_THEME", 0],
68225
- ["EV_REBUILD", 0]
68392
+ ["EV_REBUILD", 0],
68393
+ ["EV_ZOOM_IN", 0],
68394
+ ["EV_ZOOM_OUT", 0],
68395
+ ["EV_ZOOM_RESET", 0],
68396
+ ["EV_CENTER", 0]
68226
68397
  ];
68227
68398
  __gclass__$2 = (0, _yuneta_gobj_js.gclass_create)(gclass_name, event_types, states, gmt$2, 0, attrs_table$2, PRIVATE_DATA$2, 0, 0, 0, 0);
68228
68399
  if (!__gclass__$2) return -1;