@yuneta/gobj-ui 7.23.105 → 7.23.107

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.
@@ -56082,8 +56082,13 @@ function figure_shape_of(gobj, desc, record, geometry, flags) {
56082
56082
  let labels = (0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "node_labels");
56083
56083
  let figure = node_figure_of(gobj, desc, geometry || {});
56084
56084
  let paint = node_paint_of(gobj, desc, geometry);
56085
- let stroke = paint.stroke;
56086
- let line_width = Math.max(paint.lineWidth, 1.5);
56085
+ let fill = dark ? mix_colors(paint.fill, .25, "#2c3542") : mix_colors(paint.fill, .1, "#ffffff");
56086
+ let stroke = dark ? mix_colors(paint.fill, .85, "#ffffff") : paint.fill;
56087
+ let line_width = 2;
56088
+ if (paint.stroke !== getStrokeColor(paint.fill)) {
56089
+ stroke = paint.stroke;
56090
+ line_width = Math.max(paint.lineWidth, 2);
56091
+ }
56087
56092
  if (f.selected) {
56088
56093
  stroke = SELECT_RING;
56089
56094
  line_width = 3;
@@ -56101,7 +56106,7 @@ function figure_shape_of(gobj, desc, record, geometry, flags) {
56101
56106
  let style = {
56102
56107
  size: [side, side],
56103
56108
  radius: figure === "square" ? Math.round(side / 5) : 0,
56104
- fill: paint.fill,
56109
+ fill,
56105
56110
  stroke,
56106
56111
  lineWidth: line_width,
56107
56112
  lineDash: dash,
@@ -63919,6 +63924,7 @@ function ac_layout_autoset(gobj, event, kw, src) {
63919
63924
  function ac_camera_changed(gobj, event, kw, src) {
63920
63925
  (0, _yuneta_gobj_js.gobj_write_attr)(gobj, "camera", {
63921
63926
  zoom: kw.zoom,
63927
+ node: kw.node,
63922
63928
  x: kw.x,
63923
63929
  y: kw.y
63924
63930
  });
@@ -56077,8 +56077,13 @@ function figure_shape_of(gobj, desc, record, geometry, flags) {
56077
56077
  let labels = gobj_read_bool_attr(gobj, "node_labels");
56078
56078
  let figure = node_figure_of(gobj, desc, geometry || {});
56079
56079
  let paint = node_paint_of(gobj, desc, geometry);
56080
- let stroke = paint.stroke;
56081
- let line_width = Math.max(paint.lineWidth, 1.5);
56080
+ let fill = dark ? mix_colors(paint.fill, .25, "#2c3542") : mix_colors(paint.fill, .1, "#ffffff");
56081
+ let stroke = dark ? mix_colors(paint.fill, .85, "#ffffff") : paint.fill;
56082
+ let line_width = 2;
56083
+ if (paint.stroke !== getStrokeColor(paint.fill)) {
56084
+ stroke = paint.stroke;
56085
+ line_width = Math.max(paint.lineWidth, 2);
56086
+ }
56082
56087
  if (f.selected) {
56083
56088
  stroke = SELECT_RING;
56084
56089
  line_width = 3;
@@ -56096,7 +56101,7 @@ function figure_shape_of(gobj, desc, record, geometry, flags) {
56096
56101
  let style = {
56097
56102
  size: [side, side],
56098
56103
  radius: figure === "square" ? Math.round(side / 5) : 0,
56099
- fill: paint.fill,
56104
+ fill,
56100
56105
  stroke,
56101
56106
  lineWidth: line_width,
56102
56107
  lineDash: dash,
@@ -63914,6 +63919,7 @@ function ac_layout_autoset(gobj, event, kw, src) {
63914
63919
  function ac_camera_changed(gobj, event, kw, src) {
63915
63920
  gobj_write_attr(gobj, "camera", {
63916
63921
  zoom: kw.zoom,
63922
+ node: kw.node,
63917
63923
  x: kw.x,
63918
63924
  y: kw.y
63919
63925
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "7.23.105",
3
+ "version": "7.23.107",
4
4
  "type": "module",
5
5
  "main": "dist/gobj-ui.cjs.js",
6
6
  "module": "dist/gobj-ui.es.js",
@@ -2456,8 +2456,29 @@ function figure_shape_of(gobj, desc, record, geometry, flags)
2456
2456
  let figure = node_figure_of(gobj, desc, geometry || {});
2457
2457
  let paint = node_paint_of(gobj, desc, geometry);
2458
2458
 
2459
- let stroke = paint.stroke;
2460
- let line_width = Math.max(paint.lineWidth, 1.5);
2459
+ /* THE SAME PAINT AS THE CARD, and that is the point: a card, a
2460
+ * pill and a figure are one record drawn at three sizes, so they
2461
+ * cannot wear two different colour languages. The card is html and
2462
+ * writes `color-mix()`; a canvas shape cannot, so the same mix is
2463
+ * computed here -- with `mix_colors()`, which is in this file
2464
+ * already and for this very reason (the ports).
2465
+ *
2466
+ * It also gives the figure an EDGE. It used to be the raw topic
2467
+ * colour filled, ringed by `getStrokeColor()` -- the same colour
2468
+ * darkened 20%, which measures 1.4:1 against its own fill: not a
2469
+ * border, a ramp, and a fan of them reads as a blurred picture.
2470
+ * Tint inside, vivid colour around it, and the canto is there. */
2471
+ let fill = dark? mix_colors(paint.fill, 0.25, "#2c3542")
2472
+ : mix_colors(paint.fill, 0.10, "#ffffff");
2473
+ let stroke = dark? mix_colors(paint.fill, 0.85, "#ffffff") : paint.fill;
2474
+ let line_width = 2;
2475
+ /* A paint somebody CHOSE (a node's or a topic's own, saved in
2476
+ * `__graphs__`) is not ours to reinterpret: it comes through as
2477
+ * it was chosen. */
2478
+ if(paint.stroke !== getStrokeColor(paint.fill)) {
2479
+ stroke = paint.stroke;
2480
+ line_width = Math.max(paint.lineWidth, 2);
2481
+ }
2461
2482
  if(f.selected) {
2462
2483
  stroke = SELECT_RING;
2463
2484
  line_width = 3;
@@ -2480,7 +2501,7 @@ function figure_shape_of(gobj, desc, record, geometry, flags)
2480
2501
  let style = {
2481
2502
  size: [side, side],
2482
2503
  radius: (figure === 'square')? Math.round(side / 5) : 0,
2483
- fill: paint.fill,
2504
+ fill: fill,
2484
2505
  stroke: stroke,
2485
2506
  lineWidth: line_width,
2486
2507
  lineDash: dash,
@@ -2900,8 +2900,13 @@ function ac_layout_autoset(gobj, event, kw, src)
2900
2900
  ************************************************************/
2901
2901
  function ac_camera_changed(gobj, event, kw, src)
2902
2902
  {
2903
+ /* `node` travels with the rest and is not optional: a camera is a
2904
+ * NODE at a viewport pixel, and one rebuilt here as `{zoom, x, y}`
2905
+ * -- which is what this did -- is a camera the engine refuses to
2906
+ * restore, so the graph came back at the right zoom in the wrong
2907
+ * place. Copy the fields the contract names, all of them. */
2903
2908
  gobj_write_attr(gobj, "camera", {
2904
- zoom: kw.zoom, x: kw.x, y: kw.y
2909
+ zoom: kw.zoom, node: kw.node, x: kw.x, y: kw.y
2905
2910
  });
2906
2911
  gobj_save_persistent_attrs(gobj, "camera");
2907
2912
  return 0;