@yuneta/gobj-ui 7.31.2 → 7.31.4

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
@@ -2624,7 +2624,9 @@ ringed with it and the two rows it joins -- the hook of the parent and the fkey
2624
2624
  of the child -- washed, so a line says which two fields it ties. A second click
2625
2625
  on the same edge, or a click on the canvas, puts it out. The treedb graph
2626
2626
  (`C_G6_NODES_TREE`) lights an edge and its two records the same way, except in
2627
- `edition`, where a click selects the edge. And the drawing always carries a
2627
+ `edition`, where a click selects the edge. In both graphs an edge takes a
2628
+ click some 7px either side of its line (`increasedLineWidthForHitTesting: 14`,
2629
+ `7.31.3`; G6's default adds 2px to a line a couple of px wide). And the drawing always carries a
2628
2630
  **minimap** (bottom left, the library's `yui_graph_minimap.js`), because a
2629
2631
  schema of more cards than the screen holds is the usual case.
2630
2632
 
@@ -67291,7 +67291,8 @@ function build_graph$1(gobj) {
67291
67291
  edge: {
67292
67292
  style: {
67293
67293
  startArrow: true,
67294
- endArrow: false
67294
+ endArrow: false,
67295
+ increasedLineWidthForHitTesting: 14
67295
67296
  },
67296
67297
  state: { lit: () => ({
67297
67298
  stroke: highlight_color(priv.theme),
@@ -78606,6 +78607,7 @@ var LIT_COLOR_DARK = "#f0a020";
78606
78607
  var LIT_COLOR_LIGHT = "#b45309";
78607
78608
  var LIT_HALO_DARK = "rgba(240,160,32,0.35)";
78608
78609
  var LIT_HALO_LIGHT = "rgba(180,83,9,0.35)";
78610
+ var EDGE_HIT_WIDTH = 14;
78609
78611
  /***************************************************************
78610
78612
  * Data
78611
78613
  ***************************************************************/
@@ -79014,7 +79016,8 @@ function schema_to_graph(gobj) {
79014
79016
  function edge_style(dark) {
79015
79017
  return {
79016
79018
  stroke: dark ? "#7a8593" : "#9aa4b2",
79017
- lineWidth: 1.2,
79019
+ lineWidth: 2,
79020
+ increasedLineWidthForHitTesting: EDGE_HIT_WIDTH,
79018
79021
  startArrow: true,
79019
79022
  endArrow: false
79020
79023
  };
@@ -79030,7 +79033,7 @@ function edge_options(dark) {
79030
79033
  style: edge_style(dark),
79031
79034
  state: { lit: {
79032
79035
  stroke: dark ? LIT_COLOR_DARK : LIT_COLOR_LIGHT,
79033
- lineWidth: 3,
79036
+ lineWidth: 4,
79034
79037
  halo: true,
79035
79038
  haloStroke: dark ? LIT_HALO_DARK : LIT_HALO_LIGHT,
79036
79039
  haloLineWidth: 8
@@ -67286,7 +67286,8 @@ function build_graph$1(gobj) {
67286
67286
  edge: {
67287
67287
  style: {
67288
67288
  startArrow: true,
67289
- endArrow: false
67289
+ endArrow: false,
67290
+ increasedLineWidthForHitTesting: 14
67290
67291
  },
67291
67292
  state: { lit: () => ({
67292
67293
  stroke: highlight_color(priv.theme),
@@ -78601,6 +78602,7 @@ var LIT_COLOR_DARK = "#f0a020";
78601
78602
  var LIT_COLOR_LIGHT = "#b45309";
78602
78603
  var LIT_HALO_DARK = "rgba(240,160,32,0.35)";
78603
78604
  var LIT_HALO_LIGHT = "rgba(180,83,9,0.35)";
78605
+ var EDGE_HIT_WIDTH = 14;
78604
78606
  /***************************************************************
78605
78607
  * Data
78606
78608
  ***************************************************************/
@@ -79009,7 +79011,8 @@ function schema_to_graph(gobj) {
79009
79011
  function edge_style(dark) {
79010
79012
  return {
79011
79013
  stroke: dark ? "#7a8593" : "#9aa4b2",
79012
- lineWidth: 1.2,
79014
+ lineWidth: 2,
79015
+ increasedLineWidthForHitTesting: EDGE_HIT_WIDTH,
79013
79016
  startArrow: true,
79014
79017
  endArrow: false
79015
79018
  };
@@ -79025,7 +79028,7 @@ function edge_options(dark) {
79025
79028
  style: edge_style(dark),
79026
79029
  state: { lit: {
79027
79030
  stroke: dark ? LIT_COLOR_DARK : LIT_COLOR_LIGHT,
79028
- lineWidth: 3,
79031
+ lineWidth: 4,
79029
79032
  halo: true,
79030
79033
  haloStroke: dark ? LIT_HALO_DARK : LIT_HALO_LIGHT,
79031
79034
  haloLineWidth: 8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "7.31.2",
3
+ "version": "7.31.4",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "dist/gobj-ui.cjs.js",
@@ -1238,6 +1238,9 @@ function build_graph(gobj)
1238
1238
  style: {
1239
1239
  startArrow: true, // HACK target/source interchanged
1240
1240
  endArrow: false,
1241
+ /* A line of 1.6px is a 1.6px target: answer a click
1242
+ * some px around it (G6's default adds 2). */
1243
+ increasedLineWidthForHitTesting: 14,
1241
1244
  },
1242
1245
  /* An edge lit by a click (light_edge): the amber of a find
1243
1246
  * match, its two ends painted with it. A callback, so a
@@ -125,6 +125,10 @@ const LIT_COLOR_LIGHT = "#b45309";
125
125
  const LIT_HALO_DARK = "rgba(240,160,32,0.35)";
126
126
  const LIT_HALO_LIGHT = "rgba(180,83,9,0.35)";
127
127
 
128
+ /* The width an edge answers a click on, in px: a line drawn 2px
129
+ * wide is a 2px target, and G6's default adds only 2 more. */
130
+ const EDGE_HIT_WIDTH = 14;
131
+
128
132
  /***************************************************************
129
133
  * Data
130
134
  ***************************************************************/
@@ -642,7 +646,8 @@ function edge_style(dark)
642
646
  {
643
647
  return {
644
648
  stroke: dark ? "#7a8593" : "#9aa4b2",
645
- lineWidth: 1.2,
649
+ lineWidth: 2,
650
+ increasedLineWidthForHitTesting: EDGE_HIT_WIDTH,
646
651
  startArrow: true,
647
652
  endArrow: false,
648
653
  };
@@ -661,7 +666,7 @@ function edge_options(dark)
661
666
  state: {
662
667
  lit: {
663
668
  stroke: dark? LIT_COLOR_DARK : LIT_COLOR_LIGHT,
664
- lineWidth: 3,
669
+ lineWidth: 4,
665
670
  halo: true,
666
671
  haloStroke: dark? LIT_HALO_DARK : LIT_HALO_LIGHT,
667
672
  haloLineWidth: 8,
@@ -1372,6 +1372,11 @@ describe("a click on an edge lights it and its two ends (not in edition)", () =>
1372
1372
  return b;
1373
1373
  }
1374
1374
 
1375
+ test("an edge answers a click well around its line", async () => {
1376
+ const {graph} = await reading();
1377
+ expect(graph.options.edge.style.increasedLineWidthForHitTesting).toBeGreaterThanOrEqual(10);
1378
+ });
1379
+
1375
1380
  test("the edge takes the lit state, its ends are painted, the host still hears the click", async () => {
1376
1381
  const {tree, states} = await reading();
1377
1382
  gobj_send_event(tree, "EV_EDGE_CLICK", {id: "e1"}, tree);
@@ -178,6 +178,9 @@ describe("C_YUI_TREEDB_SCHEMA: minimap and lit edge", () => {
178
178
  expect(minimap.type).toBe("minimap");
179
179
  expect(minimap.containerStyle).toMatchObject({top: "auto", bottom: "12px"});
180
180
  expect(graph.edge_options.state.lit).toBeTruthy();
181
+ /* a 2px line is a 2px target: the click is taken well around it */
182
+ expect(graph.edge_options.style.lineWidth).toBeGreaterThanOrEqual(2);
183
+ expect(graph.edge_options.style.increasedLineWidthForHitTesting).toBeGreaterThanOrEqual(10);
181
184
  });
182
185
 
183
186
  test("an edge click lights the edge, its two cards and the two rows", async () => {