@yuneta/gobj-ui 7.23.28 → 7.23.30

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "7.23.28",
3
+ "version": "7.23.30",
4
4
  "type": "module",
5
5
  "main": "dist/gobj-ui.cjs.js",
6
6
  "module": "dist/gobj-ui.es.js",
@@ -1273,8 +1273,11 @@ function configure_toolbar(gobj)
1273
1273
  * the rebuild came back OFF. */
1274
1274
  {
1275
1275
  id: 'g6-icon-anchor', value: 'anchor',
1276
+ /* PRESSED is "on" and only "on": pressed is the
1277
+ * state the control is IN, and while it is
1278
+ * arming it is asking for something instead. */
1276
1279
  className: 'EV_TOGGLE_ANCHOR' +
1277
- (priv.anchor_state !== "off"? ' pressed_state' : '') +
1280
+ (priv.anchor_state === "on"? ' pressed_state' : '') +
1278
1281
  (priv.anchor_state === "arming"? ' color_pending_state' : ''),
1279
1282
  title: anchor_title(priv.anchor_state)
1280
1283
  },
@@ -5743,7 +5746,7 @@ function refresh_minimap(gobj)
5743
5746
  * same three-way choice — it lived inline in the theme refresh and is
5744
5747
  * shared now. Returns null for a node that carries no desc.
5745
5748
  ************************************************************/
5746
- function node_innerHTML_of(nd, theme, highlight, selected)
5749
+ function node_innerHTML_of(nd, theme, highlight, selected, anchored)
5747
5750
  {
5748
5751
  if(!nd || !nd.data || !nd.data.desc) {
5749
5752
  return null;
@@ -5756,17 +5759,17 @@ function node_innerHTML_of(nd, theme, highlight, selected)
5756
5759
  case 'child':
5757
5760
  return build_chip_innerHTML(
5758
5761
  desc.color, theme, record.icon, label, record.id,
5759
- highlight, selected
5762
+ highlight, selected, anchored
5760
5763
  );
5761
5764
  case 'extended':
5762
5765
  return build_node_innerHTML(
5763
5766
  desc.color, theme, record.icon, label,
5764
- desc.topic_name, true, record.id, highlight, selected
5767
+ desc.topic_name, true, record.id, highlight, selected, anchored
5765
5768
  );
5766
5769
  case 'hierarchical':
5767
5770
  return build_node_innerHTML(
5768
5771
  desc.color, theme, record.icon, label,
5769
- desc.topic_name, false, record.id, highlight, selected
5772
+ desc.topic_name, false, record.id, highlight, selected, anchored
5770
5773
  );
5771
5774
  }
5772
5775
  return null;
@@ -5796,7 +5799,8 @@ function repaint_cards(gobj, ids)
5796
5799
  let updates = [];
5797
5800
  for(let id of ids) {
5798
5801
  let html = node_innerHTML_of(
5799
- graph.getNodeData(id), priv.theme, focus.has(id), selected.has(id)
5802
+ graph.getNodeData(id), priv.theme, focus.has(id), selected.has(id),
5803
+ priv.anchor_state === "on" && id === priv.anchor_id
5800
5804
  );
5801
5805
  if(html !== null) {
5802
5806
  updates.push({id: id, style: {innerHTML: html}});
@@ -5902,6 +5906,25 @@ function refresh_default_edges_theme(gobj, theme)
5902
5906
  * it, which is also the order that reads correctly when only one
5903
5907
  * of them is on.
5904
5908
  ************************************************************/
5909
+ /************************************************************
5910
+ * The mark of the card the CAMERA is holding.
5911
+ *
5912
+ * An outline and not another ring, and DASHED: the two rings
5913
+ * already mean things here -- amber is a find match or a
5914
+ * focused topic, blue is the selection -- and a third solid
5915
+ * ring would be a third thing to learn in the same channel.
5916
+ * A dash is a different channel, so it reads beside either of
5917
+ * them, and it says "provisional" the way a camera state is.
5918
+ *
5919
+ * The same dash the other two viewers draw: this is one
5920
+ * feature with one control, and it should not be three
5921
+ * drawings.
5922
+ ************************************************************/
5923
+ function anchor_outline(anchored)
5924
+ {
5925
+ return anchored? "outline: 3px dashed #fa8c16; outline-offset: 2px;" : "";
5926
+ }
5927
+
5905
5928
  function ring_shadow(highlight, selected, base_shadow)
5906
5929
  {
5907
5930
  let rings = [];
@@ -5928,7 +5951,7 @@ function ring_shadow(highlight, selected, base_shadow)
5928
5951
  * but lighter (1px border, no shadow, single line). The name is
5929
5952
  * always legible (ellipsis + native title tooltip on overflow).
5930
5953
  ************************************************************/
5931
- function build_chip_innerHTML(color, theme, icon, label, key, highlight, selected)
5954
+ function build_chip_innerHTML(color, theme, icon, label, key, highlight, selected, anchored)
5932
5955
  {
5933
5956
  let title = key || label;
5934
5957
  let dark = (theme === "dark");
@@ -5953,13 +5976,14 @@ function build_chip_innerHTML(color, theme, icon, label, key, highlight, selecte
5953
5976
  }
5954
5977
 
5955
5978
  return `
5956
- <div title="${escapeHtml(title)}" style="
5979
+ <div class="TREEDB_CARD" title="${escapeHtml(title)}" style="
5957
5980
  box-sizing: border-box;
5958
5981
  width: 100%;
5959
5982
  height: 100%;
5960
5983
  background: ${bg};
5961
5984
  border: ${highlight? "3px" : "1px"} solid ${border};
5962
5985
  ${ring_shadow(highlight, selected, "")}
5986
+ ${anchor_outline(anchored)}
5963
5987
  border-radius: 8px;
5964
5988
  color: ${text_color};
5965
5989
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
@@ -5986,7 +6010,7 @@ function build_chip_innerHTML(color, theme, icon, label, key, highlight, selecte
5986
6010
  * colour is kept (per-topic differentiation) but softened via
5987
6011
  * color-mix instead of a harsh saturated fill. Theme-aware.
5988
6012
  ************************************************************/
5989
- function build_node_innerHTML(color, theme, icon, label, topic_name, structural, key, highlight, selected)
6013
+ function build_node_innerHTML(color, theme, icon, label, topic_name, structural, key, highlight, selected, anchored)
5990
6014
  {
5991
6015
  let title = key || label;
5992
6016
  let dark = (theme === "dark");
@@ -6042,7 +6066,7 @@ function build_node_innerHTML(color, theme, icon, label, topic_name, structural,
6042
6066
  }
6043
6067
 
6044
6068
  return `
6045
- <div title="${escapeHtml(title)}" style="
6069
+ <div class="TREEDB_CARD" title="${escapeHtml(title)}" style="
6046
6070
  box-sizing: border-box;
6047
6071
  width: 100%;
6048
6072
  height: 100%;
@@ -6050,6 +6074,7 @@ function build_node_innerHTML(color, theme, icon, label, topic_name, structural,
6050
6074
  border: ${highlight? "3px" : "1.5px"} ${border_style} ${border};
6051
6075
  border-radius: 10px;
6052
6076
  ${ring_shadow(highlight, selected, shadow)}
6077
+ ${anchor_outline(anchored)}
6053
6078
  color: ${title_color};
6054
6079
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
6055
6080
  display: flex;
@@ -7602,6 +7627,7 @@ function after_camera(gobj, moved)
7602
7627
  function ac_toggle_anchor(gobj, event, kw, src)
7603
7628
  {
7604
7629
  let priv = gobj.priv;
7630
+ let was = priv.anchor_id;
7605
7631
 
7606
7632
  if(priv.anchor_state === "off") {
7607
7633
  priv.anchor_state = "arming";
@@ -7611,6 +7637,9 @@ function ac_toggle_anchor(gobj, event, kw, src)
7611
7637
  }
7612
7638
 
7613
7639
  update_toolbar(gobj);
7640
+ if(was) {
7641
+ repaint_cards(gobj, new Set([was]));
7642
+ }
7614
7643
  return 0;
7615
7644
  }
7616
7645
 
@@ -7869,6 +7898,7 @@ function ac_node_click(gobj, event, kw, src)
7869
7898
  priv.anchor_id = node_id;
7870
7899
  priv.anchor_state = "on";
7871
7900
  update_toolbar(gobj);
7901
+ repaint_cards(gobj, new Set([node_id]));
7872
7902
 
7873
7903
  /* POSTED, not made here: a camera move issued inside G6's click
7874
7904
  * dispatch is swallowed -- see the note in yui_graph_center_on.