@yuneta/gobj-ui 7.23.77 → 7.23.79

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
@@ -1250,7 +1250,12 @@ a level or two, with a count on every cut.
1250
1250
  - **The toolbar's fold pair** (the same two chevrons as the JSON graph):
1251
1251
  *expand all* opens every hook on all its children — the reader asking for
1252
1252
  the pile on purpose — and *collapse all* leaves the roots. *Refresh* is the
1253
- way back to the default depth.
1253
+ way back to the default depth. **Neither moves the zoom** (since `7.23.78`):
1254
+ a fold is not a reason to change the scale the reader chose, and until then
1255
+ both fitted the whole graph — opening everything zoomed out to a strip and
1256
+ closing it zoomed in on the roots, every time. The camera holds the anchor
1257
+ still when there is one, else the first root: the top of the tree, which is
1258
+ where a JSON viewer keeps the eye when it opens or closes everything.
1254
1259
  - **`dagre` reads LEFT TO RIGHT** now, with explicit `nodesep`/`ranksep`: the
1255
1260
  children of a node are a column beside it and the graph reads like a file
1256
1261
  tree. The ports move to the sides with it (fkeys on the left edge, hooks
@@ -1365,8 +1370,8 @@ it. The node holds still on screen while the rest makes room, as a fold does.
1365
1370
  A change of the global mode forgets these exceptions. Consumer i18n keys:
1366
1371
  `closed nodes`, `node labels`, `open node`, `close node`.
1367
1372
 
1368
- The ports of an open card grew with this (radius 10 on a card, 5 on a chip,
1369
- 2 px stroke): they are what a link is drawn from and what a resize takes hold
1373
+ The ports of an open card grew with this (radius 14 on a card, 8 on a chip
1374
+ since `7.23.79`; 10 / 5 in `7.23.75`, 2 px stroke): they are what a link is drawn from and what a resize takes hold
1370
1375
  of, and at radius 6 with a hairline nobody could tell they were either.
1371
1376
 
1372
1377
  ### The legend is the graph's layer control
@@ -54527,8 +54527,8 @@ var GCLASS_NAME$4 = "C_G6_NODES_TREE";
54527
54527
  var HIGHLIGHT_COLOR = "#f0a020";
54528
54528
  var HIGHLIGHT_HALO = "rgba(240,160,32,0.35)";
54529
54529
  var SELECT_RING = "rgba(59,130,246,0.95)";
54530
- var PORT_R_ENTITY = 10;
54531
- var PORT_R_CHILD = 5;
54530
+ var PORT_R_ENTITY = 14;
54531
+ var PORT_R_CHILD = 8;
54532
54532
  var PORT_LINE_WIDTH = 2;
54533
54533
  var COMPACT_SIZE = {
54534
54534
  hierarchical: 32,
@@ -60275,11 +60275,36 @@ function ac_expand_all$1(gobj, event, kw, src) {
60275
60275
  (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: expand all with no tree loaded`);
60276
60276
  return -1;
60277
60277
  }
60278
+ let keep = fold_keep_node(gobj);
60279
+ let vp = yui_graph_viewport_of(priv.graph, keep);
60278
60280
  fold_expand_all(priv._fold_model, priv._fold_state);
60279
- reconcile_fold(gobj, { fit: true });
60281
+ reconcile_fold(gobj, {
60282
+ keep,
60283
+ keep_vp: vp
60284
+ });
60280
60285
  return 0;
60281
60286
  }
60282
60287
  /************************************************************
60288
+ * The node the camera holds still across a GLOBAL fold: the
60289
+ * anchor when there is one, else the first root -- the top of
60290
+ * the tree, which is where a JSON viewer keeps the eye when it
60291
+ * opens or closes everything. The zoom does not move either way:
60292
+ * a fold is not a reason to change the scale the reader chose,
60293
+ * and until 7.23.78 both buttons fitted the whole graph, so
60294
+ * opening everything zoomed out to a strip and closing it zoomed
60295
+ * in on the roots, every time.
60296
+ ************************************************************/
60297
+ function fold_keep_node(gobj) {
60298
+ let priv = gobj.priv;
60299
+ if (priv.anchor_state === "on" && priv.anchor_id) return priv.anchor_id;
60300
+ let model = priv._fold_model;
60301
+ for (let topic_name of model.topics) {
60302
+ let roots = model.groups.get(fold_root_group_key(topic_name)) || [];
60303
+ if (roots.length) return node_id_of_key(gobj, roots[0]);
60304
+ }
60305
+ return "";
60306
+ }
60307
+ /************************************************************
60283
60308
  * The roots alone.
60284
60309
  ************************************************************/
60285
60310
  function ac_collapse_all$1(gobj, event, kw, src) {
@@ -60288,8 +60313,13 @@ function ac_collapse_all$1(gobj, event, kw, src) {
60288
60313
  (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: collapse all with no tree loaded`);
60289
60314
  return -1;
60290
60315
  }
60316
+ let keep = fold_keep_node(gobj);
60317
+ let vp = yui_graph_viewport_of(priv.graph, keep);
60291
60318
  fold_collapse_all(priv._fold_model, priv._fold_state);
60292
- reconcile_fold(gobj, { fit: true });
60319
+ reconcile_fold(gobj, {
60320
+ keep,
60321
+ keep_vp: vp
60322
+ });
60293
60323
  return 0;
60294
60324
  }
60295
60325
  /************************************************************
@@ -54522,8 +54522,8 @@ var GCLASS_NAME$4 = "C_G6_NODES_TREE";
54522
54522
  var HIGHLIGHT_COLOR = "#f0a020";
54523
54523
  var HIGHLIGHT_HALO = "rgba(240,160,32,0.35)";
54524
54524
  var SELECT_RING = "rgba(59,130,246,0.95)";
54525
- var PORT_R_ENTITY = 10;
54526
- var PORT_R_CHILD = 5;
54525
+ var PORT_R_ENTITY = 14;
54526
+ var PORT_R_CHILD = 8;
54527
54527
  var PORT_LINE_WIDTH = 2;
54528
54528
  var COMPACT_SIZE = {
54529
54529
  hierarchical: 32,
@@ -60270,11 +60270,36 @@ function ac_expand_all$1(gobj, event, kw, src) {
60270
60270
  log_error(`${gobj_short_name(gobj)}: expand all with no tree loaded`);
60271
60271
  return -1;
60272
60272
  }
60273
+ let keep = fold_keep_node(gobj);
60274
+ let vp = yui_graph_viewport_of(priv.graph, keep);
60273
60275
  fold_expand_all(priv._fold_model, priv._fold_state);
60274
- reconcile_fold(gobj, { fit: true });
60276
+ reconcile_fold(gobj, {
60277
+ keep,
60278
+ keep_vp: vp
60279
+ });
60275
60280
  return 0;
60276
60281
  }
60277
60282
  /************************************************************
60283
+ * The node the camera holds still across a GLOBAL fold: the
60284
+ * anchor when there is one, else the first root -- the top of
60285
+ * the tree, which is where a JSON viewer keeps the eye when it
60286
+ * opens or closes everything. The zoom does not move either way:
60287
+ * a fold is not a reason to change the scale the reader chose,
60288
+ * and until 7.23.78 both buttons fitted the whole graph, so
60289
+ * opening everything zoomed out to a strip and closing it zoomed
60290
+ * in on the roots, every time.
60291
+ ************************************************************/
60292
+ function fold_keep_node(gobj) {
60293
+ let priv = gobj.priv;
60294
+ if (priv.anchor_state === "on" && priv.anchor_id) return priv.anchor_id;
60295
+ let model = priv._fold_model;
60296
+ for (let topic_name of model.topics) {
60297
+ let roots = model.groups.get(fold_root_group_key(topic_name)) || [];
60298
+ if (roots.length) return node_id_of_key(gobj, roots[0]);
60299
+ }
60300
+ return "";
60301
+ }
60302
+ /************************************************************
60278
60303
  * The roots alone.
60279
60304
  ************************************************************/
60280
60305
  function ac_collapse_all$1(gobj, event, kw, src) {
@@ -60283,8 +60308,13 @@ function ac_collapse_all$1(gobj, event, kw, src) {
60283
60308
  log_error(`${gobj_short_name(gobj)}: collapse all with no tree loaded`);
60284
60309
  return -1;
60285
60310
  }
60311
+ let keep = fold_keep_node(gobj);
60312
+ let vp = yui_graph_viewport_of(priv.graph, keep);
60286
60313
  fold_collapse_all(priv._fold_model, priv._fold_state);
60287
- reconcile_fold(gobj, { fit: true });
60314
+ reconcile_fold(gobj, {
60315
+ keep,
60316
+ keep_vp: vp
60317
+ });
60288
60318
  return 0;
60289
60319
  }
60290
60320
  /************************************************************
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "7.23.77",
3
+ "version": "7.23.79",
4
4
  "type": "module",
5
5
  "main": "dist/gobj-ui.cjs.js",
6
6
  "module": "dist/gobj-ui.es.js",
@@ -124,6 +124,7 @@ import {
124
124
  fold_pending_groups,
125
125
  fold_node_key,
126
126
  fold_split_group_key,
127
+ fold_root_group_key,
127
128
  } from "./treedb_fold_model.js";
128
129
  import {layout_tree, layout_radial} from "./treedb_layout.js";
129
130
 
@@ -252,10 +253,12 @@ const SELECT_RING = "rgba(59,130,246,0.95)";
252
253
  * The ports of an open card. They are what a link is DRAWN from
253
254
  * and what a resize takes hold of, and at a radius of 6 (2 on a
254
255
  * chip) with a hairline stroke nobody could tell they were either:
255
- * a port has to look like a handle.
256
+ * a port has to look like a handle. 10 / 5 in 7.23.75 was still
257
+ * read as a dot on a deployed treedb; 14 / 8 since 7.23.79. A
258
+ * saved geometry or a topic default (`resize all`) still wins.
256
259
  */
257
- const PORT_R_ENTITY = 10;
258
- const PORT_R_CHILD = 5;
260
+ const PORT_R_ENTITY = 14;
261
+ const PORT_R_CHILD = 8;
259
262
  const PORT_LINE_WIDTH = 2;
260
263
 
261
264
  /*
@@ -9079,12 +9082,41 @@ function ac_expand_all(gobj, event, kw, src)
9079
9082
  log_error(`${gobj_short_name(gobj)}: expand all with no tree loaded`);
9080
9083
  return -1;
9081
9084
  }
9085
+ let keep = fold_keep_node(gobj);
9086
+ let vp = yui_graph_viewport_of(priv.graph, keep);
9082
9087
  fold_expand_all(priv._fold_model, priv._fold_state);
9083
- reconcile_fold(gobj, {fit: true});
9088
+ reconcile_fold(gobj, {keep: keep, keep_vp: vp});
9084
9089
 
9085
9090
  return 0;
9086
9091
  }
9087
9092
 
9093
+ /************************************************************
9094
+ * The node the camera holds still across a GLOBAL fold: the
9095
+ * anchor when there is one, else the first root -- the top of
9096
+ * the tree, which is where a JSON viewer keeps the eye when it
9097
+ * opens or closes everything. The zoom does not move either way:
9098
+ * a fold is not a reason to change the scale the reader chose,
9099
+ * and until 7.23.78 both buttons fitted the whole graph, so
9100
+ * opening everything zoomed out to a strip and closing it zoomed
9101
+ * in on the roots, every time.
9102
+ ************************************************************/
9103
+ function fold_keep_node(gobj)
9104
+ {
9105
+ let priv = gobj.priv;
9106
+
9107
+ if(priv.anchor_state === "on" && priv.anchor_id) {
9108
+ return priv.anchor_id;
9109
+ }
9110
+ let model = priv._fold_model;
9111
+ for(let topic_name of model.topics) {
9112
+ let roots = model.groups.get(fold_root_group_key(topic_name)) || [];
9113
+ if(roots.length) {
9114
+ return node_id_of_key(gobj, roots[0]);
9115
+ }
9116
+ }
9117
+ return "";
9118
+ }
9119
+
9088
9120
  /************************************************************
9089
9121
  * The roots alone.
9090
9122
  ************************************************************/
@@ -9096,8 +9128,10 @@ function ac_collapse_all(gobj, event, kw, src)
9096
9128
  log_error(`${gobj_short_name(gobj)}: collapse all with no tree loaded`);
9097
9129
  return -1;
9098
9130
  }
9131
+ let keep = fold_keep_node(gobj);
9132
+ let vp = yui_graph_viewport_of(priv.graph, keep);
9099
9133
  fold_collapse_all(priv._fold_model, priv._fold_state);
9100
- reconcile_fold(gobj, {fit: true});
9134
+ reconcile_fold(gobj, {keep: keep, keep_vp: vp});
9101
9135
 
9102
9136
  return 0;
9103
9137
  }