@yuneta/gobj-ui 6.3.0 → 6.3.1

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.
@@ -20224,11 +20224,7 @@ function build_graph$1(gobj) {
20224
20224
  let node_id = evt && evt.target && evt.target.id;
20225
20225
  (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_NODE_CLICK", { node_id }, gobj);
20226
20226
  });
20227
- graph.render().then(() => {
20228
- try {
20229
- graph.fitView();
20230
- } catch (e) {}
20231
- }).catch((e) => {
20227
+ graph.render().catch((e) => {
20232
20228
  (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: schema graph render failed: ${e}`);
20233
20229
  });
20234
20230
  }
@@ -20282,8 +20278,10 @@ function ac_node_click$2(gobj, event, kw, src) {
20282
20278
  return 0;
20283
20279
  }
20284
20280
  /************************************************************
20285
- * Shown by the host: (re)fit the view now the container is
20286
- * visible and sized (G6 renders at 0×0 while display:none).
20281
+ * Shown by the host: match the canvas to the container now it
20282
+ * is visible and sized (G6 renders at 0×0 while display:none).
20283
+ * A resize only, never a fit: the camera stays where it was, so
20284
+ * the diagram keeps its scale and the user's pan/zoom.
20287
20285
  ************************************************************/
20288
20286
  function ac_show$2(gobj, event, kw, src) {
20289
20287
  let priv = gobj.priv;
@@ -20292,7 +20290,7 @@ function ac_show$2(gobj, event, kw, src) {
20292
20290
  return 0;
20293
20291
  }
20294
20292
  try {
20295
- priv.graph.fitView();
20293
+ priv.graph.resize();
20296
20294
  } catch (e) {}
20297
20295
  return 0;
20298
20296
  }
@@ -20211,11 +20211,7 @@ function build_graph$1(gobj) {
20211
20211
  let node_id = evt && evt.target && evt.target.id;
20212
20212
  gobj_send_event(gobj, "EV_NODE_CLICK", { node_id }, gobj);
20213
20213
  });
20214
- graph.render().then(() => {
20215
- try {
20216
- graph.fitView();
20217
- } catch (e) {}
20218
- }).catch((e) => {
20214
+ graph.render().catch((e) => {
20219
20215
  log_error(`${gobj_short_name(gobj)}: schema graph render failed: ${e}`);
20220
20216
  });
20221
20217
  }
@@ -20269,8 +20265,10 @@ function ac_node_click$2(gobj, event, kw, src) {
20269
20265
  return 0;
20270
20266
  }
20271
20267
  /************************************************************
20272
- * Shown by the host: (re)fit the view now the container is
20273
- * visible and sized (G6 renders at 0×0 while display:none).
20268
+ * Shown by the host: match the canvas to the container now it
20269
+ * is visible and sized (G6 renders at 0×0 while display:none).
20270
+ * A resize only, never a fit: the camera stays where it was, so
20271
+ * the diagram keeps its scale and the user's pan/zoom.
20274
20272
  ************************************************************/
20275
20273
  function ac_show$2(gobj, event, kw, src) {
20276
20274
  let priv = gobj.priv;
@@ -20279,7 +20277,7 @@ function ac_show$2(gobj, event, kw, src) {
20279
20277
  return 0;
20280
20278
  }
20281
20279
  try {
20282
- priv.graph.fitView();
20280
+ priv.graph.resize();
20283
20281
  } catch (e) {}
20284
20282
  return 0;
20285
20283
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "6.3.0",
3
+ "version": "6.3.1",
4
4
  "type": "module",
5
5
  "main": "dist/gobj-ui.cjs.js",
6
6
  "module": "dist/gobj-ui.es.js",
@@ -574,13 +574,10 @@ function build_graph(gobj)
574
574
  gobj_send_event(gobj, "EV_NODE_CLICK", {node_id: node_id}, gobj);
575
575
  });
576
576
 
577
- graph.render().then(() => {
578
- try {
579
- graph.fitView();
580
- } catch(e) {
581
- // best-effort centring
582
- }
583
- }).catch((e) => {
577
+ /* No fitView: the diagram is drawn at its own scale and stays there.
578
+ * Zooming it to the container the moment it appears rewrites the size
579
+ * the reader just saw, and does it differently for every treedb. */
580
+ graph.render().catch((e) => {
584
581
  log_error(`${gobj_short_name(gobj)}: schema graph render failed: ${e}`);
585
582
  });
586
583
  }
@@ -659,8 +656,10 @@ function ac_node_click(gobj, event, kw, src)
659
656
  }
660
657
 
661
658
  /************************************************************
662
- * Shown by the host: (re)fit the view now the container is
663
- * visible and sized (G6 renders at 0×0 while display:none).
659
+ * Shown by the host: match the canvas to the container now it
660
+ * is visible and sized (G6 renders at 0×0 while display:none).
661
+ * A resize only, never a fit: the camera stays where it was, so
662
+ * the diagram keeps its scale and the user's pan/zoom.
664
663
  ************************************************************/
665
664
  function ac_show(gobj, event, kw, src)
666
665
  {
@@ -670,7 +669,7 @@ function ac_show(gobj, event, kw, src)
670
669
  return 0;
671
670
  }
672
671
  try {
673
- priv.graph.fitView();
672
+ priv.graph.resize();
674
673
  } catch(e) {
675
674
  // best-effort
676
675
  }