@grafloria/element 0.4.46 → 0.4.48

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": "@grafloria/element",
3
- "version": "0.4.46",
3
+ "version": "0.4.48",
4
4
  "type": "module",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
@@ -1264,8 +1264,10 @@ export function bindDashboardGrid(api, group, options = {}) {
1264
1264
  const TAB_FRAME_GRIP = 3;
1265
1265
  const edgeGripFor = (grp) => (isTabsGroup(grp) ? TAB_FRAME_GRIP : EDGE_GRIP);
1266
1266
  const BESIDE_BAND = 0.2;
1267
+ /** How much wider the band is for a pointer ALREADY in it — a hand resting on the boundary must not flicker between beside and into. */
1268
+ const BESIDE_STAY = 0.05;
1267
1269
  /** The outer band of a container FRAME the point is in — null in the strip, in the middle, or outside. */
1268
- const bandOf = (f, wx, wy) => {
1270
+ const bandOf = (f, wx, wy, band = BESIDE_BAND) => {
1269
1271
  if (wx < f.x || wx > f.x + f.width || wy < f.y || wy > f.y + f.height)
1270
1272
  return null;
1271
1273
  const bodyY = f.y + TAB_STRIP_HEIGHT;
@@ -1274,11 +1276,15 @@ export function bindDashboardGrid(api, group, options = {}) {
1274
1276
  const ry = (wy - bodyY) / bodyH;
1275
1277
  if (ry < 0)
1276
1278
  return null; // the strip: a new tab, the strip's own business
1277
- if (rx >= BESIDE_BAND && rx <= 1 - BESIDE_BAND && ry >= BESIDE_BAND && ry <= 1 - BESIDE_BAND)
1278
- return null; // the middle: into the page
1279
- const d = [['left', rx], ['right', 1 - rx], ['top', ry], ['bottom', 1 - ry]];
1280
- d.sort((a, b) => a[1] - b[1]);
1281
- return d[0][0];
1279
+ if (rx < band)
1280
+ return 'left'; // the sides first: they take the corners
1281
+ if (rx > 1 - band)
1282
+ return 'right';
1283
+ if (ry < band)
1284
+ return 'top';
1285
+ if (ry > 1 - band)
1286
+ return 'bottom';
1287
+ return null; // the middle: into the page
1282
1288
  };
1283
1289
  const besideZoneAt = (wx, wy) => {
1284
1290
  var _a;
@@ -2072,6 +2078,7 @@ export function bindDashboardGrid(api, group, options = {}) {
2072
2078
  g.leg.adopted.abort();
2073
2079
  g.leg = null;
2074
2080
  }
2081
+ endBeside(true); // a band's shift gives way to the strip: the container comes back
2075
2082
  if (!g.removedFromBoard) {
2076
2083
  g.removedFromBoard = true;
2077
2084
  engine.remove(g.id);
@@ -2092,7 +2099,8 @@ export function bindDashboardGrid(api, group, options = {}) {
2092
2099
  }
2093
2100
  }
2094
2101
  // BESIDE a tab container (0.4.45): its outer band puts the widget next
2095
- // to it — at the board's edge the container shifts over to make room.
2102
+ // to it — at the board's edge the container shifts over to make room,
2103
+ // live and gliding, like any widget gives way (0.4.48).
2096
2104
  if (!isStatic) {
2097
2105
  const z = besideZoneAt(ev.world.x, ev.world.y);
2098
2106
  if (z) {
@@ -2108,16 +2116,18 @@ export function bindDashboardGrid(api, group, options = {}) {
2108
2116
  // read as "elsewhere" a move later, and the shift undid itself).
2109
2117
  // "Still here" is the pointer in the SAME band of the container's
2110
2118
  // ORIGINAL frame (it asked for beside from there, and the container
2111
- // is what moved) or over the cell the widget took: a one-row
2112
- // widget's cell is not where a hand hovering the band sits, and
2113
- // testing only that undid the shift on the next move, which pushed
2114
- // the widget to the bottom as the panel came back (live walk N).
2115
- // "Anywhere inside the original frame" is too much: a hand crossing
2116
- // the bottom band on its way to the middle never reached the page
2117
- // (lab L73) the middle of the original frame is a zone change.
2119
+ // is what moved; the band is a little wider for a hand already in
2120
+ // it, so it does not flicker against "into the page" at the line)
2121
+ // or over the cell the widget took: a one-row widget's cell is not
2122
+ // where a hand hovering the band sits, and testing only that undid
2123
+ // the shift on the next move, which pushed the widget to the bottom
2124
+ // as the panel came back (live walk N). "Anywhere inside the
2125
+ // original frame" is too much: a hand crossing the bottom band on
2126
+ // its way to the middle never reached the page (lab L73) — the
2127
+ // middle of the original frame is a zone change.
2118
2128
  const r = cellToRect({ x: beside.vacated.x, y: beside.vacated.y, w: g.spans.w, h: g.spans.h }, frame(), geom(), rows());
2119
2129
  const inR = (q) => ev.world.x >= q.x - gap && ev.world.x <= q.x + q.width + gap && ev.world.y >= q.y - gap && ev.world.y <= q.y + q.height + gap;
2120
- const over = bandOf(beside.frame0, ev.world.x, ev.world.y) === beside.side || inR(r);
2130
+ const over = bandOf(beside.frame0, ev.world.x, ev.world.y, BESIDE_BAND + BESIDE_STAY) === beside.side || inR(r);
2121
2131
  if (!over)
2122
2132
  endBeside(true);
2123
2133
  else {