@yuneta/gobj-ui 7.23.73 → 7.23.75

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
@@ -835,6 +835,16 @@ Two implementation notes worth keeping:
835
835
 
836
836
  ### The graph's viewport toolbar
837
837
 
838
+ **The wheel scrolls; Ctrl + wheel zooms** (since `7.23.75`, in every operation
839
+ mode of every graph built on `C_G6_NODES_TREE`). A graph of many nodes is
840
+ taller than the screen, and a wheel that zoomed instead made it a thing to be
841
+ looked at from afar or read through a keyhole — never scrolled, which is what
842
+ a wheel does on a map and on every page. Shift + wheel scrolls sideways, a
843
+ trackpad pinch arrives as Ctrl + wheel and keeps zooming, and the two-finger
844
+ pinch on a touch screen is [our own](#the-graphs-on-a-touch-screen). G6's
845
+ `scroll-canvas` takes the plain wheel (its `enable` stands aside for a
846
+ Ctrl/Meta wheel) and `zoom-canvas` takes `trigger: ['Control']`.
847
+
838
848
  `C_G6_NODES_TREE` floats a vertical toolbar over the canvas:
839
849
 
840
850
  | control | what it does |
@@ -1268,7 +1278,7 @@ One consumer key came with it: `show more`, the chip's tooltip.
1268
1278
 
1269
1279
  ### Layouts: what G6 offers, and the two made for a treedb
1270
1280
 
1271
- What a treedb graph IS, once folded: a **forest read left to right**. A main
1281
+ What a treedb graph IS, once folded: a **forest read top to bottom**. A main
1272
1282
  topic is a tree (places: country, region, site, hall), the other topics hang
1273
1283
  from its nodes through hooks, a record may hang from two parents (a device
1274
1284
  from its place AND its controller), and every visible node was reached from a
@@ -1285,16 +1295,21 @@ G6 5.1 registers these layouts, and this is how each meets that shape:
1285
1295
  | `circular`, `concentric`, `grid`, `mds`, `random` | rings, rings by degree, a grid, projection, noise | none knows a parent from a child |
1286
1296
  | `combo-combined`, `fishbone` | combos / cause-effect | not this data |
1287
1297
 
1288
- So three of our own, in `treedb_layout.js` (pure, tested), registered as G6
1289
- layouts by three thin adapters in `c_g6_nodes_tree.js`:
1290
-
1291
- - **`treedb-tree`** — the classic tidy tree, left to right. A column per
1292
- depth as wide as its widest card, a node centred on the block of its
1293
- children, siblings stacked with `nodesep`. **The default** for a treedb
1294
- nobody has arranged (was `dagre`).
1295
- - **`treedb-outline`** — one node per row, indented by depth: what a JSON
1296
- viewer draws, and what a treedb is when read as one. Tall, but nothing is
1297
- ever beside anything.
1298
+ So two of our own, in `treedb_layout.js` (pure, tested), registered as G6
1299
+ layouts by two thin adapters in `c_g6_nodes_tree.js`:
1300
+
1301
+ - **`treedb-tree`** — the classic tidy tree, **top to bottom**. A row per
1302
+ depth as tall as its tallest card, a node centred over the block of its
1303
+ children, siblings side by side with `nodesep`. **The default** for a
1304
+ treedb nobody has arranged (was `dagre`). It reads down because down is
1305
+ where a tree has room: a hall with a hundred devices is a wide row, not a
1306
+ column beside a card — and read right (as it did until `7.23.74`) it was
1307
+ `dagre` with the siblings held still, which nobody could tell apart. The
1308
+ algorithm is written once, left to right; the top-down tree is the same
1309
+ tree fed transposed cards and read back transposed (`direction: "LR"`
1310
+ keeps the other reading for a host that wants it). The outline that shipped
1311
+ beside it (`treedb-outline`, one row per node) was removed in `7.23.75`: a
1312
+ list that indents is a JSON viewer, and this library already has one.
1298
1313
  - **`radial`** (`treedb-radial`) — the root in the middle, a ring per depth,
1299
1314
  every subtree an angular **sector** proportional to its leaves, and the
1300
1315
  radius of each ring the larger of one step out from the ring before and
@@ -1312,9 +1327,48 @@ reaches gets a root. Consequences that dagre cannot give: O(n), no crossing
1312
1327
  heuristic, and **opening a hook moves nothing that is not under or beside
1313
1328
  it** — the cards keep their order, the eye keeps its place, and the `+N` chip
1314
1329
  sits at the end of its own hook's children. The hook rank comes from the
1315
- edge's `sourcePort` looked up in the parent's ports, so the adapter needs no
1330
+ edge's `sourcePort` looked up in the parent's port keys — carried in the
1331
+ node's `data.port_keys`, because a CLOSED node (below) has no ports on its
1332
+ style and its children still sit in schema order — so the adapter needs no
1316
1333
  model, only the G6 data.
1317
1334
 
1335
+ The walks are **iterative**, not recursive: a self-referent hook (a place
1336
+ inside a place inside a place) is as deep as the store says, and the stack is
1337
+ not. A 20000-node chain is a test.
1338
+
1339
+ ### Closed nodes: the topology of a graph with many nodes
1340
+
1341
+ A card is 172×96 px with its ports, and a graph of a few hundred of them is
1342
+ readable card by card and unreadable as a whole: at the zoom that fits it on
1343
+ screen every card is a smudge. Since `7.23.75` a record has **two shapes**:
1344
+
1345
+ - **open** — the card, with its name, its pills and its **ports**. The only
1346
+ shape a link can be edited on, because a link is drawn from a port.
1347
+ - **closed** — a rounded square of the topic's colour, no ports, no text:
1348
+ the **topology** and nothing else. A native G6 `rect`, so the focus, the
1349
+ selection and the anchor are its own stroke and halo instead of a rebuilt
1350
+ innerHTML. The three tiers keep their order of size (32 / 28 / 22), and
1351
+ the structural tier keeps its dashed border.
1352
+
1353
+ Two toggles in the view's toolbar (`C_YUI_TREEDB_GRAPH`), next to the fold
1354
+ pair, both **states** and both looking pressed:
1355
+
1356
+ | toggle | attr (persisted) | what it does |
1357
+ |---|---|---|
1358
+ | closed nodes | `node_mode` (`expanded` / `compact`) | every record closed or every record open; a change lays the graph out again, because a square and a card do not take the same room |
1359
+ | labels | `node_labels` | the name under each closed square, on or off — nothing moves, the label hangs outside the square and the layout measures the square |
1360
+
1361
+ And **one node against the rule**: a double click on a node opens it if the
1362
+ graph is closed and closes it if the graph is open; the node's context menu
1363
+ (`open node` / `close node`) does the same, which is the door a finger has to
1364
+ it. The node holds still on screen while the rest makes room, as a fold does.
1365
+ A change of the global mode forgets these exceptions. Consumer i18n keys:
1366
+ `closed nodes`, `node labels`, `open node`, `close node`.
1367
+
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
1370
+ of, and at radius 6 with a hairline nobody could tell they were either.
1371
+
1318
1372
  ### The legend is the graph's layer control
1319
1373
 
1320
1374
  The legend strip under the toolbar is **always there** now (the *Legend*