@nvidia-elements/core 2.15.1 → 2.15.3
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 +17 -0
- package/dist/accordion/accordion2.js +4 -4
- package/dist/alert/alert-group2.js +1 -1
- package/dist/alert/alert2.js +1 -1
- package/dist/avatar/avatar-group2.js +1 -1
- package/dist/avatar/avatar2.js +1 -1
- package/dist/badge/badge2.js +1 -1
- package/dist/breadcrumb/breadcrumb2.js +1 -1
- package/dist/bundle.d.ts +0 -2
- package/dist/bundles/index.d.ts +0 -289
- package/dist/bundles/index.js +6 -6
- package/dist/button/button2.js +1 -1
- package/dist/button-group/button-group2.js +1 -1
- package/dist/card/card2.js +4 -4
- package/dist/chat-message/chat-message2.js +1 -1
- package/dist/checkbox/checkbox-group2.js +1 -1
- package/dist/checkbox/checkbox2.js +1 -1
- package/dist/color/color2.js +1 -1
- package/dist/combobox/combobox2.js +1 -1
- package/dist/copy-button/copy-button2.js +1 -1
- package/dist/custom-elements-jsx.d.ts +0 -157
- package/dist/custom-elements-vue.d.ts +0 -155
- package/dist/custom-elements.json +0 -3259
- package/dist/data.html.json +0 -119
- package/dist/data.snippets.json +45 -45
- package/dist/date/date2.js +1 -1
- package/dist/datetime/datetime2.js +1 -1
- package/dist/dialog/dialog-footer2.js +1 -1
- package/dist/dialog/dialog-header2.js +1 -1
- package/dist/dialog/dialog2.js +1 -1
- package/dist/divider/divider2.js +1 -1
- package/dist/dot/dot2.js +1 -1
- package/dist/drag-handle/drag-handle2.js +1 -1
- package/dist/drawer/drawer-content2.js +1 -1
- package/dist/drawer/drawer-footer2.js +1 -1
- package/dist/drawer/drawer-header2.js +1 -1
- package/dist/drawer/drawer2.js +1 -1
- package/dist/dropdown/dropdown-footer2.js +1 -1
- package/dist/dropdown/dropdown-header2.js +1 -1
- package/dist/dropdown/dropdown2.js +1 -1
- package/dist/dropdown-group/dropdown-group.js +1 -1
- package/dist/dropzone/dropzone2.js +1 -1
- package/dist/file/file2.js +1 -1
- package/dist/format-bytes/format-bytes2.js +1 -1
- package/dist/format-datetime/format-datetime2.js +1 -1
- package/dist/format-number/format-number2.js +1 -1
- package/dist/format-relative-time/format-relative-time2.js +1 -1
- package/dist/format-truncate/format-truncate2.js +1 -1
- package/dist/forms/control/control2.js +1 -1
- package/dist/forms/control/control2.js.map +1 -1
- package/dist/forms/control-group/control-group2.js +1 -1
- package/dist/forms/control-message/control-message2.js +1 -1
- package/dist/gauge/gauge2.js +1 -1
- package/dist/grid/cell/cell2.js +1 -1
- package/dist/grid/column/column2.js +1 -1
- package/dist/grid/footer/footer2.js +1 -1
- package/dist/grid/grid2.js +1 -1
- package/dist/grid/header/header2.js +1 -1
- package/dist/grid/placeholder/placeholder2.js +1 -1
- package/dist/grid/row/row2.js +1 -1
- package/dist/icon/icon2.js +2 -2
- package/dist/icon-button/icon-button2.js +1 -1
- package/dist/index.js +1 -1
- package/dist/input/input-group2.js +1 -1
- package/dist/input/input2.js +1 -1
- package/dist/internal/services/global.service.js +1 -1
- package/dist/logo/logo2.js +1 -1
- package/dist/menu/menu-group2.js +1 -1
- package/dist/menu/menu-item2.js +1 -1
- package/dist/menu/menu2.js +1 -1
- package/dist/month/month2.js +1 -1
- package/dist/notification/notification-group2.js +1 -1
- package/dist/notification/notification2.js +1 -1
- package/dist/page/page-panel/page-panel-content2.js +1 -1
- package/dist/page/page-panel/page-panel-footer2.js +1 -1
- package/dist/page/page-panel/page-panel-header2.js +1 -1
- package/dist/page/page-panel/page-panel2.js +1 -1
- package/dist/page/page2.js +1 -1
- package/dist/page-header/page-header2.js +1 -1
- package/dist/page-loader/page-loader2.js +1 -1
- package/dist/pagination/pagination2.js +1 -1
- package/dist/panel/panel2.js +4 -4
- package/dist/password/password2.js +1 -1
- package/dist/preferences-input/preferences-input2.js +1 -1
- package/dist/progress-bar/progress-bar2.js +1 -1
- package/dist/progress-ring/progress-ring2.js +1 -1
- package/dist/progressive-filter-chip/progressive-filter-chip2.js +1 -1
- package/dist/pulse/pulse2.js +1 -1
- package/dist/radio/radio-group2.js +1 -1
- package/dist/radio/radio2.js +1 -1
- package/dist/range/range2.js +1 -1
- package/dist/resize-handle/resize-handle2.js +1 -1
- package/dist/search/search2.js +1 -1
- package/dist/select/select2.js +1 -1
- package/dist/skeleton/skeleton2.js +1 -1
- package/dist/sort-button/sort-button2.js +1 -1
- package/dist/sparkline/sparkline2.js +1 -1
- package/dist/star-rating/star-rating2.js +1 -1
- package/dist/steps/steps2.js +2 -2
- package/dist/switch/switch-group2.js +1 -1
- package/dist/switch/switch2.js +1 -1
- package/dist/tabs/tabs-group2.js +1 -1
- package/dist/tabs/tabs2.js +2 -2
- package/dist/tag/tag2.js +1 -1
- package/dist/textarea/textarea2.js +1 -1
- package/dist/time/time2.js +1 -1
- package/dist/toast/toast2.js +1 -1
- package/dist/toggletip/toggletip-footer2.js +1 -1
- package/dist/toggletip/toggletip-header2.js +1 -1
- package/dist/toggletip/toggletip2.js +1 -1
- package/dist/toolbar/toolbar2.js +1 -1
- package/dist/tooltip/tooltip2.js +1 -1
- package/dist/tree/tree-node.js +1 -1
- package/dist/tree/tree-node.js.map +1 -1
- package/dist/tree/tree-node2.js +1 -1
- package/dist/tree/tree.examples.js.map +1 -1
- package/dist/tree/tree.examples.json +11 -0
- package/dist/tree/tree.js +1 -1
- package/dist/tree/tree.js.map +1 -1
- package/dist/tree/tree2.js +1 -1
- package/dist/week/week2.js +1 -1
- package/package.json +2 -14
- package/dist/viewport/define.d.ts +0 -8
- package/dist/viewport/define.js +0 -8
- package/dist/viewport/define.js.map +0 -1
- package/dist/viewport/index.d.ts +0 -4
- package/dist/viewport/index.js +0 -4
- package/dist/viewport/viewport-animation.controller.d.ts +0 -21
- package/dist/viewport/viewport-animation.controller.js +0 -93
- package/dist/viewport/viewport-animation.controller.js.map +0 -1
- package/dist/viewport/viewport-autofit.controller.d.ts +0 -18
- package/dist/viewport/viewport-autofit.controller.js +0 -105
- package/dist/viewport/viewport-autofit.controller.js.map +0 -1
- package/dist/viewport/viewport-fitting.utils.d.ts +0 -36
- package/dist/viewport/viewport-fitting.utils.js +0 -35
- package/dist/viewport/viewport-fitting.utils.js.map +0 -1
- package/dist/viewport/viewport-gesture-navigation.controller.d.ts +0 -27
- package/dist/viewport/viewport-gesture-navigation.controller.js +0 -318
- package/dist/viewport/viewport-gesture-navigation.controller.js.map +0 -1
- package/dist/viewport/viewport-gridlines.d.ts +0 -42
- package/dist/viewport/viewport-gridlines.js +0 -6
- package/dist/viewport/viewport-gridlines.js.map +0 -1
- package/dist/viewport/viewport-gridlines.utils.d.ts +0 -11
- package/dist/viewport/viewport-gridlines.utils.js +0 -54
- package/dist/viewport/viewport-gridlines.utils.js.map +0 -1
- package/dist/viewport/viewport-gridlines2.js +0 -164
- package/dist/viewport/viewport-gridlines2.js.map +0 -1
- package/dist/viewport/viewport-minimap.d.ts +0 -36
- package/dist/viewport/viewport-minimap.js +0 -6
- package/dist/viewport/viewport-minimap.js.map +0 -1
- package/dist/viewport/viewport-minimap.utils.d.ts +0 -13
- package/dist/viewport/viewport-minimap.utils.js +0 -49
- package/dist/viewport/viewport-minimap.utils.js.map +0 -1
- package/dist/viewport/viewport-minimap2.js +0 -309
- package/dist/viewport/viewport-minimap2.js.map +0 -1
- package/dist/viewport/viewport-navigation.controller.d.ts +0 -21
- package/dist/viewport/viewport-navigation.controller.js +0 -136
- package/dist/viewport/viewport-navigation.controller.js.map +0 -1
- package/dist/viewport/viewport-navigation.types.d.ts +0 -1
- package/dist/viewport/viewport-projection.utils.d.ts +0 -7
- package/dist/viewport/viewport-projection.utils.js +0 -25
- package/dist/viewport/viewport-projection.utils.js.map +0 -1
- package/dist/viewport/viewport.d.ts +0 -122
- package/dist/viewport/viewport.examples.js +0 -6
- package/dist/viewport/viewport.examples.js.map +0 -1
- package/dist/viewport/viewport.examples.json +0 -87
- package/dist/viewport/viewport.js +0 -6
- package/dist/viewport/viewport.js.map +0 -1
- package/dist/viewport/viewport.types.d.ts +0 -93
- package/dist/viewport/viewport2.js +0 -440
- package/dist/viewport/viewport2.js.map +0 -1
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { finiteOr as e, nonnegativeFiniteOr as t, positiveFiniteOr as n } from "../internal/utils/numeric.js";
|
|
2
|
-
//#region src/viewport/viewport-fitting.utils.ts
|
|
3
|
-
function r(e, t, n) {
|
|
4
|
-
let r = Infinity, a = Infinity, o = -Infinity, s = -Infinity;
|
|
5
|
-
for (let c of e) {
|
|
6
|
-
let e = i(c, t, n);
|
|
7
|
-
e && (r = Math.min(r, e.x), a = Math.min(a, e.y), o = Math.max(o, e.x + e.width), s = Math.max(s, e.y + e.height));
|
|
8
|
-
}
|
|
9
|
-
if (!(!Number.isFinite(r) || !Number.isFinite(a) || !Number.isFinite(o) || !Number.isFinite(s))) return {
|
|
10
|
-
height: s - a,
|
|
11
|
-
width: o - r,
|
|
12
|
-
x: r,
|
|
13
|
-
y: a
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
function i(e, t, n) {
|
|
17
|
-
if (!(!(e.width > 0) || !(e.height > 0))) return {
|
|
18
|
-
height: e.height / n.scale,
|
|
19
|
-
width: e.width / n.scale,
|
|
20
|
-
x: n.x + (e.left - t.left) / n.scale,
|
|
21
|
-
y: n.y + (e.top - t.top) / n.scale
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
function a(r, i) {
|
|
25
|
-
let { options: a, scaleRange: o, transform: s, viewport: c } = i, l = t(a.inset, 0), u = n(r.width, 0), d = n(r.height, 0), f = u > 0 && d > 0, p = Math.max(0, c.width - l * 2), m = Math.max(0, c.height - l * 2), h = a.scale ?? (f && p > 0 && m > 0 ? Math.min(p / u, m / d) : s.scale), g = Math.min(o.max, Math.max(o.min, n(h, o.min))), _ = e(r.x, 0) + (f ? u / 2 : 0), v = e(r.y, 0) + (f ? d / 2 : 0);
|
|
26
|
-
return {
|
|
27
|
-
scale: g,
|
|
28
|
-
x: _ - c.width / (2 * g),
|
|
29
|
-
y: v - c.height / (2 * g)
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
//#endregion
|
|
33
|
-
export { r as contentBoundsFromClientRects, a as revealTarget };
|
|
34
|
-
|
|
35
|
-
//# sourceMappingURL=viewport-fitting.utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"viewport-fitting.utils.js","names":[],"sources":["../../src/viewport/viewport-fitting.utils.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { finiteOr, nonnegativeFiniteOr, positiveFiniteOr } from '@nvidia-elements/core/internal';\nimport type { ViewportRect, ViewportTransform } from './viewport.types.js';\n\nexport interface ViewportClientRect {\n readonly height: number;\n readonly left: number;\n readonly top: number;\n readonly width: number;\n}\n\ninterface ViewportClientFrame {\n readonly left: number;\n readonly top: number;\n}\n\nexport interface ViewportFitOptions {\n readonly inset?: number;\n readonly scale?: number;\n}\n\n/** Converts measurable client-space rectangles into their single content-space union. */\nexport function contentBoundsFromClientRects(\n clientRects: Iterable<ViewportClientRect>,\n viewportFrame: ViewportClientFrame,\n transform: ViewportTransform\n): ViewportRect | undefined {\n let left = Number.POSITIVE_INFINITY;\n let top = Number.POSITIVE_INFINITY;\n let right = Number.NEGATIVE_INFINITY;\n let bottom = Number.NEGATIVE_INFINITY;\n for (const clientRect of clientRects) {\n const contentRect = contentRectFromClientRect(clientRect, viewportFrame, transform);\n if (!contentRect) continue;\n left = Math.min(left, contentRect.x);\n top = Math.min(top, contentRect.y);\n right = Math.max(right, contentRect.x + contentRect.width);\n bottom = Math.max(bottom, contentRect.y + contentRect.height);\n }\n if (!Number.isFinite(left) || !Number.isFinite(top) || !Number.isFinite(right) || !Number.isFinite(bottom)) {\n return undefined;\n }\n return { height: bottom - top, width: right - left, x: left, y: top };\n}\n\nfunction contentRectFromClientRect(\n clientRect: ViewportClientRect,\n viewportFrame: ViewportClientFrame,\n transform: ViewportTransform\n): ViewportRect | undefined {\n if (!(clientRect.width > 0) || !(clientRect.height > 0)) return undefined;\n return {\n height: clientRect.height / transform.scale,\n width: clientRect.width / transform.scale,\n x: transform.x + (clientRect.left - viewportFrame.left) / transform.scale,\n y: transform.y + (clientRect.top - viewportFrame.top) / transform.scale\n };\n}\n\n/** Calculates the viewport transform that centers or fits a content-space region. */\nexport function revealTarget(\n region: { x: number; y: number; width?: number; height?: number },\n configuration: {\n options: ViewportFitOptions;\n scaleRange: { min: number; max: number };\n transform: ViewportTransform;\n viewport: { width: number; height: number };\n }\n): ViewportTransform {\n const { options, scaleRange, transform, viewport } = configuration;\n const inset = nonnegativeFiniteOr(options.inset, 0);\n const width = positiveFiniteOr(region.width, 0);\n const height = positiveFiniteOr(region.height, 0);\n const isRect = width > 0 && height > 0;\n const availableWidth = Math.max(0, viewport.width - inset * 2);\n const availableHeight = Math.max(0, viewport.height - inset * 2);\n const requestedScale =\n options.scale ??\n (isRect && availableWidth > 0 && availableHeight > 0\n ? Math.min(availableWidth / width, availableHeight / height)\n : transform.scale);\n const scale = Math.min(scaleRange.max, Math.max(scaleRange.min, positiveFiniteOr(requestedScale, scaleRange.min)));\n const centerX = finiteOr(region.x, 0) + (isRect ? width / 2 : 0);\n const centerY = finiteOr(region.y, 0) + (isRect ? height / 2 : 0);\n return {\n scale,\n x: centerX - viewport.width / (2 * scale),\n y: centerY - viewport.height / (2 * scale)\n };\n}\n"],"mappings":";;AAwBA,SAAgB,EACd,GACA,GACA,GAC0B;CAC1B,IAAI,IAAO,UACP,IAAM,UACN,IAAQ,WACR,IAAS;CACb,KAAK,IAAM,KAAc,GAAa;EACpC,IAAM,IAAc,EAA0B,GAAY,GAAe,CAAS;EAC7E,MACL,IAAO,KAAK,IAAI,GAAM,EAAY,CAAC,GACnC,IAAM,KAAK,IAAI,GAAK,EAAY,CAAC,GACjC,IAAQ,KAAK,IAAI,GAAO,EAAY,IAAI,EA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,OAAO;EACL;EACA,GAAG,IAAU,EAAS,SAAS,IAAI;EACnC,GAAG,IAAU,EAAS,UAAU,IAAI;CACtC;AACF"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { ReactiveController, ReactiveControllerHost } from 'lit';
|
|
2
|
-
import type { ViewportPanBehavior, ViewportPanSession, ViewportPanProposal, ViewportPoint, ViewportTransform, ViewportZoomProposal } from './viewport.types.js';
|
|
3
|
-
type ViewportGestureNavigationHost = HTMLElement & ReactiveControllerHost & {
|
|
4
|
-
readonly _internals: ElementInternals;
|
|
5
|
-
readonly behaviorPan: ViewportPanBehavior;
|
|
6
|
-
readonly pannable: boolean;
|
|
7
|
-
readonly zoomable: boolean;
|
|
8
|
-
readonly dragThreshold: number;
|
|
9
|
-
requestPan(proposal: ViewportPanProposal): boolean;
|
|
10
|
-
requestZoom(proposal: ViewportZoomProposal): boolean;
|
|
11
|
-
startPan(proposal: ViewportPanProposal): ViewportPanSession | undefined;
|
|
12
|
-
};
|
|
13
|
-
interface ViewportGestureNavigationDelegate {
|
|
14
|
-
readonly clampScale: (value: number) => number;
|
|
15
|
-
readonly clientToViewport: (clientX: number, clientY: number) => ViewportPoint;
|
|
16
|
-
readonly getTransform: () => ViewportTransform;
|
|
17
|
-
readonly requestAdmittedPinchZoom: (proposal: ViewportZoomProposal) => boolean;
|
|
18
|
-
}
|
|
19
|
-
export declare class ViewportGestureNavigationController implements ReactiveController {
|
|
20
|
-
#private;
|
|
21
|
-
constructor(host: ViewportGestureNavigationHost, delegate: ViewportGestureNavigationDelegate);
|
|
22
|
-
hostConnected(): void;
|
|
23
|
-
hostDisconnected(): void;
|
|
24
|
-
hostUpdated(): void;
|
|
25
|
-
rebasePointerSessions(): void;
|
|
26
|
-
}
|
|
27
|
-
export {};
|
|
@@ -1,318 +0,0 @@
|
|
|
1
|
-
import { GestureController as e } from "../internal/controllers/gesture.controller.js";
|
|
2
|
-
import { KeyStateController as t } from "../internal/controllers/key-state.controller.js";
|
|
3
|
-
import { isImmediateRootActiveElement as n } from "../internal/utils/focus.js";
|
|
4
|
-
import { anchoredTransform as r, contentPointFromViewport as i } from "./viewport-projection.utils.js";
|
|
5
|
-
//#region src/viewport/viewport-gesture-navigation.controller.ts
|
|
6
|
-
var a = class {
|
|
7
|
-
#e;
|
|
8
|
-
#t;
|
|
9
|
-
#n;
|
|
10
|
-
#r;
|
|
11
|
-
#i = /* @__PURE__ */ new Map();
|
|
12
|
-
#a = /* @__PURE__ */ new Map();
|
|
13
|
-
#o = !1;
|
|
14
|
-
#s = !1;
|
|
15
|
-
#c;
|
|
16
|
-
#l = !1;
|
|
17
|
-
#u;
|
|
18
|
-
constructor(n, r) {
|
|
19
|
-
this.#e = n, this.#t = r, n.addController(this), this.#n = new e(n, {
|
|
20
|
-
beginPinch: this.#O,
|
|
21
|
-
claimPriority: "descendant-first",
|
|
22
|
-
shouldIgnoreEvent: this.#z,
|
|
23
|
-
shouldPreventContextMenu: this.#B,
|
|
24
|
-
shouldReservePointerDown: this.#V,
|
|
25
|
-
suppressNativeDrag: !0,
|
|
26
|
-
touchAction: this.#H
|
|
27
|
-
}), this.#r = new t(n, { watchedCodes: ["Space"] });
|
|
28
|
-
}
|
|
29
|
-
hostConnected() {
|
|
30
|
-
this.#o = !0, this.#e.addEventListener("nve-gesture", this.#S), this.#e.addEventListener("nve-gesture-input", this.#p), this.#e.addEventListener("blur", this.#F), this.#e.addEventListener("focus", this.#P), this.#e.addEventListener("pointerover", this.#I), this.#d();
|
|
31
|
-
}
|
|
32
|
-
hostDisconnected() {
|
|
33
|
-
this.#o = !1, this.#r.enabled = !1, this.#n.target = void 0, this.#e.removeEventListener("nve-gesture", this.#S), this.#e.removeEventListener("nve-gesture-input", this.#p), this.#e.removeEventListener("blur", this.#F), this.#e.removeEventListener("focus", this.#P), this.#e.removeEventListener("pointerover", this.#I), this.#Q(!1), this.#Z(!1), this.#J();
|
|
34
|
-
}
|
|
35
|
-
hostUpdated() {
|
|
36
|
-
this.#d(), this.#X();
|
|
37
|
-
}
|
|
38
|
-
rebasePointerSessions() {
|
|
39
|
-
this.#U();
|
|
40
|
-
}
|
|
41
|
-
#d() {
|
|
42
|
-
let e = this.#e.behaviorPan, t = this.#e.pannable || this.#e.zoomable, n = this.#i.size > 0;
|
|
43
|
-
this.#r.enabled = this.#o && e === "space", this.#n.target = this.#o && (t || n) ? this.#e : void 0, this.#Z(this.#o && e === "space"), this.#Q(this.#o && (this.#e.pannable || this.#a.size > 0)), this.#f();
|
|
44
|
-
}
|
|
45
|
-
#f() {
|
|
46
|
-
this.#e.pannable || (this.#l = !1, this.#e._internals?.states.delete("pan-eligible"));
|
|
47
|
-
}
|
|
48
|
-
#p = (e) => {
|
|
49
|
-
let t = e.detail;
|
|
50
|
-
t.kind === "pointerdown" ? this.#m(t) : t.kind === "pointerend" ? this.#g(t) : this.#y(t);
|
|
51
|
-
};
|
|
52
|
-
#m(e) {
|
|
53
|
-
let t = e.event;
|
|
54
|
-
this.#q(t.pointerId);
|
|
55
|
-
let n = t.pointerType === "touch", r = n ? this.#e.pannable : this.#L(t), i = n && this.#e.zoomable;
|
|
56
|
-
if (!r && !i) return this.#h(t);
|
|
57
|
-
if (!e.claim({
|
|
58
|
-
kind: r ? "pan" : void 0,
|
|
59
|
-
pinchCandidate: i
|
|
60
|
-
})) return;
|
|
61
|
-
n || this.#e.focus({ preventScroll: !0 }), t.button === 1 && t.preventDefault();
|
|
62
|
-
let a = this.#t.getTransform();
|
|
63
|
-
this.#i.set(t.pointerId, {
|
|
64
|
-
button: t.button,
|
|
65
|
-
dragThreshold: this.#e.dragThreshold,
|
|
66
|
-
lastTotalDisplacementX: 0,
|
|
67
|
-
lastTotalDisplacementY: 0,
|
|
68
|
-
lifecycle: r ? { state: "pending" } : { state: "suppressed" },
|
|
69
|
-
pointerType: t.pointerType,
|
|
70
|
-
start: a,
|
|
71
|
-
transformStart: a,
|
|
72
|
-
transformStartDisplacementX: 0,
|
|
73
|
-
transformStartDisplacementY: 0
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
#h(e) {
|
|
77
|
-
this.#e.behaviorPan === "space" && e.pointerType !== "touch" && e.button === 0 && this.#e.focus({ preventScroll: !0 });
|
|
78
|
-
}
|
|
79
|
-
#g(e) {
|
|
80
|
-
let t = e.event.pointerId, n = this.#i.get(t), r = this.#_(t);
|
|
81
|
-
n && this.#v(e, n, r), n && this.#i.get(t) === n && this.#i.delete(t), this.#Y(), this.#d();
|
|
82
|
-
}
|
|
83
|
-
#_(e) {
|
|
84
|
-
if (!this.#u?.has(e)) return !1;
|
|
85
|
-
for (let [t, n] of this.#i) t !== e && n.pointerType === "touch" && this.#j(n);
|
|
86
|
-
return this.#u = void 0, !0;
|
|
87
|
-
}
|
|
88
|
-
#v(e, t, n) {
|
|
89
|
-
if (t.lifecycle.state === "pending") {
|
|
90
|
-
t.pendingEnd = {
|
|
91
|
-
event: e.event,
|
|
92
|
-
interrupted: e.interrupted || n,
|
|
93
|
-
reason: e.reason
|
|
94
|
-
};
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
if (t.lifecycle.state !== "active") return;
|
|
98
|
-
let r = e.interrupted || n;
|
|
99
|
-
this.#M(e, t, r), this.#j(t), this.#Y(), !r && this.#E(e.event.pointerId, t)?.state === "suppressed" && this.#K(e.event.pointerId, t);
|
|
100
|
-
}
|
|
101
|
-
#y(e) {
|
|
102
|
-
n(this.#e) && (e.event.ctrlKey || e.event.metaKey ? this.#b(e) : this.#x(e));
|
|
103
|
-
}
|
|
104
|
-
#b(e) {
|
|
105
|
-
if (!this.#e.zoomable || !e.claim()) return;
|
|
106
|
-
let t = this.#t.getTransform(), n = this.#t.clientToViewport(e.clientX, e.clientY), a = i(n.x, n.y, t), o = this.#n.getWheelZoomFactor(e), s = r(a, n, this.#t.clampScale(t.scale * o)), c = {
|
|
107
|
-
anchor: a,
|
|
108
|
-
clientX: e.clientX,
|
|
109
|
-
clientY: e.clientY,
|
|
110
|
-
event: e.event,
|
|
111
|
-
factor: o,
|
|
112
|
-
next: s,
|
|
113
|
-
source: "wheel"
|
|
114
|
-
};
|
|
115
|
-
this.#e.requestZoom(c);
|
|
116
|
-
}
|
|
117
|
-
#x(e) {
|
|
118
|
-
if (!this.#e.pannable || !e.claim()) return;
|
|
119
|
-
let t = this.#t.getTransform(), n = {
|
|
120
|
-
scale: t.scale,
|
|
121
|
-
x: t.x + e.deltaX / t.scale,
|
|
122
|
-
y: t.y + e.deltaY / t.scale
|
|
123
|
-
}, r = {
|
|
124
|
-
clientX: e.clientX,
|
|
125
|
-
clientY: e.clientY,
|
|
126
|
-
deltaX: e.deltaX,
|
|
127
|
-
deltaY: e.deltaY,
|
|
128
|
-
event: e.event,
|
|
129
|
-
next: n,
|
|
130
|
-
source: "wheel"
|
|
131
|
-
};
|
|
132
|
-
this.#e.requestPan(r);
|
|
133
|
-
}
|
|
134
|
-
#S = (e) => {
|
|
135
|
-
let t = e.detail;
|
|
136
|
-
t.kind === "pinch" ? this.#D(t) : t.kind === "pan" && this.#C(t);
|
|
137
|
-
};
|
|
138
|
-
#C(e) {
|
|
139
|
-
let t = e.event.pointerId, n = this.#i.get(t);
|
|
140
|
-
if (!n || n.lifecycle.state === "suppressed") return;
|
|
141
|
-
n.lastTotalDisplacementX = e.totalDisplacementX, n.lastTotalDisplacementY = e.totalDisplacementY;
|
|
142
|
-
let r = this.#w(e, n);
|
|
143
|
-
n.lifecycle.state === "pending" ? this.#T(e, n, r) : n.lifecycle.navigation.update(r);
|
|
144
|
-
}
|
|
145
|
-
#w(e, t) {
|
|
146
|
-
let n = e.totalDisplacementX - t.transformStartDisplacementX, r = e.totalDisplacementY - t.transformStartDisplacementY, i = {
|
|
147
|
-
scale: t.transformStart.scale,
|
|
148
|
-
x: t.transformStart.x - n / t.transformStart.scale,
|
|
149
|
-
y: t.transformStart.y - r / t.transformStart.scale
|
|
150
|
-
};
|
|
151
|
-
return {
|
|
152
|
-
...e,
|
|
153
|
-
next: i
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
#T(e, t, n) {
|
|
157
|
-
if (e.totalDisplacementX ** 2 + e.totalDisplacementY ** 2 < t.dragThreshold ** 2) return;
|
|
158
|
-
let r = this.#e.startPan({
|
|
159
|
-
...n,
|
|
160
|
-
source: "pointer"
|
|
161
|
-
});
|
|
162
|
-
if (r) {
|
|
163
|
-
if (this.#E(e.event.pointerId, t)?.state !== "pending") {
|
|
164
|
-
t.pendingEnd && r.end(t.pendingEnd);
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
t.lifecycle = {
|
|
168
|
-
state: "active",
|
|
169
|
-
navigation: r
|
|
170
|
-
}, this.#Y();
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
#E(e, t) {
|
|
174
|
-
let n = this.#i.get(e);
|
|
175
|
-
return n === t ? n.lifecycle : void 0;
|
|
176
|
-
}
|
|
177
|
-
#D(e) {
|
|
178
|
-
this.#k(e.event);
|
|
179
|
-
let t = this.#t.clientToViewport(e.centerClientX, e.centerClientY), n = this.#t.clampScale(e.context.start.scale * e.scale), i = r(e.context.anchor, t, n), a = {
|
|
180
|
-
anchor: e.context.anchor,
|
|
181
|
-
clientX: e.centerClientX,
|
|
182
|
-
clientY: e.centerClientY,
|
|
183
|
-
event: e.event,
|
|
184
|
-
factor: e.scale,
|
|
185
|
-
next: i,
|
|
186
|
-
source: "pinch"
|
|
187
|
-
};
|
|
188
|
-
this.#t.requestAdmittedPinchZoom(a);
|
|
189
|
-
}
|
|
190
|
-
#O = (e) => {
|
|
191
|
-
if (!this.#e.zoomable) return;
|
|
192
|
-
let t = this.#t.getTransform(), n = this.#t.clientToViewport(e.startCenterClientX, e.startCenterClientY), r = {
|
|
193
|
-
anchor: i(n.x, n.y, t),
|
|
194
|
-
start: t
|
|
195
|
-
};
|
|
196
|
-
return this.#u = /* @__PURE__ */ new Set([e.firstPointerId, e.secondPointerId]), { context: r };
|
|
197
|
-
};
|
|
198
|
-
#k(e) {
|
|
199
|
-
let t = this.#u;
|
|
200
|
-
if (t) {
|
|
201
|
-
for (let n of t) {
|
|
202
|
-
let t = this.#i.get(n);
|
|
203
|
-
t && this.#A({
|
|
204
|
-
event: e,
|
|
205
|
-
reason: "pinch"
|
|
206
|
-
}, t);
|
|
207
|
-
}
|
|
208
|
-
this.#Y();
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
#A(e, t) {
|
|
212
|
-
let n = t.lifecycle.state === "active";
|
|
213
|
-
t.lifecycle.state === "pending" && (t.pendingEnd = {
|
|
214
|
-
...e,
|
|
215
|
-
interrupted: !0
|
|
216
|
-
}), n && this.#M(e, t, !0), this.#j(t);
|
|
217
|
-
}
|
|
218
|
-
#j(e) {
|
|
219
|
-
e.lifecycle.state !== "suppressed" && (e.lifecycle = { state: "suppressed" });
|
|
220
|
-
}
|
|
221
|
-
#M(e, t, n) {
|
|
222
|
-
t.lifecycle.state === "active" && t.lifecycle.navigation.end({
|
|
223
|
-
event: e.event,
|
|
224
|
-
interrupted: n,
|
|
225
|
-
reason: e.reason
|
|
226
|
-
});
|
|
227
|
-
}
|
|
228
|
-
#N = (e) => {
|
|
229
|
-
e.code === "Space" && this.#e.behaviorPan === "space" && n(this.#e) && e.preventDefault();
|
|
230
|
-
};
|
|
231
|
-
#P = () => {
|
|
232
|
-
this.#X();
|
|
233
|
-
};
|
|
234
|
-
#F = () => {
|
|
235
|
-
this.#e._internals.states.delete("pan-eligible");
|
|
236
|
-
};
|
|
237
|
-
#I = (e) => {
|
|
238
|
-
this.#e.pannable && (this.#l = s(e, this.#e), this.#X());
|
|
239
|
-
};
|
|
240
|
-
#L(e) {
|
|
241
|
-
return e.button === 0 ? this.#e.behaviorPan === !0 || this.#e.behaviorPan === "space" && this.#R() : e.button === 1 && this.#e.pannable;
|
|
242
|
-
}
|
|
243
|
-
#R() {
|
|
244
|
-
return this.#r.isPressed("Space") && n(this.#e);
|
|
245
|
-
}
|
|
246
|
-
#z = (e) => e.type === "dragstart" && !this.#e.pannable || o(e, this.#e) || s(e, this.#e);
|
|
247
|
-
#B = (e) => e.ctrlKey ? this.#e.behaviorPan === !0 || this.#e.behaviorPan === "space" && this.#R() : !1;
|
|
248
|
-
#V = (e) => this.#e.behaviorPan === "space" && this.#R() && (e.pointerType === "mouse" || e.pointerType === "pen") && e.button === 0;
|
|
249
|
-
#H = () => this.#e.pannable || this.#e.zoomable || this.#i.size > 0 ? "none" : void 0;
|
|
250
|
-
#U() {
|
|
251
|
-
let e = this.#t.getTransform();
|
|
252
|
-
for (let t of this.#i.values()) this.#W(t, e);
|
|
253
|
-
}
|
|
254
|
-
#W(e, t) {
|
|
255
|
-
e.lifecycle.state !== "suppressed" && (e.transformStart = t, e.transformStartDisplacementX = e.lastTotalDisplacementX, e.transformStartDisplacementY = e.lastTotalDisplacementY);
|
|
256
|
-
}
|
|
257
|
-
#G = (e) => {
|
|
258
|
-
let t = this.#a.get(e.pointerId);
|
|
259
|
-
!t || t.eventType !== e.type || (this.#q(e.pointerId), this.#d(), e.preventDefault(), e.stopImmediatePropagation());
|
|
260
|
-
};
|
|
261
|
-
#K(e, t) {
|
|
262
|
-
let n = t.pointerType === "touch" || t.button === 0 ? "click" : "auxclick";
|
|
263
|
-
this.#q(e);
|
|
264
|
-
let r = globalThis.setTimeout(() => {
|
|
265
|
-
this.#q(e), this.#d();
|
|
266
|
-
});
|
|
267
|
-
this.#a.set(e, {
|
|
268
|
-
eventType: n,
|
|
269
|
-
timer: r
|
|
270
|
-
}), this.#Q(!0);
|
|
271
|
-
}
|
|
272
|
-
#q(e) {
|
|
273
|
-
let t = this.#a.get(e);
|
|
274
|
-
t && (clearTimeout(t.timer), this.#a.delete(e));
|
|
275
|
-
}
|
|
276
|
-
#J() {
|
|
277
|
-
this.#i.clear(), this.#u = void 0;
|
|
278
|
-
for (let e of this.#a.keys()) this.#q(e);
|
|
279
|
-
this.#Y();
|
|
280
|
-
}
|
|
281
|
-
#Y() {
|
|
282
|
-
[...this.#i.values()].some((e) => e.lifecycle.state === "active") ? this.#e._internals.states.add("panning") : this.#e._internals.states.delete("panning");
|
|
283
|
-
}
|
|
284
|
-
#X() {
|
|
285
|
-
!this.#l && (this.#e.behaviorPan === !0 || this.#e.behaviorPan === "space" && this.#R()) ? this.#e._internals.states.add("pan-eligible") : this.#e._internals.states.delete("pan-eligible");
|
|
286
|
-
}
|
|
287
|
-
#Z(e) {
|
|
288
|
-
let t = e ? this.#e.ownerDocument.defaultView ?? void 0 : void 0;
|
|
289
|
-
t !== this.#c && (this.#c?.removeEventListener("keydown", this.#N), this.#c = t, this.#c?.addEventListener("keydown", this.#N));
|
|
290
|
-
}
|
|
291
|
-
#Q(e) {
|
|
292
|
-
e !== this.#s && (this.#s = e, e ? (this.#e.addEventListener("click", this.#G, !0), this.#e.addEventListener("auxclick", this.#G, !0)) : (this.#e.removeEventListener("click", this.#G, !0), this.#e.removeEventListener("auxclick", this.#G, !0)));
|
|
293
|
-
}
|
|
294
|
-
};
|
|
295
|
-
function o(e, t) {
|
|
296
|
-
for (let n of e.composedPath()) {
|
|
297
|
-
if (n === t) break;
|
|
298
|
-
if (n instanceof Element && n.parentElement === t && n.slot === "overlay") return !0;
|
|
299
|
-
}
|
|
300
|
-
return !1;
|
|
301
|
-
}
|
|
302
|
-
function s(e, t) {
|
|
303
|
-
for (let n of e.composedPath()) {
|
|
304
|
-
if (n === t) break;
|
|
305
|
-
if (n instanceof Element && c(n)) return !0;
|
|
306
|
-
}
|
|
307
|
-
return !1;
|
|
308
|
-
}
|
|
309
|
-
function c(e) {
|
|
310
|
-
return e.matches("button, input, textarea, select, a[href], [contenteditable], [tabindex]") || l(e);
|
|
311
|
-
}
|
|
312
|
-
function l(e) {
|
|
313
|
-
return e.localName.includes("-") ? e.constructor.formAssociated === !0 : !1;
|
|
314
|
-
}
|
|
315
|
-
//#endregion
|
|
316
|
-
export { a as ViewportGestureNavigationController };
|
|
317
|
-
|
|
318
|
-
//# sourceMappingURL=viewport-gesture-navigation.controller.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"viewport-gesture-navigation.controller.js","names":[],"sources":["../../src/viewport/viewport-gesture-navigation.controller.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { ReactiveController, ReactiveControllerHost } from 'lit';\nimport {\n GestureController,\n KeyStateController,\n isImmediateRootActiveElement,\n type Gesture,\n type GestureInput,\n type PinchStart,\n type PointerEndGesture,\n type PointerMovementGesture,\n type WheelGestureInput\n} from '@nvidia-elements/core/internal';\nimport type {\n ViewportPanBehavior,\n ViewportPanSession,\n ViewportPanProposal,\n ViewportPanUpdateProposal,\n ViewportPanEndRequest,\n ViewportPanEndReason,\n ViewportPoint,\n ViewportTransform,\n ViewportZoomProposal\n} from './viewport.types.js';\nimport { anchoredTransform, contentPointFromViewport } from './viewport-projection.utils.js';\n\ntype PointerPanLifecycle =\n | { readonly state: 'pending' }\n | { readonly state: 'active'; readonly navigation: ViewportPanSession }\n | { readonly state: 'suppressed' };\n\ninterface PointerPanSession {\n readonly button: number;\n readonly dragThreshold: number;\n lastTotalDisplacementX: number;\n lastTotalDisplacementY: number;\n lifecycle: PointerPanLifecycle;\n pendingEnd?: ViewportPanEndRequest;\n readonly pointerType: string;\n readonly start: ViewportTransform;\n transformStart: ViewportTransform;\n transformStartDisplacementX: number;\n transformStartDisplacementY: number;\n}\n\ninterface PinchContext {\n readonly anchor: ViewportPoint;\n readonly start: ViewportTransform;\n}\n\ntype ViewportGestureNavigationHost = HTMLElement &\n ReactiveControllerHost & {\n readonly _internals: ElementInternals;\n readonly behaviorPan: ViewportPanBehavior;\n readonly pannable: boolean;\n readonly zoomable: boolean;\n readonly dragThreshold: number;\n requestPan(proposal: ViewportPanProposal): boolean;\n requestZoom(proposal: ViewportZoomProposal): boolean;\n startPan(proposal: ViewportPanProposal): ViewportPanSession | undefined;\n };\n\ninterface ViewportGestureNavigationDelegate {\n readonly clampScale: (value: number) => number;\n readonly clientToViewport: (clientX: number, clientY: number) => ViewportPoint;\n readonly getTransform: () => ViewportTransform;\n readonly requestAdmittedPinchZoom: (proposal: ViewportZoomProposal) => boolean;\n}\n\nexport class ViewportGestureNavigationController implements ReactiveController {\n readonly #host: ViewportGestureNavigationHost;\n readonly #delegate: ViewportGestureNavigationDelegate;\n readonly #gestureController: GestureController<PinchContext>;\n readonly #keyStateController: KeyStateController;\n readonly #pointerPanSessions = new Map<number, PointerPanSession>();\n readonly #suppressedClicks = new Map<\n number,\n { eventType: 'auxclick' | 'click'; timer: ReturnType<typeof setTimeout> }\n >();\n #connected = false;\n #clickListenersActive = false;\n #spaceKeyListenerTarget?: Window;\n #nativeInteractionHovered = false;\n #pinchPointerIds?: ReadonlySet<number>;\n\n constructor(host: ViewportGestureNavigationHost, delegate: ViewportGestureNavigationDelegate) {\n this.#host = host;\n this.#delegate = delegate;\n host.addController(this);\n this.#gestureController = new GestureController(host, {\n beginPinch: this.#beginPinch,\n claimPriority: 'descendant-first',\n shouldIgnoreEvent: this.#shouldIgnoreEvent,\n shouldPreventContextMenu: this.#shouldPreventContextMenu,\n shouldReservePointerDown: this.#shouldReservePointerDown,\n suppressNativeDrag: true,\n touchAction: this.#getTouchAction\n });\n this.#keyStateController = new KeyStateController(host, { watchedCodes: ['Space'] });\n }\n\n hostConnected(): void {\n this.#connected = true;\n this.#host.addEventListener('nve-gesture', this.#handleGesture as EventListener);\n this.#host.addEventListener('nve-gesture-input', this.#handleGestureInput as EventListener);\n this.#host.addEventListener('blur', this.#handleBlur);\n this.#host.addEventListener('focus', this.#handleFocus);\n this.#host.addEventListener('pointerover', this.#handlePointerOver as EventListener);\n this.#syncBehaviorPolicy();\n }\n\n hostDisconnected(): void {\n this.#connected = false;\n this.#keyStateController.enabled = false;\n this.#gestureController.target = undefined;\n this.#host.removeEventListener('nve-gesture', this.#handleGesture as EventListener);\n this.#host.removeEventListener('nve-gesture-input', this.#handleGestureInput as EventListener);\n this.#host.removeEventListener('blur', this.#handleBlur);\n this.#host.removeEventListener('focus', this.#handleFocus);\n this.#host.removeEventListener('pointerover', this.#handlePointerOver as EventListener);\n this.#setClickListeners(false);\n this.#setSpaceKeyListener(false);\n this.#clearPointerState();\n }\n\n hostUpdated(): void {\n this.#syncBehaviorPolicy();\n this.#syncPanEligibleState();\n }\n\n rebasePointerSessions(): void {\n this.#rebasePointerPans();\n }\n\n #syncBehaviorPolicy(): void {\n const panBehavior = this.#host.behaviorPan;\n const behaviorEnabled = this.#host.pannable || this.#host.zoomable;\n const handlesClaimedPointers = this.#pointerPanSessions.size > 0;\n this.#keyStateController.enabled = this.#connected && panBehavior === 'space';\n this.#gestureController.target =\n this.#connected && (behaviorEnabled || handlesClaimedPointers) ? this.#host : undefined;\n this.#setSpaceKeyListener(this.#connected && panBehavior === 'space');\n this.#setClickListeners(this.#connected && (this.#host.pannable || this.#suppressedClicks.size > 0));\n this.#syncDisabledPanEligibility();\n }\n\n #syncDisabledPanEligibility(): void {\n if (this.#host.pannable) return;\n this.#nativeInteractionHovered = false;\n this.#host._internals?.states.delete('pan-eligible');\n }\n\n #handleGestureInput = (event: CustomEvent<GestureInput>): void => {\n const input = event.detail;\n if (input.kind === 'pointerdown') {\n this.#handlePointerDown(input);\n } else if (input.kind === 'pointerend') {\n this.#handlePointerEnd(input);\n } else {\n this.#handleWheel(input);\n }\n };\n\n #handlePointerDown(input: Extract<GestureInput, { kind: 'pointerdown' }>): void {\n const nativeEvent = input.event;\n this.#clearSuppressedClick(nativeEvent.pointerId);\n const isTouch = nativeEvent.pointerType === 'touch';\n const canPan = isTouch ? this.#host.pannable : this.#acceptsPointerPan(nativeEvent);\n const canPinch = isTouch && this.#host.zoomable;\n if (!canPan && !canPinch) return this.#focusSpaceViewportFromUnclaimedPointer(nativeEvent);\n const claimed = input.claim({ kind: canPan ? 'pan' : undefined, pinchCandidate: canPinch });\n if (!claimed) return;\n if (!isTouch) this.#host.focus({ preventScroll: true });\n if (nativeEvent.button === 1) nativeEvent.preventDefault();\n const start = this.#delegate.getTransform();\n this.#pointerPanSessions.set(nativeEvent.pointerId, {\n button: nativeEvent.button,\n dragThreshold: this.#host.dragThreshold,\n lastTotalDisplacementX: 0,\n lastTotalDisplacementY: 0,\n lifecycle: canPan ? { state: 'pending' } : { state: 'suppressed' },\n pointerType: nativeEvent.pointerType,\n start,\n transformStart: start,\n transformStartDisplacementX: 0,\n transformStartDisplacementY: 0\n });\n }\n\n #focusSpaceViewportFromUnclaimedPointer(event: PointerEvent): void {\n if (this.#host.behaviorPan !== 'space' || event.pointerType === 'touch' || event.button !== 0) return;\n this.#host.focus({ preventScroll: true });\n }\n\n #handlePointerEnd(input: PointerEndGesture): void {\n const pointerId = input.event.pointerId;\n const session = this.#pointerPanSessions.get(pointerId);\n const endedPinch = this.#endPinchIfNeeded(pointerId);\n if (session) this.#finishPointerPan(input, session, endedPinch);\n if (session && this.#pointerPanSessions.get(pointerId) === session) this.#pointerPanSessions.delete(pointerId);\n this.#syncPanningState();\n this.#syncBehaviorPolicy();\n }\n\n #endPinchIfNeeded(pointerId: number): boolean {\n if (!this.#pinchPointerIds?.has(pointerId)) return false;\n for (const [candidatePointerId, candidate] of this.#pointerPanSessions) {\n if (candidatePointerId !== pointerId && candidate.pointerType === 'touch') {\n this.#suppressPointerPan(candidate);\n }\n }\n this.#pinchPointerIds = undefined;\n return true;\n }\n\n #finishPointerPan(input: PointerEndGesture, session: PointerPanSession, endedPinch: boolean): void {\n if (session.lifecycle.state === 'pending') {\n session.pendingEnd = { event: input.event, interrupted: input.interrupted || endedPinch, reason: input.reason };\n return;\n }\n if (session.lifecycle.state !== 'active') return;\n const interrupted = input.interrupted || endedPinch;\n this.#dispatchPanEnd(input, session, interrupted);\n this.#suppressPointerPan(session);\n this.#syncPanningState();\n if (\n !interrupted &&\n this.#getAuthoritativePointerPanLifecycle(input.event.pointerId, session)?.state === 'suppressed'\n ) {\n this.#queueClickSuppression(input.event.pointerId, session);\n }\n }\n\n #handleWheel(input: WheelGestureInput): void {\n if (!isImmediateRootActiveElement(this.#host)) return;\n if (input.event.ctrlKey || input.event.metaKey) {\n this.#handleWheelZoom(input);\n } else {\n this.#handleWheelPan(input);\n }\n }\n\n #handleWheelZoom(input: WheelGestureInput): void {\n if (!this.#host.zoomable || !input.claim()) return;\n const start = this.#delegate.getTransform();\n const viewport = this.#delegate.clientToViewport(input.clientX, input.clientY);\n const anchor = contentPointFromViewport(viewport.x, viewport.y, start);\n const factor = this.#gestureController.getWheelZoomFactor(input);\n const next = anchoredTransform(anchor, viewport, this.#delegate.clampScale(start.scale * factor));\n const proposal: ViewportZoomProposal = {\n anchor,\n clientX: input.clientX,\n clientY: input.clientY,\n event: input.event,\n factor,\n next,\n source: 'wheel'\n };\n this.#host.requestZoom(proposal);\n }\n\n #handleWheelPan(input: WheelGestureInput): void {\n if (!this.#host.pannable || !input.claim()) return;\n const start = this.#delegate.getTransform();\n const next = {\n scale: start.scale,\n x: start.x + input.deltaX / start.scale,\n y: start.y + input.deltaY / start.scale\n };\n const proposal: ViewportPanProposal = {\n clientX: input.clientX,\n clientY: input.clientY,\n deltaX: input.deltaX,\n deltaY: input.deltaY,\n event: input.event,\n next,\n source: 'wheel'\n };\n this.#host.requestPan(proposal);\n }\n\n #handleGesture = (event: CustomEvent<Gesture<PinchContext>>): void => {\n const gesture = event.detail;\n if (gesture.kind === 'pinch') {\n this.#handlePinchGesture(gesture);\n } else if (gesture.kind === 'pan') {\n this.#handlePointerPan(gesture);\n }\n };\n\n #handlePointerPan(gesture: PointerMovementGesture & { readonly kind: 'pan' }): void {\n const pointerId = gesture.event.pointerId;\n const session = this.#pointerPanSessions.get(pointerId);\n if (!session || session.lifecycle.state === 'suppressed') return;\n session.lastTotalDisplacementX = gesture.totalDisplacementX;\n session.lastTotalDisplacementY = gesture.totalDisplacementY;\n const proposal = this.#pointerPanProposal(gesture, session);\n if (session.lifecycle.state === 'pending') this.#activatePointerPan(gesture, session, proposal);\n else session.lifecycle.navigation.update(proposal);\n }\n\n #pointerPanProposal(\n gesture: PointerMovementGesture & { readonly kind: 'pan' },\n session: PointerPanSession\n ): ViewportPanUpdateProposal {\n const displacementX = gesture.totalDisplacementX - session.transformStartDisplacementX;\n const displacementY = gesture.totalDisplacementY - session.transformStartDisplacementY;\n const next = {\n scale: session.transformStart.scale,\n x: session.transformStart.x - displacementX / session.transformStart.scale,\n y: session.transformStart.y - displacementY / session.transformStart.scale\n };\n return { ...gesture, next };\n }\n\n #activatePointerPan(\n gesture: PointerMovementGesture & { readonly kind: 'pan' },\n session: PointerPanSession,\n proposal: ViewportPanUpdateProposal\n ): void {\n const distanceSquared = gesture.totalDisplacementX ** 2 + gesture.totalDisplacementY ** 2;\n if (distanceSquared < session.dragThreshold ** 2) return;\n const navigation = this.#host.startPan({ ...proposal, source: 'pointer' });\n if (!navigation) return;\n if (this.#getAuthoritativePointerPanLifecycle(gesture.event.pointerId, session)?.state !== 'pending') {\n if (session.pendingEnd) navigation.end(session.pendingEnd);\n return;\n }\n session.lifecycle = { state: 'active', navigation };\n this.#syncPanningState();\n }\n\n #getAuthoritativePointerPanLifecycle(pointerId: number, session: PointerPanSession): PointerPanLifecycle | undefined {\n const authoritativeSession = this.#pointerPanSessions.get(pointerId);\n return authoritativeSession === session ? authoritativeSession.lifecycle : undefined;\n }\n\n #handlePinchGesture(gesture: Extract<Gesture<PinchContext>, { kind: 'pinch' }>): void {\n this.#interruptPointerPansForPinch(gesture.event);\n const viewport = this.#delegate.clientToViewport(gesture.centerClientX, gesture.centerClientY);\n const nextScale = this.#delegate.clampScale(gesture.context.start.scale * gesture.scale);\n const next = anchoredTransform(gesture.context.anchor, viewport, nextScale);\n const proposal: ViewportZoomProposal = {\n anchor: gesture.context.anchor,\n clientX: gesture.centerClientX,\n clientY: gesture.centerClientY,\n event: gesture.event,\n factor: gesture.scale,\n next,\n source: 'pinch'\n };\n this.#delegate.requestAdmittedPinchZoom(proposal);\n }\n\n #beginPinch = (pinch: PinchStart): { context: PinchContext } | undefined => {\n if (!this.#host.zoomable) return undefined;\n const start = this.#delegate.getTransform();\n const viewport = this.#delegate.clientToViewport(pinch.startCenterClientX, pinch.startCenterClientY);\n const context: PinchContext = {\n anchor: contentPointFromViewport(viewport.x, viewport.y, start),\n start\n };\n this.#pinchPointerIds = new Set([pinch.firstPointerId, pinch.secondPointerId]);\n return { context };\n };\n\n #interruptPointerPansForPinch(event: PointerEvent): void {\n const pinchPointerIds = this.#pinchPointerIds;\n if (!pinchPointerIds) return;\n for (const pointerId of pinchPointerIds) {\n const session = this.#pointerPanSessions.get(pointerId);\n if (!session) continue;\n this.#interruptPointerPan({ event, reason: 'pinch' }, session);\n }\n this.#syncPanningState();\n }\n\n #interruptPointerPan(\n end: { readonly event: PointerEvent; readonly reason: ViewportPanEndReason },\n session: PointerPanSession\n ): void {\n const wasActive = session.lifecycle.state === 'active';\n if (session.lifecycle.state === 'pending') session.pendingEnd = { ...end, interrupted: true };\n if (wasActive) this.#dispatchPanEnd(end, session, true);\n this.#suppressPointerPan(session);\n }\n\n #suppressPointerPan(session: PointerPanSession): void {\n if (session.lifecycle.state === 'suppressed') return;\n session.lifecycle = { state: 'suppressed' };\n }\n\n #dispatchPanEnd(\n end: { readonly event: PointerEvent; readonly reason: ViewportPanEndReason },\n session: PointerPanSession,\n interrupted: boolean\n ): void {\n if (session.lifecycle.state !== 'active') return;\n session.lifecycle.navigation.end({ event: end.event, interrupted, reason: end.reason });\n }\n\n #handleSpaceKeyDown = (event: KeyboardEvent): void => {\n if (event.code !== 'Space' || this.#host.behaviorPan !== 'space') return;\n if (!isImmediateRootActiveElement(this.#host)) return;\n event.preventDefault();\n };\n\n #handleFocus = (): void => {\n this.#syncPanEligibleState();\n };\n\n #handleBlur = (): void => {\n this.#host._internals.states.delete('pan-eligible');\n };\n\n #handlePointerOver = (event: PointerEvent): void => {\n if (!this.#host.pannable) return;\n this.#nativeInteractionHovered = eventTargetsNativeInteraction(event, this.#host);\n this.#syncPanEligibleState();\n };\n\n #acceptsPointerPan(event: PointerEvent): boolean {\n if (event.button === 0) {\n return this.#host.behaviorPan === true || (this.#host.behaviorPan === 'space' && this.#isSpacePanEligible());\n }\n if (event.button === 1) return this.#host.pannable;\n return false;\n }\n\n #isSpacePanEligible(): boolean {\n return this.#keyStateController.isPressed('Space') && isImmediateRootActiveElement(this.#host);\n }\n\n #shouldIgnoreEvent = (event: Event): boolean => {\n if (event.type === 'dragstart' && !this.#host.pannable) return true;\n return eventTargetsViewportOverlay(event, this.#host) || eventTargetsNativeInteraction(event, this.#host);\n };\n\n #shouldPreventContextMenu = (event: MouseEvent): boolean => {\n if (!event.ctrlKey) return false;\n return this.#host.behaviorPan === true || (this.#host.behaviorPan === 'space' && this.#isSpacePanEligible());\n };\n\n #shouldReservePointerDown = (event: PointerEvent): boolean =>\n this.#host.behaviorPan === 'space' &&\n this.#isSpacePanEligible() &&\n (event.pointerType === 'mouse' || event.pointerType === 'pen') &&\n event.button === 0;\n\n #getTouchAction = (): string | undefined =>\n this.#host.pannable || this.#host.zoomable || this.#pointerPanSessions.size > 0 ? 'none' : undefined;\n\n #rebasePointerPans(): void {\n const transformStart = this.#delegate.getTransform();\n for (const session of this.#pointerPanSessions.values()) {\n this.#rebaseEligiblePointerPan(session, transformStart);\n }\n }\n\n #rebaseEligiblePointerPan(session: PointerPanSession, transformStart: ViewportTransform): void {\n if (session.lifecycle.state === 'suppressed') return;\n session.transformStart = transformStart;\n session.transformStartDisplacementX = session.lastTotalDisplacementX;\n session.transformStartDisplacementY = session.lastTotalDisplacementY;\n }\n\n #handleClickCapture = (event: PointerEvent): void => {\n const suppression = this.#suppressedClicks.get(event.pointerId);\n if (!suppression || suppression.eventType !== event.type) return;\n this.#clearSuppressedClick(event.pointerId);\n this.#syncBehaviorPolicy();\n event.preventDefault();\n event.stopImmediatePropagation();\n };\n\n #queueClickSuppression(pointerId: number, session: PointerPanSession): void {\n const eventType = session.pointerType === 'touch' || session.button === 0 ? 'click' : 'auxclick';\n this.#clearSuppressedClick(pointerId);\n const timer = globalThis.setTimeout(() => {\n this.#clearSuppressedClick(pointerId);\n this.#syncBehaviorPolicy();\n });\n this.#suppressedClicks.set(pointerId, { eventType, timer });\n this.#setClickListeners(true);\n }\n\n #clearSuppressedClick(pointerId: number): void {\n const suppression = this.#suppressedClicks.get(pointerId);\n if (!suppression) return;\n clearTimeout(suppression.timer);\n this.#suppressedClicks.delete(pointerId);\n }\n\n #clearPointerState(): void {\n this.#pointerPanSessions.clear();\n this.#pinchPointerIds = undefined;\n for (const pointerId of this.#suppressedClicks.keys()) this.#clearSuppressedClick(pointerId);\n this.#syncPanningState();\n }\n\n #syncPanningState(): void {\n const panning = [...this.#pointerPanSessions.values()].some(session => session.lifecycle.state === 'active');\n if (panning) this.#host._internals.states.add('panning');\n else this.#host._internals.states.delete('panning');\n }\n\n #syncPanEligibleState(): void {\n const eligible =\n !this.#nativeInteractionHovered &&\n (this.#host.behaviorPan === true || (this.#host.behaviorPan === 'space' && this.#isSpacePanEligible()));\n if (eligible) this.#host._internals.states.add('pan-eligible');\n else this.#host._internals.states.delete('pan-eligible');\n }\n\n #setSpaceKeyListener(enabled: boolean): void {\n const target = enabled ? (this.#host.ownerDocument.defaultView ?? undefined) : undefined;\n if (target === this.#spaceKeyListenerTarget) return;\n this.#spaceKeyListenerTarget?.removeEventListener('keydown', this.#handleSpaceKeyDown as EventListener);\n this.#spaceKeyListenerTarget = target;\n this.#spaceKeyListenerTarget?.addEventListener('keydown', this.#handleSpaceKeyDown as EventListener);\n }\n\n #setClickListeners(enabled: boolean): void {\n if (enabled === this.#clickListenersActive) return;\n this.#clickListenersActive = enabled;\n if (enabled) {\n this.#host.addEventListener('click', this.#handleClickCapture as EventListener, true);\n this.#host.addEventListener('auxclick', this.#handleClickCapture as EventListener, true);\n } else {\n this.#host.removeEventListener('click', this.#handleClickCapture as EventListener, true);\n this.#host.removeEventListener('auxclick', this.#handleClickCapture as EventListener, true);\n }\n }\n}\n\nfunction eventTargetsViewportOverlay(event: Event, boundary: Element): boolean {\n for (const target of event.composedPath()) {\n if (target === boundary) break;\n if (target instanceof Element && target.parentElement === boundary && target.slot === 'overlay') return true;\n }\n return false;\n}\n\nfunction eventTargetsNativeInteraction(event: Event, boundary: Element): boolean {\n for (const target of event.composedPath()) {\n if (target === boundary) break;\n if (!(target instanceof Element)) continue;\n if (isNativeInteractionElement(target)) return true;\n }\n return false;\n}\n\nfunction isNativeInteractionElement(element: Element): boolean {\n return (\n element.matches('button, input, textarea, select, a[href], [contenteditable], [tabindex]') ||\n isFormAssociatedCustomElement(element)\n );\n}\n\nfunction isFormAssociatedCustomElement(element: Element): boolean {\n if (!element.localName.includes('-')) return false;\n return (element.constructor as typeof HTMLElement & { formAssociated?: boolean }).formAssociated === true;\n}\n"],"mappings":";;;;;AAuEA,IAAa,IAAb,MAA+E;CAC7E;CACA;CACA;CACA;CACA,qBAA+B,IAAI,IAA+B;CAClE,qBAA6B,IAAI,IAG/B;CACF,KAAa;CACb,KAAwB;CACxB;CACA,KAA4B;CAC5B;CAEA,YAAY,GAAqC,GAA6C;EAa5F,AAZA,KAAK,KAAQ,GACb,KAAK,KAAY,GACjB,EAAK,cAAc,IAAI,GACvB,KAAK,KAAqB,IAAI,EAAkB,GAAM;GACpD,YAAY,KAAK;GACjB,eAAe;GACf,mBAAmB,KAAK;GACxB,0BAA0B,KAAK;GAC/B,0BAA0B,KAAK;GAC/B,oBAAoB;GACpB,aAAa,KAAK;EACpB,CAAC,GACD,KAAK,KAAsB,IAAI,EAAmB,GAAM,EAAE,cAAc,CAAC,OAAO,EAAE,CAAC;CACrF;CAEA,gBAAsB;EAOpB,AANA,KAAK,KAAa,IAClB,KAAK,GAAM,iBAAiB,eAAe,KAAK,EAA+B,GAC/E,KAAK,GAAM,iBAAiB,qBAAqB,KAAK,EAAoC,GAC1F,KAAK,GAAM,iBAAiB,QAAQ,KAAK,EAAW,GACpD,KAAK,GAAM,iBAAiB,SAAS,KAAK,EAAY,GACtD,K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AEA,SAAS,EAA4B,GAAc,GAA4B;CAC7E,KAAK,IAAM,KAAU,EAAM,aAAa,GAAG;EACzC,IAAI,MAAW,GAAU;EACzB,IAAI,aAAkB,WAAW,EAAO,kBAAkB,KAAY,EAAO,SAAS,WAAW,OAAO;CAC1G;CACA,OAAO;AACT;AAEA,SAAS,EAA8B,GAAc,GAA4B;CAC/E,KAAK,IAAM,KAAU,EAAM,aAAa,GAAG;EACzC,IAAI,MAAW,GAAU;EACnB,iBAAkB,WACpB,EAA2B,CAAM,GAAG,OAAO;CACjD;CACA,OAAO;AACT;AAEA,SAAS,EAA2B,GAA2B;CAC7D,OACE,EAAQ,QAAQ,yEAAyE,KACzF,EAA8B,CAAO;AAEzC;AAEA,SAAS,EAA8B,GAA2B;CAEhE,OADK,EAAQ,UAAU,SAAS,GAAG,IAC3B,EAAQ,YAAkE,mBAAmB,KADxD;AAE/C"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { LitElement, nothing, type PropertyValues } from 'lit';
|
|
2
|
-
/**
|
|
3
|
-
* @element nve-viewport-gridlines
|
|
4
|
-
* @description Renders origin-stable, zoom-adaptive gridline patterns behind viewport content.
|
|
5
|
-
* @documentation https://nvidia.github.io/elements/docs/elements/viewport/
|
|
6
|
-
* @since 0.0.0
|
|
7
|
-
* @entrypoint \@nvidia-elements/core/viewport
|
|
8
|
-
* @cssprop --color - Sets the gridline pattern color.
|
|
9
|
-
* @cssprop --line-width - Sets the approximate stroke width in CSS pixels.
|
|
10
|
-
* @cssprop --dot-radius - Sets the approximate dot radius in CSS pixels.
|
|
11
|
-
* @cssprop --cross-size - Sets the approximate full width and height of each cross in CSS pixels.
|
|
12
|
-
*/
|
|
13
|
-
export declare class ViewportGridlines extends LitElement {
|
|
14
|
-
#private;
|
|
15
|
-
static styles: import("lit").CSSResult[];
|
|
16
|
-
static readonly metadata: {
|
|
17
|
-
tag: string;
|
|
18
|
-
version: string;
|
|
19
|
-
};
|
|
20
|
-
/** @private */
|
|
21
|
-
slot: string;
|
|
22
|
-
/** @private */
|
|
23
|
-
protected accessibilityHidden: string;
|
|
24
|
-
/** Grid pattern to render. */
|
|
25
|
-
pattern: 'lines' | 'dots' | 'crosses';
|
|
26
|
-
/** Smallest gridline interval in content-space units. */
|
|
27
|
-
get step(): number;
|
|
28
|
-
set step(value: number);
|
|
29
|
-
/** Content-space x coordinate of the grid origin. */
|
|
30
|
-
get originX(): number;
|
|
31
|
-
set originX(value: number);
|
|
32
|
-
/** Content-space y coordinate of the grid origin. */
|
|
33
|
-
get originY(): number;
|
|
34
|
-
set originY(value: number);
|
|
35
|
-
/** Target on-screen separation used to choose the adaptive gridline interval, in CSS pixels. */
|
|
36
|
-
get targetSpacing(): number;
|
|
37
|
-
set targetSpacing(value: number);
|
|
38
|
-
connectedCallback(): void;
|
|
39
|
-
disconnectedCallback(): void;
|
|
40
|
-
protected willUpdate(changed: PropertyValues<this>): void;
|
|
41
|
-
render(): typeof nothing | import("lit-html").TemplateResult<1>;
|
|
42
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
//#region src/viewport/viewport-gridlines.css?inline
|
|
2
|
-
var e = ":host{--color: var(--nve-ref-border-color-muted);--line-width: var(--nve-ref-border-width-sm);--dot-radius: var(--nve-ref-size-50);--cross-size: var(--nve-ref-size-200);--_scale: 1;position:absolute;inset:0;contain:none;pointer-events:none;user-select:none}svg{position:absolute;overflow:visible;pointer-events:none}path{fill:none;stroke:var(--color);stroke-width:calc(var(--line-width) / var(--_scale))}circle{fill:var(--color);r:calc(var(--dot-radius) / var(--_scale))}.cross{fill:var(--color)}.cross-horizontal{x:calc(var(--cross-size) / var(--_scale) / -2);y:calc(var(--line-width) / var(--_scale) / -2);width:calc(var(--cross-size) / var(--_scale));height:calc(var(--line-width) / var(--_scale))}.cross-vertical{x:calc(var(--line-width) / var(--_scale) / -2);y:calc(var(--cross-size) / var(--_scale) / -2);width:calc(var(--line-width) / var(--_scale));height:calc(var(--cross-size) / var(--_scale))}";
|
|
3
|
-
//#endregion
|
|
4
|
-
export { e as default };
|
|
5
|
-
|
|
6
|
-
//# sourceMappingURL=viewport-gridlines.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"viewport-gridlines.js","names":[],"sources":["../../src/viewport/viewport-gridlines.css?inline"],"sourcesContent":["/* SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. */\n/* SPDX-License-Identifier: Apache-2.0 */\n\n:host {\n --color: var(--nve-ref-border-color-muted);\n --line-width: var(--nve-ref-border-width-sm);\n --dot-radius: var(--nve-ref-size-50);\n --cross-size: var(--nve-ref-size-200);\n\n --_scale: 1;\n\n position: absolute;\n inset: 0;\n contain: none;\n pointer-events: none;\n user-select: none;\n}\n\nsvg {\n position: absolute;\n overflow: visible;\n pointer-events: none;\n}\n\npath {\n fill: none;\n stroke: var(--color);\n stroke-width: calc(var(--line-width) / var(--_scale));\n}\n\ncircle {\n fill: var(--color);\n r: calc(var(--dot-radius) / var(--_scale));\n}\n\n.cross {\n fill: var(--color);\n}\n\n.cross-horizontal {\n x: calc(var(--cross-size) / var(--_scale) / -2);\n y: calc(var(--line-width) / var(--_scale) / -2);\n width: calc(var(--cross-size) / var(--_scale));\n height: calc(var(--line-width) / var(--_scale));\n}\n\n.cross-vertical {\n x: calc(var(--line-width) / var(--_scale) / -2);\n y: calc(var(--cross-size) / var(--_scale) / -2);\n width: calc(var(--line-width) / var(--_scale));\n height: calc(var(--cross-size) / var(--_scale));\n}\n"],"mappings":""}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { ViewportRect } from './viewport.types.js';
|
|
2
|
-
interface GridlineIntervalOptions {
|
|
3
|
-
readonly current?: number;
|
|
4
|
-
readonly scale: number;
|
|
5
|
-
readonly step: number;
|
|
6
|
-
readonly targetSpacing: number;
|
|
7
|
-
}
|
|
8
|
-
export declare function selectGridlineInterval(options: GridlineIntervalOptions): number;
|
|
9
|
-
export declare function createGridlineCoverage(visible: ViewportRect): ViewportRect;
|
|
10
|
-
export declare function gridlineCoverageNeedsUpdate(coverage: ViewportRect | undefined, visible: ViewportRect): boolean;
|
|
11
|
-
export {};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
//#region src/viewport/viewport-gridlines.utils.ts
|
|
2
|
-
var e = .25;
|
|
3
|
-
function t(e) {
|
|
4
|
-
let { scale: t, step: i, targetSpacing: a } = e, o = n(e);
|
|
5
|
-
if (o !== void 0) return o;
|
|
6
|
-
let s = a / t;
|
|
7
|
-
return Number.isFinite(s) ? r(i, s) : Number.MAX_VALUE;
|
|
8
|
-
}
|
|
9
|
-
function n({ current: e, scale: t, step: n, targetSpacing: r }) {
|
|
10
|
-
if (e === void 0 || !i(e, n)) return;
|
|
11
|
-
let a = e * t;
|
|
12
|
-
if (!(a < r * .5 || a > r * 1.5)) return e;
|
|
13
|
-
}
|
|
14
|
-
function r(e, t) {
|
|
15
|
-
let n = Math.max(1, t / e);
|
|
16
|
-
if (!Number.isFinite(n)) return Number.MAX_VALUE;
|
|
17
|
-
let r = Math.max(0, Math.floor(Math.log10(n))), i = 1, a = Math.abs(n - i);
|
|
18
|
-
for (let t = Math.max(0, r - 1); t <= r + 1; t += 1) {
|
|
19
|
-
let r = 10 ** t;
|
|
20
|
-
for (let t of [
|
|
21
|
-
1,
|
|
22
|
-
2,
|
|
23
|
-
5
|
|
24
|
-
]) {
|
|
25
|
-
let o = t * r;
|
|
26
|
-
if (!Number.isFinite(e * o)) continue;
|
|
27
|
-
let s = Math.abs(n - o);
|
|
28
|
-
s < a && (i = o, a = s);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return e * i;
|
|
32
|
-
}
|
|
33
|
-
function i(e, t) {
|
|
34
|
-
let n = e / t;
|
|
35
|
-
return Number.isFinite(n) && Math.abs(n - Math.round(n)) < 2 ** -52 * 16;
|
|
36
|
-
}
|
|
37
|
-
function a(e) {
|
|
38
|
-
let t = e.width * 1, n = e.height * 1;
|
|
39
|
-
return {
|
|
40
|
-
x: e.x - t,
|
|
41
|
-
y: e.y - n,
|
|
42
|
-
width: e.width + t * 2,
|
|
43
|
-
height: e.height + n * 2
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
function o(t, n) {
|
|
47
|
-
if (!t) return !0;
|
|
48
|
-
let r = n.width * e, i = n.height * e;
|
|
49
|
-
return n.x < t.x + r || n.y < t.y + i || n.x + n.width > t.x + t.width - r || n.y + n.height > t.y + t.height - i;
|
|
50
|
-
}
|
|
51
|
-
//#endregion
|
|
52
|
-
export { a as createGridlineCoverage, o as gridlineCoverageNeedsUpdate, t as selectGridlineInterval };
|
|
53
|
-
|
|
54
|
-
//# sourceMappingURL=viewport-gridlines.utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"viewport-gridlines.utils.js","names":[],"sources":["../../src/viewport/viewport-gridlines.utils.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { ViewportRect } from './viewport.types.js';\n\nconst MIN_RETAINED_SPACING_FACTOR = 0.5;\nconst MAX_RETAINED_SPACING_FACTOR = 1.5;\nconst OVERSCAN_FACTOR = 1;\nconst COVERAGE_GUARD_FACTOR = 0.25;\n\ninterface GridlineIntervalOptions {\n readonly current?: number;\n readonly scale: number;\n readonly step: number;\n readonly targetSpacing: number;\n}\n\nexport function selectGridlineInterval(options: GridlineIntervalOptions): number {\n const { scale, step, targetSpacing } = options;\n const retained = retainInterval(options);\n if (retained !== undefined) return retained;\n const desiredInterval = targetSpacing / scale;\n return Number.isFinite(desiredInterval) ? nearestInterval(step, desiredInterval) : Number.MAX_VALUE;\n}\n\nfunction retainInterval({ current, scale, step, targetSpacing }: GridlineIntervalOptions): number | undefined {\n if (current === undefined || !isIntegralMultiple(current, step)) return undefined;\n const projectedSpacing = current * scale;\n if (\n projectedSpacing < targetSpacing * MIN_RETAINED_SPACING_FACTOR ||\n projectedSpacing > targetSpacing * MAX_RETAINED_SPACING_FACTOR\n ) {\n return undefined;\n }\n return current;\n}\n\nfunction nearestInterval(step: number, desiredInterval: number): number {\n const desiredFactor = Math.max(1, desiredInterval / step);\n if (!Number.isFinite(desiredFactor)) return Number.MAX_VALUE;\n const exponent = Math.max(0, Math.floor(Math.log10(desiredFactor)));\n let nearestFactor = 1;\n let nearestDistance = Math.abs(desiredFactor - nearestFactor);\n\n for (let power = Math.max(0, exponent - 1); power <= exponent + 1; power += 1) {\n const magnitude = 10 ** power;\n for (const multiplier of [1, 2, 5]) {\n const factor = multiplier * magnitude;\n if (!Number.isFinite(step * factor)) continue;\n const distance = Math.abs(desiredFactor - factor);\n if (distance < nearestDistance) {\n nearestFactor = factor;\n nearestDistance = distance;\n }\n }\n }\n\n return step * nearestFactor;\n}\n\nfunction isIntegralMultiple(interval: number, step: number): boolean {\n const factor = interval / step;\n return Number.isFinite(factor) && Math.abs(factor - Math.round(factor)) < Number.EPSILON * 16;\n}\n\nexport function createGridlineCoverage(visible: ViewportRect): ViewportRect {\n const horizontalOverscan = visible.width * OVERSCAN_FACTOR;\n const verticalOverscan = visible.height * OVERSCAN_FACTOR;\n return {\n x: visible.x - horizontalOverscan,\n y: visible.y - verticalOverscan,\n width: visible.width + horizontalOverscan * 2,\n height: visible.height + verticalOverscan * 2\n };\n}\n\nexport function gridlineCoverageNeedsUpdate(coverage: ViewportRect | undefined, visible: ViewportRect): boolean {\n if (!coverage) return true;\n const horizontalGuard = visible.width * COVERAGE_GUARD_FACTOR;\n const verticalGuard = visible.height * COVERAGE_GUARD_FACTOR;\n return (\n visible.x < coverage.x + horizontalGuard ||\n visible.y < coverage.y + verticalGuard ||\n visible.x + visible.width > coverage.x + coverage.width - horizontalGuard ||\n visible.y + visible.height > coverage.y + coverage.height - verticalGuard\n );\n}\n"],"mappings":";AAKA,IAGM,IAAwB;AAS9B,SAAgB,EAAuB,GAA0C;CAC/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