@yuneta/gobj-ui 7.23.12 → 7.23.14
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 +36 -3
- package/dist/gobj-ui.cjs.js +155 -39
- package/dist/gobj-ui.es.js +155 -39
- package/package.json +1 -1
- package/src/c_g6_nodes_tree.js +25 -4
- package/src/c_yui_treedb_graph.js +64 -2
- package/src/g6_touch_gestures.js +148 -58
- package/src/lib_graph.css +34 -0
- package/src/press_arbiter.js +84 -0
- package/src/press_arbiter.test.js +63 -0
package/README.md
CHANGED
|
@@ -854,6 +854,26 @@ structural rather than cosmetic — and none of them is visible in the CSS:
|
|
|
854
854
|
slop) that re-emits G6's own forwarded event under the name the plugin
|
|
855
855
|
listens for — so `getItems(e)` sees exactly what a right click gives it,
|
|
856
856
|
including the port under the finger.
|
|
857
|
+
- **One finger has to serve three commands, so the press is arbitrated — at
|
|
858
|
+
the RELEASE** (`press_arbiter.js`, pure and tested): moved → drag; still and
|
|
859
|
+
let go quickly → the element's own action; still and held past 500ms → the
|
|
860
|
+
context menu. Firing the menu on a TIMER instead cannot arbitrate anything,
|
|
861
|
+
because at the moment it fires the gesture is not over: it opened while
|
|
862
|
+
`drag-element` was already carrying the node, so one press meant both things
|
|
863
|
+
and the menu sat over a card running away underneath it. Two more things the
|
|
864
|
+
same press was doing, both fixed with it: `click` is not taken from the DOM
|
|
865
|
+
either (`@antv/g`'s `onPointerUp` synthesises one), so the press that opened
|
|
866
|
+
the menu went on to click the node it opened the menu on — the click
|
|
867
|
+
handlers ask `consume_long_press_click()` first; and the BROWSER's own menu,
|
|
868
|
+
which opens while the finger is still down, is refused for as long as there
|
|
869
|
+
is a finger on the glass.
|
|
870
|
+
- **The browser was taking the gesture outright.** G6 puts `touch-action:
|
|
871
|
+
none` on its canvas and nothing on its HTML nodes, which are ordinary DIVs
|
|
872
|
+
over it — so a drag that started on a **card** was a page scroll: two
|
|
873
|
+
`pointermove`s through, then `pointercancel`, and the node stopped dead
|
|
874
|
+
about 20px in while the page slid. `.graph-container` refuses those gestures
|
|
875
|
+
whole now; the panels and the context menu keep `touch-action: auto`, so a
|
|
876
|
+
finger still scrolls what is meant to scroll.
|
|
857
877
|
|
|
858
878
|
Everything a finger has to LAND on is sized off `(pointer: coarse)`, which
|
|
859
879
|
means **a mouse sees no change at all**: node resize handles become a 14px
|
|
@@ -884,9 +904,9 @@ gesture to give them: G6 binds panning and the band to the same plain drag, so
|
|
|
884
904
|
one of the two has to stand aside. The edit toolbar carries a **selection
|
|
885
905
|
mode** toggle (the dashed marquee, next to `+`): while it is on, a tap picks a
|
|
886
906
|
card and a drag on the background draws the band, and panning is what stands
|
|
887
|
-
aside. It looks **pressed** while it is on (`pressed_state`, an
|
|
888
|
-
neutral chip) rather than taking one of the palette's colours: each of
|
|
889
|
-
names a KIND of action, and `7.23.11` borrowed undo/redo's violet for it —
|
|
907
|
+
aside. It looks **pressed** while it is on (`7.23.12`, `pressed_state`, an
|
|
908
|
+
inverted neutral chip) rather than taking one of the palette's colours: each of
|
|
909
|
+
those names a KIND of action, and `7.23.11` borrowed undo/redo's violet for it —
|
|
890
910
|
which put the same colour on two neighbouring buttons for two different
|
|
891
911
|
reasons, and carried the whole state change in the hairline of an outline
|
|
892
912
|
glyph. It is deliberately a button and not a heuristic — the toolbar says which
|
|
@@ -896,6 +916,19 @@ key. Leaving edition turns it off, and it is not persisted.
|
|
|
896
916
|
|
|
897
917
|
**New key for consumers: `selection mode`.**
|
|
898
918
|
|
|
919
|
+
**The two selects of the toolbar speak the app's language** (`7.23.13`). They
|
|
920
|
+
rendered their raw names — `reading`, `edition`, `dagre`, `manual` — in every
|
|
921
|
+
language, because neither went through `t()` at all: not a missing key, a
|
|
922
|
+
missing call. The label is translated and carries its own `data-i18n`, so it
|
|
923
|
+
follows a language change; the option's `value` is now set EXPLICITLY, because
|
|
924
|
+
an `<option>` with no value answers with its own text and a translated label
|
|
925
|
+
would have sent `"Edición"` to the FSM as the mode to enter.
|
|
926
|
+
|
|
927
|
+
**New keys for consumers: `reading`, `operation`, `writing`, `edition`,
|
|
928
|
+
`manual`, `dagre`, `antv-dagre`, `d3-force`, `force-atlas2`.** A host that adds
|
|
929
|
+
a layout of its own gets its name untranslated, which is what all of them got
|
|
930
|
+
until now.
|
|
931
|
+
|
|
899
932
|
### Tabs opened at runtime, and the two decisions their url costs
|
|
900
933
|
|
|
901
934
|
`yui_tab_routes.js`. A workspace whose tabs are opened by the operator —
|
package/dist/gobj-ui.cjs.js
CHANGED
|
@@ -9503,6 +9503,29 @@ function yui_graph_fold_items(gobj, wide) {
|
|
|
9503
9503
|
function yui_graph_refresh_item(gobj, wide) {
|
|
9504
9504
|
return camera_button(gobj, "yi-arrows-rotate", "EV_REFRESH", "refresh", wide);
|
|
9505
9505
|
}
|
|
9506
|
+
/***************************************************************
|
|
9507
|
+
* Arbitration
|
|
9508
|
+
***************************************************************/
|
|
9509
|
+
/************************************************************
|
|
9510
|
+
* Did the finger travel far enough to mean a DRAG?
|
|
9511
|
+
*
|
|
9512
|
+
* `press` is what the pointerdown recorded: {x, y, t0}.
|
|
9513
|
+
************************************************************/
|
|
9514
|
+
function press_moved(press, x, y) {
|
|
9515
|
+
if (!press) return false;
|
|
9516
|
+
return Math.abs(x - press.x) > 10 || Math.abs(y - press.y) > 10;
|
|
9517
|
+
}
|
|
9518
|
+
/************************************************************
|
|
9519
|
+
* What the press meant, asked when the finger comes up.
|
|
9520
|
+
*
|
|
9521
|
+
* Answers "none" when there was no press to arbitrate.
|
|
9522
|
+
************************************************************/
|
|
9523
|
+
function classify_press(press, x, y, t) {
|
|
9524
|
+
if (!press) return "none";
|
|
9525
|
+
if (press_moved(press, x, y)) return "drag";
|
|
9526
|
+
if (t - press.t0 >= 500) return "long";
|
|
9527
|
+
return "tap";
|
|
9528
|
+
}
|
|
9506
9529
|
//#endregion
|
|
9507
9530
|
//#region src/g6_touch_gestures.js
|
|
9508
9531
|
/***********************************************************************
|
|
@@ -9539,6 +9562,21 @@ function yui_graph_refresh_item(gobj, wide) {
|
|
|
9539
9562
|
* forwarded event object -- which is why the plugin's
|
|
9540
9563
|
* `getItems(e)` receives exactly the shape it expects.
|
|
9541
9564
|
*
|
|
9565
|
+
* ONE finger has to serve three commands -- move the
|
|
9566
|
+
* node, act on it, open its menu -- so the press is
|
|
9567
|
+
* arbitrated, and arbitrated at the RELEASE:
|
|
9568
|
+
*
|
|
9569
|
+
* moved -> drag
|
|
9570
|
+
* still, let go fast -> the element's own action
|
|
9571
|
+
* still, held >= 500ms -> the context menu
|
|
9572
|
+
*
|
|
9573
|
+
* A menu opened on a TIMER instead cannot be arbitrated
|
|
9574
|
+
* at all: it opens while `drag-element` is already
|
|
9575
|
+
* carrying the node, so the same press means both things
|
|
9576
|
+
* and the user gets a menu over a card running away
|
|
9577
|
+
* underneath it. `classify_press` is where the three
|
|
9578
|
+
* live, and it is pure.
|
|
9579
|
+
*
|
|
9542
9580
|
* Both are built on ONE per-graph record of the fingers
|
|
9543
9581
|
* on the glass, read from the NATIVE touch events -- see
|
|
9544
9582
|
* `touch_state_of` for why the pointer stream, which looks
|
|
@@ -9551,11 +9589,6 @@ function yui_graph_refresh_item(gobj, wide) {
|
|
|
9551
9589
|
* All Rights Reserved.
|
|
9552
9590
|
***********************************************************************/
|
|
9553
9591
|
/***************************************************************
|
|
9554
|
-
* Constants
|
|
9555
|
-
***************************************************************/
|
|
9556
|
-
var LONG_PRESS_MS = 500;
|
|
9557
|
-
var LONG_PRESS_SLOP = 10;
|
|
9558
|
-
/***************************************************************
|
|
9559
9592
|
* Per-graph record of the fingers on the glass
|
|
9560
9593
|
***************************************************************/
|
|
9561
9594
|
var __touch_state__ = /* @__PURE__ */ new WeakMap();
|
|
@@ -9582,7 +9615,9 @@ function touch_state_of(graph) {
|
|
|
9582
9615
|
if (state) return state;
|
|
9583
9616
|
state = {
|
|
9584
9617
|
count: 0,
|
|
9585
|
-
|
|
9618
|
+
multi: false,
|
|
9619
|
+
container: null,
|
|
9620
|
+
long_press_click: false
|
|
9586
9621
|
};
|
|
9587
9622
|
__touch_state__.set(graph, state);
|
|
9588
9623
|
let container = graph.getCanvas?.()?.getContainer?.();
|
|
@@ -9590,11 +9625,16 @@ function touch_state_of(graph) {
|
|
|
9590
9625
|
state.container = container;
|
|
9591
9626
|
let read = (event) => {
|
|
9592
9627
|
state.count = event.touches ? event.touches.length : 0;
|
|
9628
|
+
if (state.count >= 2) state.multi = true;
|
|
9629
|
+
else if (state.count === 0) state.multi = false;
|
|
9593
9630
|
};
|
|
9594
9631
|
container.addEventListener("touchstart", read, { passive: true });
|
|
9595
9632
|
container.addEventListener("touchmove", read, { passive: true });
|
|
9596
9633
|
container.addEventListener("touchend", read, { passive: true });
|
|
9597
9634
|
container.addEventListener("touchcancel", read, { passive: true });
|
|
9635
|
+
container.addEventListener("contextmenu", (event) => {
|
|
9636
|
+
if (state.count > 0) event.preventDefault();
|
|
9637
|
+
}, { capture: true });
|
|
9598
9638
|
return state;
|
|
9599
9639
|
}
|
|
9600
9640
|
/************************************************************
|
|
@@ -9695,6 +9735,24 @@ function ensure_pinch_zoom_patch() {
|
|
|
9695
9735
|
* Long press
|
|
9696
9736
|
***************************/
|
|
9697
9737
|
/************************************************************
|
|
9738
|
+
* Is the click being dispatched right now the tail of a long
|
|
9739
|
+
* press? Answers true ONCE, to the first asker.
|
|
9740
|
+
*
|
|
9741
|
+
* @antv/g does not take `click` from the DOM either: it makes
|
|
9742
|
+
* one out of the pointerdown/pointerup pair itself, inside
|
|
9743
|
+
* the same `onPointerUp` that just fed us the release. So
|
|
9744
|
+
* the press that opened the menu goes on to click whatever it
|
|
9745
|
+
* opened the menu ON -- selecting the node, or worse, dropping
|
|
9746
|
+
* a selection of several -- unless the handler asks.
|
|
9747
|
+
************************************************************/
|
|
9748
|
+
function consume_long_press_click(graph) {
|
|
9749
|
+
if (!graph) return false;
|
|
9750
|
+
let state = __touch_state__.get(graph);
|
|
9751
|
+
if (!state || !state.long_press_click) return false;
|
|
9752
|
+
state.long_press_click = false;
|
|
9753
|
+
return true;
|
|
9754
|
+
}
|
|
9755
|
+
/************************************************************
|
|
9698
9756
|
* Make a long press open the context menu.
|
|
9699
9757
|
*
|
|
9700
9758
|
* Returns the function that uninstalls it.
|
|
@@ -9704,19 +9762,26 @@ function ensure_pinch_zoom_patch() {
|
|
|
9704
9762
|
* the name the plugin listens for, so `getItems(e)` and
|
|
9705
9763
|
* `enable(e)` see the same object a right-click would give
|
|
9706
9764
|
* them -- same `target`, same `targetType`, same `client`.
|
|
9765
|
+
*
|
|
9766
|
+
* `options.enable(event)` decides, at the DOWN, whether this
|
|
9767
|
+
* press is even a candidate. Pass the plugin's own predicate:
|
|
9768
|
+
* a press on the empty canvas would otherwise arm a menu the
|
|
9769
|
+
* plugin then refuses to show, and swallow the click that
|
|
9770
|
+
* would have cleared the selection.
|
|
9707
9771
|
************************************************************/
|
|
9708
|
-
function install_long_press_contextmenu(graph) {
|
|
9772
|
+
function install_long_press_contextmenu(graph, options) {
|
|
9709
9773
|
if (!graph) return () => {};
|
|
9774
|
+
let enable = options?.enable;
|
|
9710
9775
|
let state = touch_state_of(graph);
|
|
9711
9776
|
let pending = null;
|
|
9712
|
-
let
|
|
9713
|
-
|
|
9714
|
-
clearTimeout(pending.timer);
|
|
9715
|
-
pending = null;
|
|
9716
|
-
}
|
|
9777
|
+
let disarm = () => {
|
|
9778
|
+
pending = null;
|
|
9717
9779
|
};
|
|
9718
9780
|
let fire = (event) => {
|
|
9719
|
-
|
|
9781
|
+
state.long_press_click = true;
|
|
9782
|
+
setTimeout(() => {
|
|
9783
|
+
state.long_press_click = false;
|
|
9784
|
+
}, 0);
|
|
9720
9785
|
let swallow = (evt) => {
|
|
9721
9786
|
evt.stopPropagation();
|
|
9722
9787
|
document.removeEventListener("click", swallow, true);
|
|
@@ -9725,51 +9790,60 @@ function install_long_press_contextmenu(graph) {
|
|
|
9725
9790
|
setTimeout(() => {
|
|
9726
9791
|
document.removeEventListener("click", swallow, true);
|
|
9727
9792
|
}, 1e3);
|
|
9728
|
-
let container = graph.getCanvas?.()?.getContainer?.();
|
|
9729
|
-
if (container) container.addEventListener("contextmenu", (evt) => {
|
|
9730
|
-
evt.preventDefault();
|
|
9731
|
-
}, {
|
|
9732
|
-
once: true,
|
|
9733
|
-
capture: true
|
|
9734
|
-
});
|
|
9735
9793
|
graph.emit(`${event.targetType}:${_antv_g6.CommonEvent.CONTEXT_MENU}`, event);
|
|
9736
9794
|
graph.emit(_antv_g6.CommonEvent.CONTEXT_MENU, event);
|
|
9737
9795
|
};
|
|
9738
9796
|
let on_down = (event) => {
|
|
9739
|
-
|
|
9797
|
+
disarm();
|
|
9740
9798
|
if (event.pointerType !== "touch") return;
|
|
9741
|
-
if (state.count > 1) return;
|
|
9799
|
+
if (state.count > 1 || state.multi) return;
|
|
9800
|
+
if (enable && !enable(event)) return;
|
|
9742
9801
|
let x = event.client?.x;
|
|
9743
9802
|
let y = event.client?.y;
|
|
9744
9803
|
if (x === void 0 || y === void 0) return;
|
|
9745
|
-
let frozen = Object.assign({}, event);
|
|
9746
9804
|
pending = {
|
|
9747
9805
|
x,
|
|
9748
9806
|
y,
|
|
9749
|
-
|
|
9750
|
-
|
|
9751
|
-
}, LONG_PRESS_MS)
|
|
9807
|
+
t0: Date.now(),
|
|
9808
|
+
event: Object.assign({}, event)
|
|
9752
9809
|
};
|
|
9753
9810
|
};
|
|
9754
9811
|
let on_move = (event) => {
|
|
9755
9812
|
if (!pending) return;
|
|
9756
|
-
if (state.count > 1) {
|
|
9757
|
-
|
|
9813
|
+
if (state.count > 1 || state.multi) {
|
|
9814
|
+
disarm();
|
|
9758
9815
|
return;
|
|
9759
9816
|
}
|
|
9760
9817
|
let x = event.client?.x;
|
|
9761
9818
|
let y = event.client?.y;
|
|
9762
9819
|
if (x === void 0 || y === void 0) return;
|
|
9763
|
-
if (
|
|
9820
|
+
if (press_moved(pending, x, y)) disarm();
|
|
9764
9821
|
};
|
|
9822
|
+
let on_up = (event) => {
|
|
9823
|
+
let press = pending;
|
|
9824
|
+
pending = null;
|
|
9825
|
+
if (!press) return;
|
|
9826
|
+
if (state.multi) return;
|
|
9827
|
+
let x = event.client?.x;
|
|
9828
|
+
let y = event.client?.y;
|
|
9829
|
+
if (x === void 0) x = press.x;
|
|
9830
|
+
if (y === void 0) y = press.y;
|
|
9831
|
+
if (classify_press(press, x, y, Date.now()) !== "long") return;
|
|
9832
|
+
fire(press.event);
|
|
9833
|
+
};
|
|
9834
|
+
let on_touch_cancel = () => {
|
|
9835
|
+
disarm();
|
|
9836
|
+
};
|
|
9837
|
+
state.container?.addEventListener("touchcancel", on_touch_cancel);
|
|
9765
9838
|
graph.on(_antv_g6.CommonEvent.POINTER_DOWN, on_down);
|
|
9766
9839
|
graph.on(_antv_g6.CommonEvent.POINTER_MOVE, on_move);
|
|
9767
|
-
graph.on(_antv_g6.CommonEvent.POINTER_UP,
|
|
9840
|
+
graph.on(_antv_g6.CommonEvent.POINTER_UP, on_up);
|
|
9768
9841
|
return () => {
|
|
9769
|
-
|
|
9842
|
+
disarm();
|
|
9843
|
+
state.container?.removeEventListener("touchcancel", on_touch_cancel);
|
|
9770
9844
|
graph.off(_antv_g6.CommonEvent.POINTER_DOWN, on_down);
|
|
9771
9845
|
graph.off(_antv_g6.CommonEvent.POINTER_MOVE, on_move);
|
|
9772
|
-
graph.off(_antv_g6.CommonEvent.POINTER_UP,
|
|
9846
|
+
graph.off(_antv_g6.CommonEvent.POINTER_UP, on_up);
|
|
9773
9847
|
};
|
|
9774
9848
|
}
|
|
9775
9849
|
//#endregion
|
|
@@ -47977,6 +48051,7 @@ function configure_events(gobj) {
|
|
|
47977
48051
|
let priv = gobj.priv;
|
|
47978
48052
|
let graph = priv.graph;
|
|
47979
48053
|
graph.on(_antv_g6.CanvasEvent.CLICK, (evt) => {
|
|
48054
|
+
if (consume_long_press_click(graph)) return;
|
|
47980
48055
|
(0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_CANVAS_CLICK", { evt }, gobj);
|
|
47981
48056
|
});
|
|
47982
48057
|
graph.on(_antv_g6.NodeEvent.DRAG, (evt) => {
|
|
@@ -47990,12 +48065,14 @@ function configure_events(gobj) {
|
|
|
47990
48065
|
(0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_NODE_DRAG_END", { evt }, gobj);
|
|
47991
48066
|
});
|
|
47992
48067
|
graph.on(_antv_g6.NodeEvent.CLICK, (evt) => {
|
|
48068
|
+
if (consume_long_press_click(graph)) return;
|
|
47993
48069
|
(0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_NODE_CLICK", { evt }, gobj);
|
|
47994
48070
|
});
|
|
47995
48071
|
graph.on(_antv_g6.NodeEvent.CONTEXT_MENU, (evt) => {
|
|
47996
48072
|
(0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_NODE_CONTEXT_MENU", { evt }, gobj);
|
|
47997
48073
|
});
|
|
47998
48074
|
graph.on(_antv_g6.EdgeEvent.CLICK, (evt) => {
|
|
48075
|
+
if (consume_long_press_click(graph)) return;
|
|
47999
48076
|
(0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_EDGE_CLICK", { evt }, gobj);
|
|
48000
48077
|
});
|
|
48001
48078
|
graph.on("aftertransform", () => {
|
|
@@ -48059,6 +48136,9 @@ function configure_plugins(gobj) {
|
|
|
48059
48136
|
update_toolbar(gobj);
|
|
48060
48137
|
}
|
|
48061
48138
|
});
|
|
48139
|
+
let menu_enable = (e) => {
|
|
48140
|
+
return e.targetType === "node" || e.targetType === "edge";
|
|
48141
|
+
};
|
|
48062
48142
|
graph_add_plugin(gobj, "contextmenu", {
|
|
48063
48143
|
trigger: "contextmenu",
|
|
48064
48144
|
onClick: (value) => {
|
|
@@ -48067,12 +48147,10 @@ function configure_plugins(gobj) {
|
|
|
48067
48147
|
getItems: (e) => {
|
|
48068
48148
|
return build_context_menu_items(gobj, e);
|
|
48069
48149
|
},
|
|
48070
|
-
enable:
|
|
48071
|
-
return e.targetType === "node" || e.targetType === "edge";
|
|
48072
|
-
}
|
|
48150
|
+
enable: menu_enable
|
|
48073
48151
|
});
|
|
48074
48152
|
if (priv._uninstall_long_press) priv._uninstall_long_press();
|
|
48075
|
-
priv._uninstall_long_press = install_long_press_contextmenu(priv.graph);
|
|
48153
|
+
priv._uninstall_long_press = install_long_press_contextmenu(priv.graph, { enable: menu_enable });
|
|
48076
48154
|
if ((0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "with_toolbar")) {
|
|
48077
48155
|
configure_toolbar(gobj);
|
|
48078
48156
|
configure_toolbar_edit(gobj);
|
|
@@ -53136,6 +53214,40 @@ function destroy_ui$1(gobj) {
|
|
|
53136
53214
|
}
|
|
53137
53215
|
}
|
|
53138
53216
|
/************************************************************
|
|
53217
|
+
* The label of an option of the two selects of the toolbar.
|
|
53218
|
+
*
|
|
53219
|
+
* Both of them used to render their RAW names -- `reading`,
|
|
53220
|
+
* `edition`, `dagre`, `manual` -- in every language, because
|
|
53221
|
+
* neither went through `t()` at all. Not a missing key: a
|
|
53222
|
+
* missing call.
|
|
53223
|
+
*
|
|
53224
|
+
* Written as one literal per case, and deliberately not as
|
|
53225
|
+
* `t(name)`: a consumer's `validate-locales.mjs` reads
|
|
53226
|
+
* LITERALS, so a variable key is invisible to it -- the app
|
|
53227
|
+
* ships without the entry and nothing says so, because
|
|
53228
|
+
* i18next answers an unknown key with the key itself, which
|
|
53229
|
+
* is exactly the English word that was there before. The
|
|
53230
|
+
* same reason the keys are listed in the README.
|
|
53231
|
+
*
|
|
53232
|
+
* The default is what a host that adds a layout of its own
|
|
53233
|
+
* gets: the name it chose, which is what all of them got
|
|
53234
|
+
* until now.
|
|
53235
|
+
************************************************************/
|
|
53236
|
+
function option_label(name) {
|
|
53237
|
+
switch (name) {
|
|
53238
|
+
case "reading": return (0, i18next.t)("reading");
|
|
53239
|
+
case "operation": return (0, i18next.t)("operation");
|
|
53240
|
+
case "writing": return (0, i18next.t)("writing");
|
|
53241
|
+
case "edition": return (0, i18next.t)("edition");
|
|
53242
|
+
case "manual": return (0, i18next.t)("manual");
|
|
53243
|
+
case "dagre": return (0, i18next.t)("dagre");
|
|
53244
|
+
case "antv-dagre": return (0, i18next.t)("antv-dagre");
|
|
53245
|
+
case "d3-force": return (0, i18next.t)("d3-force");
|
|
53246
|
+
case "force-atlas2": return (0, i18next.t)("force-atlas2");
|
|
53247
|
+
default: return name;
|
|
53248
|
+
}
|
|
53249
|
+
}
|
|
53250
|
+
/************************************************************
|
|
53139
53251
|
*
|
|
53140
53252
|
************************************************************/
|
|
53141
53253
|
function make_toolbar(gobj) {
|
|
@@ -53178,8 +53290,11 @@ function make_toolbar(gobj) {
|
|
|
53178
53290
|
{ class: "GRAPH_MODE_SELECT" },
|
|
53179
53291
|
modes.map((item) => [
|
|
53180
53292
|
"option",
|
|
53181
|
-
{
|
|
53182
|
-
|
|
53293
|
+
{
|
|
53294
|
+
value: item,
|
|
53295
|
+
"data-i18n": item
|
|
53296
|
+
},
|
|
53297
|
+
option_label(item)
|
|
53183
53298
|
])
|
|
53184
53299
|
]],
|
|
53185
53300
|
{ change: (evt) => {
|
|
@@ -53518,7 +53633,8 @@ function populate_nodes_tree_options(gobj) {
|
|
|
53518
53633
|
for (let name of layout_names) {
|
|
53519
53634
|
let option = document.createElement("option");
|
|
53520
53635
|
option.value = name;
|
|
53521
|
-
option.
|
|
53636
|
+
option.setAttribute("data-i18n", name);
|
|
53637
|
+
option.textContent = option_label(name);
|
|
53522
53638
|
$layout_select.appendChild(option);
|
|
53523
53639
|
}
|
|
53524
53640
|
let current_layout = (0, _yuneta_gobj_js.gobj_read_str_attr)(priv.gobj_nodes_tree, "layout");
|