@yuneta/gobj-ui 7.5.7 → 7.6.0
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/dist/gobj-ui.cjs.js +10 -5
- package/dist/gobj-ui.es.js +10 -5
- package/package.json +1 -1
- package/src/c_g6_nodes_tree.js +18 -5
package/dist/gobj-ui.cjs.js
CHANGED
|
@@ -55732,18 +55732,19 @@ function geometry_has_position(g) {
|
|
|
55732
55732
|
************************************************************/
|
|
55733
55733
|
function auto_layout(gobj) {
|
|
55734
55734
|
let priv = gobj.priv;
|
|
55735
|
-
if (priv._layout_asked) return;
|
|
55736
|
-
if (priv._nodes_total > 0 && priv._nodes_placed * 2 > priv._nodes_total) return;
|
|
55737
|
-
if (!priv.graph) return;
|
|
55735
|
+
if (priv._layout_asked) return false;
|
|
55736
|
+
if (priv._nodes_total > 0 && priv._nodes_placed * 2 > priv._nodes_total) return false;
|
|
55737
|
+
if (!priv.graph) return false;
|
|
55738
55738
|
let name = "dagre";
|
|
55739
55739
|
(0, _yuneta_gobj_js.gobj_write_attr)(gobj, "layout", name);
|
|
55740
55740
|
try {
|
|
55741
55741
|
priv.graph.setLayout(_layouts[name]);
|
|
55742
55742
|
} catch (e) {
|
|
55743
55743
|
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: cannot set the '${name}' layout: ${e}`);
|
|
55744
|
-
return;
|
|
55744
|
+
return false;
|
|
55745
55745
|
}
|
|
55746
55746
|
(0, _yuneta_gobj_js.gobj_publish_event)(gobj, "EV_LAYOUT_AUTOSET", { layout: name });
|
|
55747
|
+
return true;
|
|
55747
55748
|
}
|
|
55748
55749
|
/************************************************************
|
|
55749
55750
|
* Show or hide the minimap, deciding by the SIZE of the graph.
|
|
@@ -56602,12 +56603,16 @@ function ac_load_data(gobj, event, kw, src) {
|
|
|
56602
56603
|
graph_draw(gobj).then(() => {
|
|
56603
56604
|
create_links(gobj);
|
|
56604
56605
|
graph_draw(gobj).then(() => {
|
|
56606
|
+
let auto_laid = false;
|
|
56605
56607
|
try {
|
|
56606
|
-
auto_layout(gobj);
|
|
56608
|
+
auto_laid = auto_layout(gobj);
|
|
56607
56609
|
} catch (e) {
|
|
56608
56610
|
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: auto_layout failed: ${e}`);
|
|
56609
56611
|
}
|
|
56610
56612
|
graph_layout(gobj).then(() => {
|
|
56613
|
+
if (auto_laid) graph_fitview(gobj).catch((e) => {
|
|
56614
|
+
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: cannot fit the graph: ${e}`);
|
|
56615
|
+
});
|
|
56611
56616
|
if (priv.edit_mode) graph_add_plugin(gobj, "history");
|
|
56612
56617
|
else graph_remove_plugin(gobj, "history");
|
|
56613
56618
|
if (priv._pending_focus_topic !== null) {
|
package/dist/gobj-ui.es.js
CHANGED
|
@@ -55719,18 +55719,19 @@ function geometry_has_position(g) {
|
|
|
55719
55719
|
************************************************************/
|
|
55720
55720
|
function auto_layout(gobj) {
|
|
55721
55721
|
let priv = gobj.priv;
|
|
55722
|
-
if (priv._layout_asked) return;
|
|
55723
|
-
if (priv._nodes_total > 0 && priv._nodes_placed * 2 > priv._nodes_total) return;
|
|
55724
|
-
if (!priv.graph) return;
|
|
55722
|
+
if (priv._layout_asked) return false;
|
|
55723
|
+
if (priv._nodes_total > 0 && priv._nodes_placed * 2 > priv._nodes_total) return false;
|
|
55724
|
+
if (!priv.graph) return false;
|
|
55725
55725
|
let name = "dagre";
|
|
55726
55726
|
gobj_write_attr(gobj, "layout", name);
|
|
55727
55727
|
try {
|
|
55728
55728
|
priv.graph.setLayout(_layouts[name]);
|
|
55729
55729
|
} catch (e) {
|
|
55730
55730
|
log_error(`${gobj_short_name(gobj)}: cannot set the '${name}' layout: ${e}`);
|
|
55731
|
-
return;
|
|
55731
|
+
return false;
|
|
55732
55732
|
}
|
|
55733
55733
|
gobj_publish_event(gobj, "EV_LAYOUT_AUTOSET", { layout: name });
|
|
55734
|
+
return true;
|
|
55734
55735
|
}
|
|
55735
55736
|
/************************************************************
|
|
55736
55737
|
* Show or hide the minimap, deciding by the SIZE of the graph.
|
|
@@ -56589,12 +56590,16 @@ function ac_load_data(gobj, event, kw, src) {
|
|
|
56589
56590
|
graph_draw(gobj).then(() => {
|
|
56590
56591
|
create_links(gobj);
|
|
56591
56592
|
graph_draw(gobj).then(() => {
|
|
56593
|
+
let auto_laid = false;
|
|
56592
56594
|
try {
|
|
56593
|
-
auto_layout(gobj);
|
|
56595
|
+
auto_laid = auto_layout(gobj);
|
|
56594
56596
|
} catch (e) {
|
|
56595
56597
|
log_error(`${gobj_short_name(gobj)}: auto_layout failed: ${e}`);
|
|
56596
56598
|
}
|
|
56597
56599
|
graph_layout(gobj).then(() => {
|
|
56600
|
+
if (auto_laid) graph_fitview(gobj).catch((e) => {
|
|
56601
|
+
log_error(`${gobj_short_name(gobj)}: cannot fit the graph: ${e}`);
|
|
56602
|
+
});
|
|
56598
56603
|
if (priv.edit_mode) graph_add_plugin(gobj, "history");
|
|
56599
56604
|
else graph_remove_plugin(gobj, "history");
|
|
56600
56605
|
if (priv._pending_focus_topic !== null) {
|
package/package.json
CHANGED
package/src/c_g6_nodes_tree.js
CHANGED
|
@@ -4544,7 +4544,7 @@ function auto_layout(gobj)
|
|
|
4544
4544
|
let priv = gobj.priv;
|
|
4545
4545
|
|
|
4546
4546
|
if(priv._layout_asked) {
|
|
4547
|
-
return;
|
|
4547
|
+
return false; /* the user picked one for this treedb */
|
|
4548
4548
|
}
|
|
4549
4549
|
/* MOST of the nodes, not one of them.
|
|
4550
4550
|
*
|
|
@@ -4557,10 +4557,10 @@ function auto_layout(gobj)
|
|
|
4557
4557
|
* invented as readily as one a human chose, so a single stored
|
|
4558
4558
|
* coordinate proves nothing. One leftover is not an arrangement. */
|
|
4559
4559
|
if(priv._nodes_total > 0 && priv._nodes_placed * 2 > priv._nodes_total) {
|
|
4560
|
-
return;
|
|
4560
|
+
return false; /* somebody arranged it: leave it alone */
|
|
4561
4561
|
}
|
|
4562
4562
|
if(!priv.graph) {
|
|
4563
|
-
return;
|
|
4563
|
+
return false;
|
|
4564
4564
|
}
|
|
4565
4565
|
|
|
4566
4566
|
let name = "dagre";
|
|
@@ -4569,11 +4569,12 @@ function auto_layout(gobj)
|
|
|
4569
4569
|
priv.graph.setLayout(_layouts[name]);
|
|
4570
4570
|
} catch(e) {
|
|
4571
4571
|
log_error(`${gobj_short_name(gobj)}: cannot set the '${name}' layout: ${e}`);
|
|
4572
|
-
return;
|
|
4572
|
+
return false;
|
|
4573
4573
|
}
|
|
4574
4574
|
/* The toolbar's select was filled before the data arrived, so it is
|
|
4575
4575
|
* still showing `manual`: tell it what the graph is actually doing. */
|
|
4576
4576
|
gobj_publish_event(gobj, "EV_LAYOUT_AUTOSET", {layout: name});
|
|
4577
|
+
return true;
|
|
4577
4578
|
}
|
|
4578
4579
|
|
|
4579
4580
|
/************************************************************
|
|
@@ -5871,12 +5872,24 @@ function ac_load_data(gobj, event, kw, src)
|
|
|
5871
5872
|
/* Before the layout runs, and only now: whether anybody has
|
|
5872
5873
|
* ever placed a node of this treedb is not known until its
|
|
5873
5874
|
* records and __graphs__ are in. */
|
|
5875
|
+
let auto_laid = false;
|
|
5874
5876
|
try {
|
|
5875
|
-
auto_layout(gobj);
|
|
5877
|
+
auto_laid = auto_layout(gobj);
|
|
5876
5878
|
} catch(e) {
|
|
5877
5879
|
log_error(`${gobj_short_name(gobj)}: auto_layout failed: ${e}`);
|
|
5878
5880
|
}
|
|
5879
5881
|
graph_layout(gobj).then(() => {
|
|
5882
|
+
/* A graph laid out by us opens WHOLE. dagre spreads a
|
|
5883
|
+
* 126-node treedb over some 19000px, and the camera is
|
|
5884
|
+
* wherever it was: without this you get eight cards in
|
|
5885
|
+
* the top-left corner and no reason to think there are
|
|
5886
|
+
* 118 more. Only when WE laid it out — a saved
|
|
5887
|
+
* arrangement includes where its owner was looking. */
|
|
5888
|
+
if(auto_laid) {
|
|
5889
|
+
graph_fitview(gobj).catch((e) => {
|
|
5890
|
+
log_error(`${gobj_short_name(gobj)}: cannot fit the graph: ${e}`);
|
|
5891
|
+
});
|
|
5892
|
+
}
|
|
5880
5893
|
if(priv.edit_mode) {
|
|
5881
5894
|
graph_add_plugin(gobj, "history");
|
|
5882
5895
|
} else {
|