@yuneta/gobj-ui 7.5.1 → 7.5.2

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.
@@ -55706,16 +55706,21 @@ function show_node_detail_popover(gobj, node_id) {
55706
55706
  * Saved positions live in `__graphs__` (per topic, per node) and, on
55707
55707
  * older data, in a `_geometry` on the record itself. Both are read.
55708
55708
  ************************************************************/
55709
+ function geometry_has_position(g) {
55710
+ if (!(0, _yuneta_gobj_js.is_object)(g)) return false;
55711
+ return (0, _yuneta_gobj_js.is_number)(g.x) || (0, _yuneta_gobj_js.is_number)(g.y);
55712
+ }
55709
55713
  function has_saved_geometry(gobj) {
55710
55714
  let priv = gobj.priv;
55711
55715
  for (let topic of Object.keys(priv._graph_properties || {})) {
55712
55716
  let props = priv._graph_properties[topic];
55713
- if (props && (0, _yuneta_gobj_js.is_object)(props.nodes) && Object.keys(props.nodes).length > 0) return true;
55717
+ if (!props || !(0, _yuneta_gobj_js.is_object)(props.nodes)) continue;
55718
+ for (let node_id of Object.keys(props.nodes)) if (geometry_has_position(props.nodes[node_id])) return true;
55714
55719
  }
55715
55720
  for (let topic of Object.keys(priv.records || {})) {
55716
55721
  let records = priv.records[topic];
55717
55722
  if (!(0, _yuneta_gobj_js.is_array)(records)) continue;
55718
- for (let record of records) if (record && (0, _yuneta_gobj_js.is_object)(record._geometry)) return true;
55723
+ for (let record of records) if (record && geometry_has_position(record._geometry)) return true;
55719
55724
  }
55720
55725
  return false;
55721
55726
  }
@@ -55693,16 +55693,21 @@ function show_node_detail_popover(gobj, node_id) {
55693
55693
  * Saved positions live in `__graphs__` (per topic, per node) and, on
55694
55694
  * older data, in a `_geometry` on the record itself. Both are read.
55695
55695
  ************************************************************/
55696
+ function geometry_has_position(g) {
55697
+ if (!is_object(g)) return false;
55698
+ return is_number(g.x) || is_number(g.y);
55699
+ }
55696
55700
  function has_saved_geometry(gobj) {
55697
55701
  let priv = gobj.priv;
55698
55702
  for (let topic of Object.keys(priv._graph_properties || {})) {
55699
55703
  let props = priv._graph_properties[topic];
55700
- if (props && is_object(props.nodes) && Object.keys(props.nodes).length > 0) return true;
55704
+ if (!props || !is_object(props.nodes)) continue;
55705
+ for (let node_id of Object.keys(props.nodes)) if (geometry_has_position(props.nodes[node_id])) return true;
55701
55706
  }
55702
55707
  for (let topic of Object.keys(priv.records || {})) {
55703
55708
  let records = priv.records[topic];
55704
55709
  if (!is_array(records)) continue;
55705
- for (let record of records) if (record && is_object(record._geometry)) return true;
55710
+ for (let record of records) if (record && geometry_has_position(record._geometry)) return true;
55706
55711
  }
55707
55712
  return false;
55708
55713
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "7.5.1",
3
+ "version": "7.5.2",
4
4
  "type": "module",
5
5
  "main": "dist/gobj-ui.cjs.js",
6
6
  "module": "dist/gobj-ui.es.js",
@@ -47,6 +47,7 @@ import {
47
47
  is_array,
48
48
  empty_string,
49
49
  is_object,
50
+ is_number,
50
51
  kw_get_int,
51
52
  kw_get_str,
52
53
  kw_get_dict_value,
@@ -4499,14 +4500,31 @@ function show_node_detail_popover(gobj, node_id)
4499
4500
  * Saved positions live in `__graphs__` (per topic, per node) and, on
4500
4501
  * older data, in a `_geometry` on the record itself. Both are read.
4501
4502
  ************************************************************/
4503
+ function geometry_has_position(g)
4504
+ {
4505
+ /* An EMPTY object is not a position. A treedb hands back `_geometry: {}`
4506
+ * for a record nobody ever moved, and a node entry can hold a port size
4507
+ * with no coordinates — both are objects, and taking either for "this
4508
+ * was arranged" is what kept the cascade in place. Only x or y counts. */
4509
+ if(!is_object(g)) {
4510
+ return false;
4511
+ }
4512
+ return is_number(g.x) || is_number(g.y);
4513
+ }
4514
+
4502
4515
  function has_saved_geometry(gobj)
4503
4516
  {
4504
4517
  let priv = gobj.priv;
4505
4518
 
4506
4519
  for(let topic of Object.keys(priv._graph_properties || {})) {
4507
4520
  let props = priv._graph_properties[topic];
4508
- if(props && is_object(props.nodes) && Object.keys(props.nodes).length > 0) {
4509
- return true;
4521
+ if(!props || !is_object(props.nodes)) {
4522
+ continue;
4523
+ }
4524
+ for(let node_id of Object.keys(props.nodes)) {
4525
+ if(geometry_has_position(props.nodes[node_id])) {
4526
+ return true;
4527
+ }
4510
4528
  }
4511
4529
  }
4512
4530
 
@@ -4516,7 +4534,7 @@ function has_saved_geometry(gobj)
4516
4534
  continue;
4517
4535
  }
4518
4536
  for(let record of records) {
4519
- if(record && is_object(record._geometry)) {
4537
+ if(record && geometry_has_position(record._geometry)) {
4520
4538
  return true;
4521
4539
  }
4522
4540
  }