@graview/pages 0.2.6 → 0.2.8
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/dist/one-place-city.d.ts.map +1 -1
- package/dist/one-place-city.js +58 -4
- package/dist/one-place-city.js.map +1 -1
- package/dist/one-place-geometry.d.ts +11 -0
- package/dist/one-place-geometry.d.ts.map +1 -1
- package/dist/one-place-geometry.js +35 -0
- package/dist/one-place-geometry.js.map +1 -1
- package/dist/one-place.d.ts.map +1 -1
- package/dist/one-place.js +111 -22
- package/dist/one-place.js.map +1 -1
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"one-place-city.d.ts","sourceRoot":"","sources":["../src/one-place-city.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAmd,KAAK,SAAS,EAAc,MAAM,yBAAyB,CAAC;AACthB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAsGxD,iGAAiG;AACjG,eAAO,MAAM,OAAO,MAAM,CAAC;AA6C3B,wBAAgB,YAAY,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE,iBAAiB,+
|
|
1
|
+
{"version":3,"file":"one-place-city.d.ts","sourceRoot":"","sources":["../src/one-place-city.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAmd,KAAK,SAAS,EAAc,MAAM,yBAAyB,CAAC;AACthB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAsGxD,iGAAiG;AACjG,eAAO,MAAM,OAAO,MAAM,CAAC;AA6C3B,wBAAgB,YAAY,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE,iBAAiB,+BAqlEtN;AAED,YAAY,EAAE,SAAS,EAAE,CAAC;AAE1B,2IAA2I;AAC3I,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,CAI1D"}
|
package/dist/one-place-city.js
CHANGED
|
@@ -373,6 +373,19 @@ export function OnePlaceCity({ where, out, sheet, connected, boards, current, bo
|
|
|
373
373
|
};
|
|
374
374
|
/** The camera between stops this frame, as painted — the last one seen while the view takes in a move just let go. */
|
|
375
375
|
let painted = LEVEL_LIVE;
|
|
376
|
+
/*
|
|
377
|
+
* THE ZOOM THE PICTURE IS LAID OUT AT, which `painted` is over. Letting
|
|
378
|
+
* go writes the hand's zoom into the Scene's at once, while the city is
|
|
379
|
+
* still laid out at the old one under the transform held until React
|
|
380
|
+
* commits: a frame drawn in between counted the hand's zoom twice, and
|
|
381
|
+
* at Nearby a board as wide as the zoom allows drew a fifth wider for
|
|
382
|
+
* that one frame (one-face's
|
|
383
|
+
* `letGoOfAZoomEveryBoardAndNameGoesOnFromWhereTheLastFrameDrewIt`,
|
|
384
|
+
* "ctrl and the wheel over a district, further", under GRAVIEW_SLOW=4
|
|
385
|
+
* on GitHub's runner). While the view takes the move in, the zoom the
|
|
386
|
+
* last frame drew at is the one.
|
|
387
|
+
*/
|
|
388
|
+
let laidZoom = null;
|
|
376
389
|
/** The level the camera rests at, and the altitude this frame. */
|
|
377
390
|
let rest = PAGE;
|
|
378
391
|
let altitude = PAGE;
|
|
@@ -411,6 +424,8 @@ export function OnePlaceCity({ where, out, sheet, connected, boards, current, bo
|
|
|
411
424
|
let resized = false;
|
|
412
425
|
let handSince = 0;
|
|
413
426
|
let lastPlace = "";
|
|
427
|
+
/** The place a scrub under way left from. */
|
|
428
|
+
let scrubbedFrom = null;
|
|
414
429
|
let lastReported = "";
|
|
415
430
|
/* When the camera was last written into the view: the Scene settles what is painted a beat after (its wheel's rule), so nothing new is painted until that beat has passed. */
|
|
416
431
|
let committedAt = -Infinity;
|
|
@@ -1170,9 +1185,17 @@ export function OnePlaceCity({ where, out, sheet, connected, boards, current, bo
|
|
|
1170
1185
|
* THE HAND OFF THE CITY A MOMENT, a zoom it wrote is placed for: each
|
|
1171
1186
|
* board and name goes from where it is drawn to where it stands at the
|
|
1172
1187
|
* new zoom, as a zoom let go of always did — once nothing is moving
|
|
1173
|
-
* the ground under them.
|
|
1188
|
+
* the ground under them. A finger down is a hand on the city, moving
|
|
1189
|
+
* it or not yet: a pan put down straight after a pinch is let go of
|
|
1190
|
+
* moves no ground until the browser has seen it move past a touch's
|
|
1191
|
+
* slop, and on a slow phone that was past the moment, so the zoom was
|
|
1192
|
+
* placed for under the finger and the boards slid off their districts
|
|
1193
|
+
* as the pan began (one-face's
|
|
1194
|
+
* `duringAPinchThatPansEveryBoardAndNameStaysFastenedToItsDistrictEveryFrame`,
|
|
1195
|
+
* "a pinch let go of, and a pan straight after", under GRAVIEW_SLOW=4
|
|
1196
|
+
* on GitHub's runner).
|
|
1174
1197
|
*/
|
|
1175
|
-
if (between || settling || cam.pinching())
|
|
1198
|
+
if (between || settling || cam.pinching() || asking.held)
|
|
1176
1199
|
handAt = now;
|
|
1177
1200
|
if (regrow && world.plots.size > 0 && rest !== PAGE && !move && !asking.scrubbing && level(painted) && now - handAt >= LET_GO_MS) {
|
|
1178
1201
|
regrow = false;
|
|
@@ -1184,7 +1207,9 @@ export function OnePlaceCity({ where, out, sheet, connected, boards, current, bo
|
|
|
1184
1207
|
standAll(world, cam.zoom(), LEVEL_LIVE, shownAt(rest), rest);
|
|
1185
1208
|
}
|
|
1186
1209
|
const anchor = world.plots.size > 0 ? anchorIn(at.where, world) : null;
|
|
1187
|
-
const zoomNow = cam.zoom();
|
|
1210
|
+
const zoomNow = settling && laidZoom !== null ? laidZoom : cam.zoom();
|
|
1211
|
+
if (!settling)
|
|
1212
|
+
laidZoom = zoomNow;
|
|
1188
1213
|
const placeKey = `${keyOf(at.where)}|${at.view.width}x${at.view.height}`;
|
|
1189
1214
|
/* At the page, the camera waits where stepping out begins: aimed for each place before anything moves. */
|
|
1190
1215
|
let ready = rest !== PAGE || move !== null || asking.scrubbing;
|
|
@@ -1210,6 +1235,9 @@ export function OnePlaceCity({ where, out, sheet, connected, boards, current, bo
|
|
|
1210
1235
|
moveTo(cam, toLevel, anchor, now);
|
|
1211
1236
|
lastPlace = placeKey;
|
|
1212
1237
|
}
|
|
1238
|
+
// A scrub ended another way (a press without a drag, a pointer canceled) leaves no place it left from behind.
|
|
1239
|
+
if (!asking.scrubbing)
|
|
1240
|
+
scrubbedFrom = null;
|
|
1213
1241
|
if (ready && calm && anchor && asking.scrub !== 0 && !settling) {
|
|
1214
1242
|
// As far as the hand has gone, but no more than a step a frame: a hand ahead of the camera is caught up with, never jumped to.
|
|
1215
1243
|
const delta = Math.max(-0.12, Math.min(0.12, asking.scrub));
|
|
@@ -1227,10 +1255,24 @@ export function OnePlaceCity({ where, out, sheet, connected, boards, current, bo
|
|
|
1227
1255
|
altitude = target;
|
|
1228
1256
|
handSince = now;
|
|
1229
1257
|
asking.scrubbing = true;
|
|
1258
|
+
scrubbedFrom ??= placeKey;
|
|
1230
1259
|
}
|
|
1231
1260
|
if (asking.scrubbing && !asking.held && now - handSince > LET_GO_MS && !settling && calm) {
|
|
1232
1261
|
asking.scrubbing = false;
|
|
1233
1262
|
restCam = null;
|
|
1263
|
+
/*
|
|
1264
|
+
* SCRUBBED TO A LEVEL, THE PAGE IS AT HOME THERE. The place a scrub
|
|
1265
|
+
* leaves from, still the place when it settles, is the place it
|
|
1266
|
+
* settles at: said so, or the city read it as another place gone to
|
|
1267
|
+
* at the City and took it down to Nearby (`moveTo(…PANEL…)` below) —
|
|
1268
|
+
* the slider dragged from the Page up to the Map came back down to
|
|
1269
|
+
* Nearby 0.8 s after it rested, on any machine (one-face's
|
|
1270
|
+
* `draggingTheSliderScrubsTheLevels`, read once the face rests). A
|
|
1271
|
+
* place chosen while the scrub went on is still gone to as one.
|
|
1272
|
+
*/
|
|
1273
|
+
if (scrubbedFrom === placeKey)
|
|
1274
|
+
lastPlace = placeKey;
|
|
1275
|
+
scrubbedFrom = null;
|
|
1234
1276
|
if (anchor)
|
|
1235
1277
|
moveTo(cam, restingLevel(altitude), anchor, now, false);
|
|
1236
1278
|
}
|
|
@@ -1480,8 +1522,20 @@ export function OnePlaceCity({ where, out, sheet, connected, boards, current, bo
|
|
|
1480
1522
|
// Put away under the bar or the control by a pan (a phone's City is panned to reach it): said, for whoever reads the page.
|
|
1481
1523
|
button.toggleAttribute("data-graview-under", covered);
|
|
1482
1524
|
const seen = slot && !covered ? (key === at.current ? shownOwn : shownBoards) * arriving * leaving : 0;
|
|
1525
|
+
/*
|
|
1526
|
+
* This page's own board, drawn wherever it stands (it is the page on
|
|
1527
|
+
* its way into a board), is not offered to a press where the bar or
|
|
1528
|
+
* the control stands over it: a press there lands on them (the
|
|
1529
|
+
* Harbor's home at the City, 844 wide, its board under the bar —
|
|
1530
|
+
* the watch's control-covered, seen once one-face waited for the
|
|
1531
|
+
* face to rest).
|
|
1532
|
+
*/
|
|
1533
|
+
const ownUnder = key === at.current && footAt !== null && under({ x: footAt.x - w / 2, y: footAt.y - h, width: w, height: h });
|
|
1483
1534
|
// Not seen, it is not reached: out of the keyboard's order and the pointer's, as a board going away is.
|
|
1484
|
-
const reached = seen > 0.5 && (key === at.current ? a > 1.5 : a > 0.95) && !move;
|
|
1535
|
+
const reached = seen > 0.5 && (key === at.current ? a > 1.5 && !ownUnder : a > 0.95) && !move;
|
|
1536
|
+
// The keyboard on its own board as the bar comes over it goes to the level control, not to the page's body.
|
|
1537
|
+
if (ownUnder && !reached && document.activeElement === button)
|
|
1538
|
+
fab.current?.querySelector("[data-graview-one-face-dock] button, [data-graview-one-face-dock] [role='slider']")?.focus({ preventScroll: true });
|
|
1485
1539
|
if (button.inert === reached)
|
|
1486
1540
|
button.inert = !reached;
|
|
1487
1541
|
if (!slot || seen <= 0.001) {
|