@n-uf/placement 26.11.25 → 26.11.26
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/CHANGELOG.md +60 -0
- package/README.md +78 -14
- package/dist/{chunk-SZKU7CRX.js → chunk-CIGRI35P.js} +994 -740
- package/dist/chunk-CIGRI35P.js.map +1 -0
- package/dist/{chunk-KGZCYLQN.js → chunk-IHU6IOZH.js} +126 -10
- package/dist/chunk-IHU6IOZH.js.map +1 -0
- package/dist/desk.d.ts +2 -2
- package/dist/float-fit-DRSOU_2y.d.ts +37 -0
- package/dist/index.d.ts +1 -1
- package/dist/{model-mm16NrSX.d.ts → model-Bd0oELzF.d.ts} +8 -0
- package/dist/{targets-CDR5Towj.d.ts → model-Dz4R5ydE.d.ts} +15 -109
- package/dist/panels.d.ts +3 -3
- package/dist/scene-cases.d.ts +8 -4
- package/dist/scene-cases.js +6 -4
- package/dist/scene-cases.js.map +1 -1
- package/dist/scene.d.ts +72 -6
- package/dist/scene.js +5 -2
- package/dist/stack.d.ts +52 -32
- package/dist/stack.js +4 -98
- package/dist/stack.js.map +1 -1
- package/dist/{target-C-HJjPcz.d.ts → target-CEVCfJd-.d.ts} +3 -1
- package/dist/{targets-CBpO_LEy.d.ts → targets-BPG7Kf02.d.ts} +1 -1
- package/dist/targets.d.ts +2 -2
- package/package.json +1 -1
- package/dist/chunk-KGZCYLQN.js.map +0 -1
- package/dist/chunk-SZKU7CRX.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { R as Rect, S as Size, P as Point } from './geometry-CkZ6Fcfb.js';
|
|
2
|
-
import { T as Target } from './target-
|
|
3
|
-
import { C as CrossLimits, a as StackForm, S as StackFormKind, b as StackFit, c as StackNote } from './model-
|
|
2
|
+
import { T as Target } from './target-CEVCfJd-.js';
|
|
3
|
+
import { C as CrossLimits, a as StackForm, S as StackFormKind, b as StackFit, c as StackNote } from './model-Bd0oELzF.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* The scene's shapes: one model of a whole window. A scene is a stage (the window's inner rect), the edges along its
|
|
@@ -8,6 +8,7 @@ import { C as CrossLimits, a as StackForm, S as StackFormKind, b as StackFit, c
|
|
|
8
8
|
* floats and drop zones keep clear of. `solve(scene)` turns it into a `SceneLayout`: every rect a host draws.
|
|
9
9
|
*
|
|
10
10
|
* Plain data in and out, nothing module-global: two windows on one page are two scenes. No words, no time, no DOM.
|
|
11
|
+
* What the shapes tell on their own (an edge's axis, an item's zone and forms, how it floats) is in `./helpers`.
|
|
11
12
|
*/
|
|
12
13
|
|
|
13
14
|
/** The host's kinds of item, such as "panel" and "group". An edge takes only the kinds it lists. */
|
|
@@ -179,16 +180,6 @@ interface ColumnTemplate {
|
|
|
179
180
|
}
|
|
180
181
|
/** Per zone, the kinds it takes. */
|
|
181
182
|
type ZoneAccepts = Readonly<Partial<Record<Zone, readonly Kind[]>>>;
|
|
182
|
-
/** Whether `edge` takes kind `kind` in `zone`: its `accepts`, narrowed by `zoneAccepts` when given (a zone not listed takes nothing). */
|
|
183
|
-
declare const zoneTakes: (edge: {
|
|
184
|
-
readonly accepts: readonly Kind[];
|
|
185
|
-
readonly zoneAccepts?: ZoneAccepts;
|
|
186
|
-
}, zone: Zone, kind: Kind) => boolean;
|
|
187
|
-
/** The zones of `edge` that take `kind`, in order. */
|
|
188
|
-
declare const zonesTaking: (edge: {
|
|
189
|
-
readonly accepts: readonly Kind[];
|
|
190
|
-
readonly zoneAccepts?: ZoneAccepts;
|
|
191
|
-
}, kind: Kind) => Zone[];
|
|
192
183
|
/** A side's one rail strip: folded columns show in it as segments, in ring order. */
|
|
193
184
|
interface RailSpec {
|
|
194
185
|
/** Its width, px. */
|
|
@@ -285,6 +276,11 @@ interface SceneItemLayout {
|
|
|
285
276
|
readonly rows?: readonly (readonly number[])[];
|
|
286
277
|
/** Its grip: a `wrap` form's lead cell at the start of row one, or a form's `grip` strip (an icons strip's, on top). */
|
|
287
278
|
readonly grip?: Rect;
|
|
279
|
+
/**
|
|
280
|
+
* The control ids the form it took leaves out (`StackForm.hides`), empty when it hides none or sits in a » menu: a host
|
|
281
|
+
* draws a "+N" control with them. `form` already names the variant.
|
|
282
|
+
*/
|
|
283
|
+
readonly hidden: readonly string[];
|
|
288
284
|
}
|
|
289
285
|
/** An edge as laid out. */
|
|
290
286
|
interface SceneEdgeLayout {
|
|
@@ -411,8 +407,10 @@ interface SceneLayout {
|
|
|
411
407
|
interface SolveOptions {
|
|
412
408
|
/**
|
|
413
409
|
* The layout the scene had before: each edge's fit goes to `fitStack` as `previous`, so a press reshapes nothing. An
|
|
414
|
-
* item docked now that was closed or absent then has just opened
|
|
415
|
-
* fits; the others give way by the usual rules)
|
|
410
|
+
* item docked now that was closed or absent then has just opened. Opened beside items that stayed open in its edge, it
|
|
411
|
+
* counts as the newest (its largest form while it fits; the others give way by the usual rules) and its column is
|
|
412
|
+
* weighed anew. A closed item is not a removed one: opened into an edge whose items were all closed, it comes back as
|
|
413
|
+
* it was, with its age, and its column's folds (kept while it was closed) apply again.
|
|
416
414
|
*/
|
|
417
415
|
readonly previous?: SceneLayout;
|
|
418
416
|
/** Edge or item ids solved without `previous` (an edge, or the edges holding the item; a column weighed anew). */
|
|
@@ -424,28 +422,6 @@ declare const DEFAULT_STRIP = 24;
|
|
|
424
422
|
declare const DEFAULT_HIT_BAND = 24;
|
|
425
423
|
/** A float's size when neither the item nor the call gives one, px. */
|
|
426
424
|
declare const DEFAULT_FLOAT_SIZE: Size;
|
|
427
|
-
/**
|
|
428
|
-
* A left or right toolbar bar outside the inset (`isSideBar` with `outsideInset`). It lies outermost on its side,
|
|
429
|
-
* before the side's rail.
|
|
430
|
-
*/
|
|
431
|
-
declare function isOutsideSideBar(scene: Scene, e: Edge): boolean;
|
|
432
|
-
/**
|
|
433
|
-
* A left or right toolbar bar: told from a column edge by its kinds, it takes something and nothing the side's columns
|
|
434
|
-
* or its rail take (`Scene.columns[side].accepts`, `Scene.rails[side].accepts`); an anchor takes nothing. A side with
|
|
435
|
-
* neither a column template nor a rail has nothing to tell them apart by, so no edge there is a bar.
|
|
436
|
-
*/
|
|
437
|
-
declare function isSideBar(scene: Scene, e: Edge): boolean;
|
|
438
|
-
/**
|
|
439
|
-
* The orient a float of `item` takes when it names none: its `floatOrient`, else the axis of its first form (the first
|
|
440
|
-
* of `forms.row` / `forms.column` it declares with any form), else column.
|
|
441
|
-
*/
|
|
442
|
-
declare const floatOrientOf: (item: SceneItem) => Orient;
|
|
443
|
-
/**
|
|
444
|
-
* A float's size when nothing gives one: the item's `floatSize`, else its first form's natural size along `orient`
|
|
445
|
-
* (default `floatOrientOf`), else `DEFAULT_FLOAT_SIZE` when that form grows (a panel's card has no natural float length)
|
|
446
|
-
* or the item has no form there.
|
|
447
|
-
*/
|
|
448
|
-
declare function floatSizeOf(item: SceneItem, orient?: Orient): Size;
|
|
449
425
|
|
|
450
426
|
/**
|
|
451
427
|
* The scene's pure changes. Each returns a new scene and leaves the one it was given as it was; a change that can't
|
|
@@ -604,58 +580,8 @@ declare function storeScene(scene: Scene): StoredScene;
|
|
|
604
580
|
declare function readScene(data: unknown, base: Scene): SceneRead;
|
|
605
581
|
|
|
606
582
|
/**
|
|
607
|
-
*
|
|
608
|
-
*
|
|
609
|
-
* a release there commits and its layout, `solve(after.scene, { previous })`: the host draws every item from that layout
|
|
610
|
-
* during the preview (C22), so the preview is the result by construction.
|
|
611
|
-
*
|
|
612
|
-
* One model makes every docked target and refusal: **edge → zones → slots → tiles**, then one ordered
|
|
613
|
-
* filter.
|
|
614
|
-
*
|
|
615
|
-
* - **Edges.** Every edge, empty or occupied, and two virtual edges per side: the column lines and the rail.
|
|
616
|
-
* - **Zones.** Each edge's start, center and end zones have an extent along it. Where items keep their length and the
|
|
617
|
-
* zones only align them (bars, compact rails, side toolbar bars) the extents are the edge's thirds; where items fill
|
|
618
|
-
* the edge (panel columns) a zone's extent is the span the solver gives it: a plain column is one zone, a tray column
|
|
619
|
-
* its panels' span and its tray's (`EDGE_KINDS`, the only data keyed on the kind of edge). The outer extents reach
|
|
620
|
-
* `endReach` past the edge's ends.
|
|
621
|
-
* - **Slots.** A zone's insertion lines, from the layout with the item lifted (`gap:<edge>:<zone>:<at>`; on an edge with
|
|
622
|
-
* no members at all a zone has one, `strip:<edge>:<zone>`). The item's own place is an interval, its own rect along the edge: home.
|
|
623
|
-
* - **Tiles.** A zone's extent split halfway between its slots' lines (lines that lie past the extent are spread into
|
|
624
|
-
* it); the own interval keeps exactly its length, its neighbours meeting it, and a stretch of a zone with no other
|
|
625
|
-
* slot is home's. Across: the edge's thickness (the larger of now and after the drop), an empty edge's strip depth
|
|
626
|
-
* (`Edge.strip`, default 24, inward), a compact rail's `RAIL_REACH` further inward.
|
|
627
|
-
* - **Filter**, in order: (i) the edge and zone take the kind (`accepts`, `zoneAccepts`), and an empty side column opens
|
|
628
|
-
* only through its start zone; (ii) the drop fits (C29: no » entry, no new overflow or `too-wide`, every fixed item
|
|
629
|
-
* keeps its form, place and least length, a title bar's title its natural width with the toolbar in its first form;
|
|
630
|
-
* the slot covers no chrome or reserved rect). A slot (i) or (ii) removes is a refusal over its own tile, with that
|
|
631
|
-
* reason (`refusals()`). (iii) Space ownership and clipping (`EDGE_KINDS`): owned > virtual > overreach. A zone's
|
|
632
|
-
* room loses its panel bodies, its reserved rects and what edges ranked before it own (in `solve`'s laying order); a
|
|
633
|
-
* zone with no room, or a slot with none in reach, isn't offered. Each tile's owned part is cut clear of the tiles
|
|
634
|
-
* before it, of what outranks its edge, of every fixed item that doesn't grow and of the chrome, keeping the part
|
|
635
|
-
* that holds its slot's line (its other parts refused); then the virtual edges take what no edge owns; then each
|
|
636
|
-
* overreach takes what is left and joins its owned part where it meets it whole. Slots that are the same move are
|
|
637
|
-
* one. (iv) `blocked` rects are `none:<i>`.
|
|
638
|
-
*
|
|
639
|
-
* Ids: `gap:<edge>:<zone>:<at>` (priority 2), `strip:<edge>:<zone>` (2), `column:<side>:<ring>` (2), `rail:<side>:<ring>`
|
|
640
|
-
* (1), `none:<i>` (1), `float:<id>` (3, free). A slot that would put the item back where it is keeps its id with place
|
|
641
|
-
* `home` (no slot, nothing committed); `home:<id>` (1) is emitted too, over the same tile (its own rect when no slot is
|
|
642
|
-
* its home), for hosts that read it. A floating item has no home: a move inside its own rect is a float move.
|
|
643
|
-
*
|
|
644
|
-
* - `column:<side>:<ring>`: a new column on each column line of a side whose `scene.columns[side]` takes the kind
|
|
645
|
-
* (outside the outermost open column, between two, inside the innermost; on a side with none, at the content's
|
|
646
|
-
* edge), up to `COLUMN_REACH` px each way (two lines nearer than that meet halfway), only where the new column shows
|
|
647
|
-
* open (elsewhere refused).
|
|
648
|
-
* - `rail:<side>:<ring>`: docking folded into a side's rail (its rail and its template take the kind), before each
|
|
649
|
-
* folded column's segments and after the last, or, with no rail shown, `RAIL_EDGE` px deep where the rail lands
|
|
650
|
-
* (`SceneLayout.railPlaces`).
|
|
651
|
-
* - `float:<id>`: when `floatKinds` lists the kind, the whole plane: the landing is the float with the pointer holding
|
|
652
|
-
* it at `grab` (default its middle), in the stage and clear of the docked items, the bars and the chrome. Its orient:
|
|
653
|
-
* `options.floatOrient`, else its float's, else the item's (`floatOrientOf`). Its size: `options.floatSize`, else its
|
|
654
|
-
* float's size, else `floatSizeOf`.
|
|
655
|
-
*
|
|
656
|
-
* `stops(scene, id)` orders the same targets (no home, no none) for "Move to ›" and the arrow keys.
|
|
657
|
-
*
|
|
658
|
-
* A dropped item counts as just used (`use`). An unknown, fixed or closed item has no targets.
|
|
583
|
+
* The targets' shapes: the public ones (`SceneTarget`, `SceneRefusal`, `ScenePlace`, …) and the tiler's own (an edge
|
|
584
|
+
* as the tiler reads it, its slots and tiles, the context every generator shares).
|
|
659
585
|
*/
|
|
660
586
|
|
|
661
587
|
type ScenePlace = {
|
|
@@ -713,25 +639,5 @@ interface SceneRefusal {
|
|
|
713
639
|
*/
|
|
714
640
|
readonly reason: "no-room" | "own-place" | "not-accepted";
|
|
715
641
|
}
|
|
716
|
-
/**
|
|
717
|
-
* What a fixed item reserves in `l`: its drawn rect, or for a form that grows only its natural length, placed by its
|
|
718
|
-
* zone (from its start, from its end in the end zone, centred in the centre zone). No hit or slot ever lies there, so a
|
|
719
|
-
* host that draws "no drop" areas reads them from here.
|
|
720
|
-
*/
|
|
721
|
-
declare function reservedRect(scene: Scene, l: SceneLayout, id: string): Rect;
|
|
722
|
-
declare function targets(scene: Scene, dragged: string, options?: SceneTargetOptions): SceneTarget[];
|
|
723
|
-
/**
|
|
724
|
-
* `refusals(scene, dragged, options?)`: the places a drop of `dragged` is refused, so a host can say so at the pointer
|
|
725
|
-
* (a tint and "No room here") instead of showing a slot elsewhere: each slot the filter removed, over its own tile,
|
|
726
|
-
* `not-accepted` where the edge or zone doesn't take the kind, `no-room` where the drop wouldn't fit. A release over a
|
|
727
|
-
* refusal commits nothing: the item goes home.
|
|
728
|
-
*/
|
|
729
|
-
declare function refusals(scene: Scene, dragged: string, options?: SceneTargetOptions): SceneRefusal[];
|
|
730
|
-
/**
|
|
731
|
-
* `stops(scene, id, options?)`: the places for "Move to ›" and the arrow keys, in reading order, from the same targets
|
|
732
|
-
* (`home` and `none` left out): the left side outer to inner, the top bars, the bottom bars, the right side inner to
|
|
733
|
-
* outer, floating last. Each stop is a target, so its `after` is the move.
|
|
734
|
-
*/
|
|
735
|
-
declare function stops(scene: Scene, dragged: string, options?: SceneTargetOptions): SceneTarget[];
|
|
736
642
|
|
|
737
|
-
export {
|
|
643
|
+
export { storeScene as $, type StoredSceneFloat as A, type StoredSceneItem as B, type ColumnPlace as C, DEFAULT_FLOAT_SIZE as D, type Edge as E, type FloatAnchor as F, ZONES as G, close as H, dockHome as I, floatAt as J, type Kind as K, fold as L, homeFor as M, keep as N, type Orient as O, type Place as P, lift as Q, type RailPlace as R, type Scene as S, moveTo as T, open as U, orient as V, raise as W, readScene as X, resize as Y, type Zone as Z, setSide as _, type ScenePlace as a, use as a0, type SceneLayout as b, type StoredScene as c, type Side as d, type SceneNoteCode as e, type SceneTarget as f, type SceneItem as g, type ZoneAccepts as h, type SolveOptions as i, type SceneTargetOptions as j, type SceneRefusal as k, type ColumnTemplate as l, DEFAULT_HIT_BAND as m, DEFAULT_STRIP as n, type DockPlace as o, type FloatPlace as p, type RailSpec as q, SIDES as r, type SceneAfter as s, type SceneEdgeLayout as t, type SceneFloat as u, type SceneItemLayout as v, type SceneNote as w, type SceneRailLayout as x, type SceneRead as y, type StoredSceneEdge as z };
|
package/dist/panels.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { b as PanelsState, S as Side, E as Edge, C as Clock, a as PanelDef } from './targets-
|
|
2
|
-
export { B as BAND_SIZE, g as Band, h as BandOption, i as Column, D as DEFAULT_PANELS_OPTIONS, j as DockOptions, k as EDGES, F as FLOAT_HEIGHT, m as FLOAT_MIN, n as FloatAt, G as GiveWay, I as IDENTITY_VIEW, e as PanelDrop, o as PanelKind, q as PanelPlace, r as PanelStop, s as PanelStopsOptions, d as PanelTarget, c as PanelTargetInput, f as PanelsLayout, t as PanelsNote, u as PanelsNoteCode, P as PanelsOptions, v as PanelsStart, w as Place, x as PlacedBand, y as PlacedColumn, z as PlacedPanel, A as PlacedRail, R as Reserve, H as ReserveEdge, J as SIDES, V as View, W as Where, K as activate, L as bandHeight, M as bandSize, N as close, O as columnWidth, Q as createPanels, T as defOf, U as dock, X as dockBand, Y as float, Z as floatSize, _ as focus, $ as giveWayOrder, a0 as homePlace, a1 as keep, l as layoutPanels, a2 as liftPanel, a3 as open, a4 as ownWidth, p as panelDrop, a5 as panelStops, a6 as panelTargets, a7 as pin, a8 as placeRank, a9 as resizeBand, aa as resizeColumn, ab as resizeFloat, ac as samePlaces, ad as showTabs, ae as tick, af as toPage, ag as toView, ah as toggleFold, ai as whereIs } from './targets-
|
|
1
|
+
import { b as PanelsState, S as Side, E as Edge, C as Clock, a as PanelDef } from './targets-BPG7Kf02.js';
|
|
2
|
+
export { B as BAND_SIZE, g as Band, h as BandOption, i as Column, D as DEFAULT_PANELS_OPTIONS, j as DockOptions, k as EDGES, F as FLOAT_HEIGHT, m as FLOAT_MIN, n as FloatAt, G as GiveWay, I as IDENTITY_VIEW, e as PanelDrop, o as PanelKind, q as PanelPlace, r as PanelStop, s as PanelStopsOptions, d as PanelTarget, c as PanelTargetInput, f as PanelsLayout, t as PanelsNote, u as PanelsNoteCode, P as PanelsOptions, v as PanelsStart, w as Place, x as PlacedBand, y as PlacedColumn, z as PlacedPanel, A as PlacedRail, R as Reserve, H as ReserveEdge, J as SIDES, V as View, W as Where, K as activate, L as bandHeight, M as bandSize, N as close, O as columnWidth, Q as createPanels, T as defOf, U as dock, X as dockBand, Y as float, Z as floatSize, _ as focus, $ as giveWayOrder, a0 as homePlace, a1 as keep, l as layoutPanels, a2 as liftPanel, a3 as open, a4 as ownWidth, p as panelDrop, a5 as panelStops, a6 as panelTargets, a7 as pin, a8 as placeRank, a9 as resizeBand, aa as resizeColumn, ab as resizeFloat, ac as samePlaces, ad as showTabs, ae as tick, af as toPage, ag as toView, ah as toggleFold, ai as whereIs } from './targets-BPG7Kf02.js';
|
|
3
3
|
import { R as Rect } from './geometry-CkZ6Fcfb.js';
|
|
4
4
|
export { C as COLUMN_REACH, b as RAIL_EDGE } from './geometry-CkZ6Fcfb.js';
|
|
5
|
-
import './target-
|
|
5
|
+
import './target-CEVCfJd-.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* The panels' stored form: `storePanels(state)` gives plain JSON-safe data (`{ v: 1, … }`); `readPanels(data, defs?)`
|
package/dist/scene-cases.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { P as Point, R as Rect } from './geometry-CkZ6Fcfb.js';
|
|
2
|
-
import { S as StackFormKind } from './model-
|
|
3
|
-
import { S as Scene, a as ScenePlace, b as SceneLayout, c as StoredScene, Z as Zone, d as Side, e as SceneNoteCode, f as SceneTarget } from './
|
|
4
|
-
import './target-
|
|
2
|
+
import { S as StackFormKind } from './model-Bd0oELzF.js';
|
|
3
|
+
import { S as Scene, a as ScenePlace, b as SceneLayout, c as StoredScene, Z as Zone, d as Side, e as SceneNoteCode, f as SceneTarget } from './model-Dz4R5ydE.js';
|
|
4
|
+
import './target-CEVCfJd-.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* The conformance rows' shapes. A row is plain data: a scene, the settings it runs at, the gestures a user makes, and
|
|
@@ -260,10 +260,14 @@ interface CaseResult {
|
|
|
260
260
|
declare const LIFT_THRESHOLD = 4;
|
|
261
261
|
/** How far past an edge's ends its first and last gaps reach (px); the kits' toolbars use 24. */
|
|
262
262
|
declare const END_REACH = 24;
|
|
263
|
-
/**
|
|
263
|
+
/**
|
|
264
|
+
* The most precise target under `point`: the lowest priority number, then the smallest zone; null when none is. A
|
|
265
|
+
* target with `hits` is under the point in any of them, and its zone's size is theirs together.
|
|
266
|
+
*/
|
|
264
267
|
declare function pickTarget<T extends {
|
|
265
268
|
readonly priority: number;
|
|
266
269
|
readonly hit: Rect;
|
|
270
|
+
readonly hits?: readonly Rect[];
|
|
267
271
|
}>(list: readonly T[], point: Point): T | null;
|
|
268
272
|
/** What `resolvePlace` may aim at when a target covers the whole plane (a float): the stage and the content. */
|
|
269
273
|
interface AimArea {
|
package/dist/scene-cases.js
CHANGED
|
@@ -13,8 +13,8 @@ import {
|
|
|
13
13
|
storeScene,
|
|
14
14
|
targets,
|
|
15
15
|
use
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import "./chunk-
|
|
16
|
+
} from "./chunk-CIGRI35P.js";
|
|
17
|
+
import "./chunk-IHU6IOZH.js";
|
|
18
18
|
import {
|
|
19
19
|
area,
|
|
20
20
|
centre,
|
|
@@ -1471,10 +1471,12 @@ var WINDOW_ROWS = [...windowRows(), ...HAND];
|
|
|
1471
1471
|
var LIFT_THRESHOLD = 4;
|
|
1472
1472
|
var END_REACH = 24;
|
|
1473
1473
|
function pickTarget(list, point) {
|
|
1474
|
+
const under = (t) => t.hits ? t.hits.some((r) => contains(r, point)) : contains(t.hit, point);
|
|
1475
|
+
const size = (t) => t.hits ? t.hits.reduce((s, r) => s + area(r), 0) : area(t.hit);
|
|
1474
1476
|
let best = null;
|
|
1475
1477
|
for (const t of list) {
|
|
1476
|
-
if (!
|
|
1477
|
-
if (!best || t.priority < best.priority || t.priority === best.priority &&
|
|
1478
|
+
if (!under(t)) continue;
|
|
1479
|
+
if (!best || t.priority < best.priority || t.priority === best.priority && size(t) < size(best)) best = t;
|
|
1478
1480
|
}
|
|
1479
1481
|
return best;
|
|
1480
1482
|
}
|