@yuneta/gobj-ui 7.6.0 → 7.6.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.
- package/dist/gobj-ui.cjs.js +20 -1
- package/dist/gobj-ui.es.js +20 -1
- package/package.json +1 -1
- package/src/c_g6_nodes_tree.js +27 -1
package/dist/gobj-ui.cjs.js
CHANGED
|
@@ -54062,6 +54062,25 @@ async function graph_center(gobj) {
|
|
|
54062
54062
|
async function graph_fitview(gobj) {
|
|
54063
54063
|
await gobj.priv.graph.fitView();
|
|
54064
54064
|
}
|
|
54065
|
+
var MIN_READABLE_ZOOM = .5;
|
|
54066
|
+
/************************************************************
|
|
54067
|
+
* Fit the graph in the viewport, but never zoom out past the point
|
|
54068
|
+
* where nothing on a card can be read.
|
|
54069
|
+
*
|
|
54070
|
+
* A wide fan — a schema treedb is one topic and a hundred columns —
|
|
54071
|
+
* fits at about 0.2, which is a hairline strip: technically the whole
|
|
54072
|
+
* graph, and worth nothing. Stopping at a legible zoom and centring
|
|
54073
|
+
* shows a part you can actually read, and the minimap (which such a
|
|
54074
|
+
* graph always has) says where that part is.
|
|
54075
|
+
************************************************************/
|
|
54076
|
+
async function graph_fit_readable(gobj) {
|
|
54077
|
+
let graph = gobj.priv.graph;
|
|
54078
|
+
await graph.fitView();
|
|
54079
|
+
if (graph.getZoom() < MIN_READABLE_ZOOM) {
|
|
54080
|
+
await graph.zoomTo(MIN_READABLE_ZOOM);
|
|
54081
|
+
await graph.fitCenter();
|
|
54082
|
+
}
|
|
54083
|
+
}
|
|
54065
54084
|
/************************************************************
|
|
54066
54085
|
* Focus the graph on one topic: highlight (amber 'active' state)
|
|
54067
54086
|
* every node of that topic and centre the viewport on them. An
|
|
@@ -56610,7 +56629,7 @@ function ac_load_data(gobj, event, kw, src) {
|
|
|
56610
56629
|
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: auto_layout failed: ${e}`);
|
|
56611
56630
|
}
|
|
56612
56631
|
graph_layout(gobj).then(() => {
|
|
56613
|
-
if (auto_laid)
|
|
56632
|
+
if (auto_laid) graph_fit_readable(gobj).catch((e) => {
|
|
56614
56633
|
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: cannot fit the graph: ${e}`);
|
|
56615
56634
|
});
|
|
56616
56635
|
if (priv.edit_mode) graph_add_plugin(gobj, "history");
|
package/dist/gobj-ui.es.js
CHANGED
|
@@ -54049,6 +54049,25 @@ async function graph_center(gobj) {
|
|
|
54049
54049
|
async function graph_fitview(gobj) {
|
|
54050
54050
|
await gobj.priv.graph.fitView();
|
|
54051
54051
|
}
|
|
54052
|
+
var MIN_READABLE_ZOOM = .5;
|
|
54053
|
+
/************************************************************
|
|
54054
|
+
* Fit the graph in the viewport, but never zoom out past the point
|
|
54055
|
+
* where nothing on a card can be read.
|
|
54056
|
+
*
|
|
54057
|
+
* A wide fan — a schema treedb is one topic and a hundred columns —
|
|
54058
|
+
* fits at about 0.2, which is a hairline strip: technically the whole
|
|
54059
|
+
* graph, and worth nothing. Stopping at a legible zoom and centring
|
|
54060
|
+
* shows a part you can actually read, and the minimap (which such a
|
|
54061
|
+
* graph always has) says where that part is.
|
|
54062
|
+
************************************************************/
|
|
54063
|
+
async function graph_fit_readable(gobj) {
|
|
54064
|
+
let graph = gobj.priv.graph;
|
|
54065
|
+
await graph.fitView();
|
|
54066
|
+
if (graph.getZoom() < MIN_READABLE_ZOOM) {
|
|
54067
|
+
await graph.zoomTo(MIN_READABLE_ZOOM);
|
|
54068
|
+
await graph.fitCenter();
|
|
54069
|
+
}
|
|
54070
|
+
}
|
|
54052
54071
|
/************************************************************
|
|
54053
54072
|
* Focus the graph on one topic: highlight (amber 'active' state)
|
|
54054
54073
|
* every node of that topic and centre the viewport on them. An
|
|
@@ -56597,7 +56616,7 @@ function ac_load_data(gobj, event, kw, src) {
|
|
|
56597
56616
|
log_error(`${gobj_short_name(gobj)}: auto_layout failed: ${e}`);
|
|
56598
56617
|
}
|
|
56599
56618
|
graph_layout(gobj).then(() => {
|
|
56600
|
-
if (auto_laid)
|
|
56619
|
+
if (auto_laid) graph_fit_readable(gobj).catch((e) => {
|
|
56601
56620
|
log_error(`${gobj_short_name(gobj)}: cannot fit the graph: ${e}`);
|
|
56602
56621
|
});
|
|
56603
56622
|
if (priv.edit_mode) graph_add_plugin(gobj, "history");
|
package/package.json
CHANGED
package/src/c_g6_nodes_tree.js
CHANGED
|
@@ -2104,6 +2104,32 @@ async function graph_fitview(gobj)
|
|
|
2104
2104
|
await graph.fitView();
|
|
2105
2105
|
}
|
|
2106
2106
|
|
|
2107
|
+
/* Below this the cards carry no readable text at all. */
|
|
2108
|
+
const MIN_READABLE_ZOOM = 0.5;
|
|
2109
|
+
|
|
2110
|
+
/************************************************************
|
|
2111
|
+
* Fit the graph in the viewport, but never zoom out past the point
|
|
2112
|
+
* where nothing on a card can be read.
|
|
2113
|
+
*
|
|
2114
|
+
* A wide fan — a schema treedb is one topic and a hundred columns —
|
|
2115
|
+
* fits at about 0.2, which is a hairline strip: technically the whole
|
|
2116
|
+
* graph, and worth nothing. Stopping at a legible zoom and centring
|
|
2117
|
+
* shows a part you can actually read, and the minimap (which such a
|
|
2118
|
+
* graph always has) says where that part is.
|
|
2119
|
+
************************************************************/
|
|
2120
|
+
async function graph_fit_readable(gobj)
|
|
2121
|
+
{
|
|
2122
|
+
let priv = gobj.priv;
|
|
2123
|
+
let graph = priv.graph;
|
|
2124
|
+
|
|
2125
|
+
await graph.fitView();
|
|
2126
|
+
|
|
2127
|
+
if(graph.getZoom() < MIN_READABLE_ZOOM) {
|
|
2128
|
+
await graph.zoomTo(MIN_READABLE_ZOOM);
|
|
2129
|
+
await graph.fitCenter();
|
|
2130
|
+
}
|
|
2131
|
+
}
|
|
2132
|
+
|
|
2107
2133
|
/************************************************************
|
|
2108
2134
|
* Focus the graph on one topic: highlight (amber 'active' state)
|
|
2109
2135
|
* every node of that topic and centre the viewport on them. An
|
|
@@ -5886,7 +5912,7 @@ function ac_load_data(gobj, event, kw, src)
|
|
|
5886
5912
|
* 118 more. Only when WE laid it out — a saved
|
|
5887
5913
|
* arrangement includes where its owner was looking. */
|
|
5888
5914
|
if(auto_laid) {
|
|
5889
|
-
|
|
5915
|
+
graph_fit_readable(gobj).catch((e) => {
|
|
5890
5916
|
log_error(`${gobj_short_name(gobj)}: cannot fit the graph: ${e}`);
|
|
5891
5917
|
});
|
|
5892
5918
|
}
|