@mark1russell7/visuals 0.3.3 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +147 -2
- package/build/globe.d.ts +2 -2
- package/build/graph.d.ts +417 -0
- package/build/graph.d.ts.map +1 -0
- package/build/graph.js +855 -0
- package/build/graph.js.map +1 -0
- package/build/highlight-BJ6xGp6V.d.ts +30 -0
- package/build/highlight-BJ6xGp6V.d.ts.map +1 -0
- package/build/index.d.ts +2 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -1
- package/build/labels.d.ts +1 -1
- package/build/markers.d.ts +2 -2
- package/build/{motion-BvRKIWAC.js → motion-VS13e4Pw.js} +14 -3
- package/build/{motion-BvRKIWAC.js.map → motion-VS13e4Pw.js.map} +1 -1
- package/build/{stage-DmFfah2e.d.ts → stage-D8JVM6wZ.d.ts} +3 -2
- package/build/stage-D8JVM6wZ.d.ts.map +1 -0
- package/build/{theme-3EGbXXoP.d.ts → theme-DBbBlCbC.d.ts} +2 -30
- package/build/theme-DBbBlCbC.d.ts.map +1 -0
- package/build/three.d.ts +2 -2
- package/build/three.js +2 -8
- package/build/three.js.map +1 -1
- package/package.json +6 -1
- package/build/stage-DmFfah2e.d.ts.map +0 -1
- package/build/theme-3EGbXXoP.d.ts.map +0 -1
package/build/graph.js
ADDED
|
@@ -0,0 +1,855 @@
|
|
|
1
|
+
import { a as partAt, c as highlightOf, f as KEY_ZOOM, l as isClick, n as easeInOut, r as lessMotion, s as NO_HIGHLIGHTS, u as KEY_PART } from "./motion-VS13e4Pw.js";
|
|
2
|
+
// src/graph/camera.ts
|
|
3
|
+
/** The default limits of the zoom. */
|
|
4
|
+
const ZOOM_LIMITS = {
|
|
5
|
+
min: .05,
|
|
6
|
+
max: 8
|
|
7
|
+
};
|
|
8
|
+
/** The view that shows each point of the picture at its own position. */
|
|
9
|
+
const UNIT_VIEW = {
|
|
10
|
+
x: 0,
|
|
11
|
+
y: 0,
|
|
12
|
+
k: 1
|
|
13
|
+
};
|
|
14
|
+
/** This function gives a zoom in its limits. A zoom that is not a number gives the smallest zoom. */
|
|
15
|
+
function clampZoom(k, limits = ZOOM_LIMITS) {
|
|
16
|
+
return k >= limits.min ? Math.min(k, limits.max) : limits.min;
|
|
17
|
+
}
|
|
18
|
+
/** This function gives the point of the picture that shows at a screen point. */
|
|
19
|
+
function toPicture(view, screen) {
|
|
20
|
+
return {
|
|
21
|
+
x: (screen.x - view.x) / view.k,
|
|
22
|
+
y: (screen.y - view.y) / view.k
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/** This function gives the screen point that shows a point of the picture. */
|
|
26
|
+
function toScreen(view, point) {
|
|
27
|
+
return {
|
|
28
|
+
x: point.x * view.k + view.x,
|
|
29
|
+
y: point.y * view.k + view.y
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
/** This function gives the screen rectangle that shows a rectangle of the picture. */
|
|
33
|
+
function rectToScreen(view, rect) {
|
|
34
|
+
return {
|
|
35
|
+
x: rect.x * view.k + view.x,
|
|
36
|
+
y: rect.y * view.k + view.y,
|
|
37
|
+
w: rect.w * view.k,
|
|
38
|
+
h: rect.h * view.k
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/** This function gives the view with the zoom `k` that shows the point `point` of the picture at the screen point `at`. */
|
|
42
|
+
function viewAt(point, at, k) {
|
|
43
|
+
return {
|
|
44
|
+
x: at.x - point.x * k,
|
|
45
|
+
y: at.y - point.y * k,
|
|
46
|
+
k
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/** This function gives the view after a move of the picture by a screen distance. */
|
|
50
|
+
function panView(view, dx, dy) {
|
|
51
|
+
return {
|
|
52
|
+
x: view.x + dx,
|
|
53
|
+
y: view.y + dy,
|
|
54
|
+
k: view.k
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* This function gives the view after a zoom by `factor`. The zoom stays in its limits.
|
|
59
|
+
* The screen point `at` shows the same point of the picture before and after the zoom.
|
|
60
|
+
*/
|
|
61
|
+
function zoomView(view, at, factor, limits = ZOOM_LIMITS) {
|
|
62
|
+
const k = clampZoom(view.k * factor, limits);
|
|
63
|
+
const ratio = k / view.k;
|
|
64
|
+
return {
|
|
65
|
+
x: at.x - (at.x - view.x) * ratio,
|
|
66
|
+
y: at.y - (at.y - view.y) * ratio,
|
|
67
|
+
k
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* This function gives the view after the two pointers of a pinch move from `before` to `after`.
|
|
72
|
+
*
|
|
73
|
+
* The zoom changes by the ratio of the two distances between the pointers.
|
|
74
|
+
* The point of the picture at the middle of the pointers stays at their middle.
|
|
75
|
+
* Thus each pointer keeps its point of the picture, if the pointers do not turn and the zoom is in its limits.
|
|
76
|
+
*/
|
|
77
|
+
function pinchView(view, before, after, limits = ZOOM_LIMITS) {
|
|
78
|
+
const from = {
|
|
79
|
+
x: (before[0].x + before[1].x) / 2,
|
|
80
|
+
y: (before[0].y + before[1].y) / 2
|
|
81
|
+
};
|
|
82
|
+
const to = {
|
|
83
|
+
x: (after[0].x + after[1].x) / 2,
|
|
84
|
+
y: (after[0].y + after[1].y) / 2
|
|
85
|
+
};
|
|
86
|
+
const was = Math.hypot(before[0].x - before[1].x, before[0].y - before[1].y);
|
|
87
|
+
const is = Math.hypot(after[0].x - after[1].x, after[0].y - after[1].y);
|
|
88
|
+
const factor = was > 0 && is > 0 ? is / was : 1;
|
|
89
|
+
return zoomView(panView(view, to.x - from.x, to.y - from.y), to, factor, limits);
|
|
90
|
+
}
|
|
91
|
+
/** The speed of the zoom of a wheel: the change of the natural logarithm of the zoom for one CSS pixel of the wheel. */
|
|
92
|
+
const WHEEL_SPEED = .0015;
|
|
93
|
+
/** The height of one line of a wheel that gives its turn in lines, in CSS pixels. */
|
|
94
|
+
const WHEEL_LINE = 16;
|
|
95
|
+
/** The factor of the speed of the wheel for a pinch on a touch pad. A browser gives such a pinch as a wheel with the key `Control`. */
|
|
96
|
+
const WHEEL_PINCH = 10;
|
|
97
|
+
/**
|
|
98
|
+
* This function gives the factor of the zoom for one event of a wheel. A turn away from the person makes the picture larger.
|
|
99
|
+
*
|
|
100
|
+
* `deltaY` and `deltaMode` are the fields of the event. A mode of 1 has its turn in lines.
|
|
101
|
+
* `pinch` is the field `ctrlKey` of the event: a pinch on a touch pad has small turns, so its speed is higher.
|
|
102
|
+
*/
|
|
103
|
+
function wheelFactor(deltaY, deltaMode = 0, pinch = false) {
|
|
104
|
+
const pixels = deltaMode === 1 ? deltaY * 16 : deltaY;
|
|
105
|
+
return Math.exp(0 - pixels * WHEEL_SPEED * (pinch ? 10 : 1));
|
|
106
|
+
}
|
|
107
|
+
/** The smallest width and height of a free area, in CSS pixels. */
|
|
108
|
+
const SMALLEST_AREA = 80;
|
|
109
|
+
/**
|
|
110
|
+
* This function gives the free area of a picture: the screen rectangle that the page does not cover.
|
|
111
|
+
* A camera shows a selection in this area, so a panel of the page does not hide it.
|
|
112
|
+
* The width and the height of the area are `SMALLEST_AREA` at least.
|
|
113
|
+
*/
|
|
114
|
+
function freeArea(size, insets = {}) {
|
|
115
|
+
const left = insets.left ?? 0;
|
|
116
|
+
const top = insets.top ?? 0;
|
|
117
|
+
return {
|
|
118
|
+
x: left,
|
|
119
|
+
y: top,
|
|
120
|
+
w: Math.max(80, size.width - left - (insets.right ?? 0)),
|
|
121
|
+
h: Math.max(80, size.height - top - (insets.bottom ?? 0))
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
/** The default distance between a rectangle that a camera shows and each edge of the area, in CSS pixels. */
|
|
125
|
+
const FIT_PADDING = 24;
|
|
126
|
+
/**
|
|
127
|
+
* This function gives the middle of a rectangle.
|
|
128
|
+
* The home of this function is `@mark1russell7/layout-contract`, which does not have it. It moves there with the records of a picture.
|
|
129
|
+
*/
|
|
130
|
+
function middleOf(rect) {
|
|
131
|
+
return {
|
|
132
|
+
x: rect.x + rect.w / 2,
|
|
133
|
+
y: rect.y + rect.h / 2
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
/** This function gives the zoom at which a rectangle of the picture fills an area of the screen, with a padding at each edge. */
|
|
137
|
+
function fillZoom(rect, area, padding) {
|
|
138
|
+
const width = Math.max(area.w - 2 * padding, 1);
|
|
139
|
+
const height = Math.max(area.h - 2 * padding, 1);
|
|
140
|
+
return Math.min(width / Math.max(rect.w, 0), height / Math.max(rect.h, 0));
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* This function gives the view that shows a rectangle of the picture in an area of the screen, as large as the area permits.
|
|
144
|
+
* The middle of the rectangle is at the middle of the area. A rectangle with no size gets the largest zoom.
|
|
145
|
+
*/
|
|
146
|
+
function fitRect(rect, area, options = {}) {
|
|
147
|
+
const limits = options.limits ?? ZOOM_LIMITS;
|
|
148
|
+
const k = clampZoom(Math.min(options.most ?? limits.max, fillZoom(rect, area, options.padding ?? 24)), limits);
|
|
149
|
+
return viewAt(middleOf(rect), middleOf(area), k);
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* This function gives the limits of the zoom for a picture with the bounds `bounds`.
|
|
153
|
+
*
|
|
154
|
+
* The smallest zoom of the result shows all of the picture in the area, with a padding at each edge.
|
|
155
|
+
* A picture that fits at the smallest zoom of `limits` keeps `limits`. Thus a person can show all of a very large picture.
|
|
156
|
+
*/
|
|
157
|
+
function zoomLimitsFor(bounds, area, limits = ZOOM_LIMITS, padding = 24) {
|
|
158
|
+
const all = fillZoom(bounds, area, padding);
|
|
159
|
+
return all > 0 && all < limits.min ? {
|
|
160
|
+
min: all,
|
|
161
|
+
max: limits.max
|
|
162
|
+
} : limits;
|
|
163
|
+
}
|
|
164
|
+
/** The length of a picture that stays in the free area when a person moves the picture, in CSS pixels. */
|
|
165
|
+
const KEEP_IN_VIEW = 64;
|
|
166
|
+
/** This function gives the start of a span of the screen that keeps the length `least` in an area, on one axis. */
|
|
167
|
+
function keepSpan(start, length, areaStart, areaLength, least) {
|
|
168
|
+
const keep = Math.min(Math.max(least, 0), length, areaLength);
|
|
169
|
+
return Math.min(Math.max(start, areaStart + keep - length), areaStart + areaLength - keep);
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* This function gives the view that keeps a part of a rectangle of the picture in an area of the screen.
|
|
173
|
+
* A person who moves the picture then cannot lose it.
|
|
174
|
+
*
|
|
175
|
+
* `least` is the length of the rectangle that stays in the area on each axis, in CSS pixels.
|
|
176
|
+
* A rectangle that is smaller on the screen stays in the area fully. The zoom does not change.
|
|
177
|
+
* The result is `view` itself when the view keeps the rectangle.
|
|
178
|
+
*/
|
|
179
|
+
function keepRect(view, rect, area, least = 64) {
|
|
180
|
+
const shown = rectToScreen(view, rect);
|
|
181
|
+
const x = keepSpan(shown.x, shown.w, area.x, area.w, least);
|
|
182
|
+
const y = keepSpan(shown.y, shown.h, area.y, area.h, least);
|
|
183
|
+
return x === shown.x && y === shown.y ? view : {
|
|
184
|
+
x: view.x + x - shown.x,
|
|
185
|
+
y: view.y + y - shown.y,
|
|
186
|
+
k: view.k
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
/** This function tells if two views are equal. */
|
|
190
|
+
function sameView(a, b) {
|
|
191
|
+
return a.x === b.x && a.y === b.y && a.k === b.k;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* This function gives the view for the first rectangle of a list that an area of the screen shows at the zoom `least` or more.
|
|
195
|
+
*
|
|
196
|
+
* Give the bounds of the largest group of boxes first, then the bounds of smaller groups.
|
|
197
|
+
* If no rectangle is small enough, the result has the zoom `least` and the middle of the last rectangle at the middle of the area.
|
|
198
|
+
* An empty list gives `undefined`.
|
|
199
|
+
*/
|
|
200
|
+
function frameRects(rects, area, options) {
|
|
201
|
+
for (const rect of rects) {
|
|
202
|
+
const view = fitRect(rect, area, options);
|
|
203
|
+
if (view.k >= options.least) return view;
|
|
204
|
+
}
|
|
205
|
+
const last = rects.at(-1);
|
|
206
|
+
if (last === void 0) return void 0;
|
|
207
|
+
return viewAt(middleOf(last), middleOf(area), clampZoom(options.least, options.limits));
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* This function tells if a view shows all of a rectangle of the picture in an area of the screen.
|
|
211
|
+
* `margin` is the smallest distance between the rectangle and each edge of the area, in CSS pixels.
|
|
212
|
+
*/
|
|
213
|
+
function showsRect(view, rect, area, margin = 0) {
|
|
214
|
+
const shown = rectToScreen(view, rect);
|
|
215
|
+
return shown.x >= area.x + margin && shown.y >= area.y + margin && shown.x + shown.w <= area.x + area.w - margin && shown.y + shown.h <= area.y + area.h - margin;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* This function gives the view that shows a selection, and it keeps the view `view` when the selection is in view.
|
|
219
|
+
*
|
|
220
|
+
* The rectangles are the bounds of the groups of the selection, as for `frameRects`, the largest group first.
|
|
221
|
+
* The selection is in view when `view` has the zoom `least` or more, and shows all of the rectangle that `frameRects` selects.
|
|
222
|
+
* The result is then `view` itself, so a camera does not move for a click on a box that a person reads.
|
|
223
|
+
* In each other case, the result is the view of `frameRects`. An empty list gives `view`.
|
|
224
|
+
*/
|
|
225
|
+
function revealRects(view, rects, area, options) {
|
|
226
|
+
for (const rect of rects) {
|
|
227
|
+
const framed = fitRect(rect, area, options);
|
|
228
|
+
if (framed.k < options.least) continue;
|
|
229
|
+
return view.k >= options.least && showsRect(view, rect, area, options.margin ?? 0) ? view : framed;
|
|
230
|
+
}
|
|
231
|
+
return frameRects(rects.slice(-1), area, options) ?? view;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* This function gives the view at a part of the way between two views. `part` goes from 0 to 1.
|
|
235
|
+
*
|
|
236
|
+
* The zoom changes by an equal factor for each equal step, so a zoom has one speed in the picture.
|
|
237
|
+
* The way is a zoom at one screen point: the point of the picture that the two views show there stays there.
|
|
238
|
+
* Thus each point of the picture moves along a straight line of the screen, in one direction.
|
|
239
|
+
* Two views with one zoom give a straight move at one speed.
|
|
240
|
+
*/
|
|
241
|
+
function viewBetween(from, to, part) {
|
|
242
|
+
if (!(part > 0)) return from;
|
|
243
|
+
if (part >= 1) return to;
|
|
244
|
+
const log = Math.log(to.k / from.k);
|
|
245
|
+
if (!Number.isFinite(log)) return to;
|
|
246
|
+
const share = log === 0 ? part : Math.expm1(log * part) / Math.expm1(log);
|
|
247
|
+
return {
|
|
248
|
+
x: from.x + (to.x - from.x) * share,
|
|
249
|
+
y: from.y + (to.y - from.y) * share,
|
|
250
|
+
k: from.k * Math.exp(log * part)
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* This function gives the view of a camera at the time `now` of a move, in milliseconds.
|
|
255
|
+
* The move has a slow start and a slow end. A move with no duration is at its end immediately.
|
|
256
|
+
*/
|
|
257
|
+
function pictureMoveAt(move, now) {
|
|
258
|
+
const part = partAt(move.start, move.duration, now);
|
|
259
|
+
if (part >= 1) return {
|
|
260
|
+
view: move.to,
|
|
261
|
+
done: true
|
|
262
|
+
};
|
|
263
|
+
return {
|
|
264
|
+
view: viewBetween(move.from, move.to, easeInOut(part)),
|
|
265
|
+
done: false
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
// src/graph/aim.ts
|
|
269
|
+
/** This function makes the aim that shows all of the picture, as large as the free area permits. */
|
|
270
|
+
function aimAll(options = {}) {
|
|
271
|
+
return (frame) => fitRect(frame.bounds, frame.area, {
|
|
272
|
+
...options,
|
|
273
|
+
limits: options.limits ?? frame.limits
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* This function makes the aim that shows a group of boxes at a zoom that a person reads.
|
|
278
|
+
* The rectangles are the bounds of the groups, the largest group first: `frameRects` selects one. An empty list keeps the view.
|
|
279
|
+
*/
|
|
280
|
+
function aimRects(rects, options) {
|
|
281
|
+
return (frame) => frameRects(rects, frame.area, {
|
|
282
|
+
...options,
|
|
283
|
+
limits: options.limits ?? frame.limits
|
|
284
|
+
}) ?? frame.view;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* This function makes the aim that shows a selection, and keeps the view when the selection is in view.
|
|
288
|
+
* The rectangles are the bounds of the groups of the selection, the largest group first: `revealRects` selects one.
|
|
289
|
+
*/
|
|
290
|
+
function aimReveal(rects, options) {
|
|
291
|
+
return (frame) => revealRects(frame.view, rects, frame.area, {
|
|
292
|
+
...options,
|
|
293
|
+
limits: options.limits ?? frame.limits
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
// src/graph/keys.ts
|
|
297
|
+
/**
|
|
298
|
+
* This function gives the action of a key on a flat picture, or `undefined` for a key with no action.
|
|
299
|
+
*
|
|
300
|
+
* `area` is the part of the screen that shows the picture. `freeArea` gives it.
|
|
301
|
+
* An arrow key moves the camera by the part `KEY_PART` of the smaller side of the area.
|
|
302
|
+
* The keys `+` and `-` zoom at the middle of the area, by the factor of one step of a key on a 3D stage.
|
|
303
|
+
* The keys `Home` and `0` show the home view.
|
|
304
|
+
*/
|
|
305
|
+
function pictureKeyAction(key, now, area, options) {
|
|
306
|
+
const step = Math.min(area.w, area.h) * KEY_PART;
|
|
307
|
+
const middle = middleOf(area);
|
|
308
|
+
switch (key) {
|
|
309
|
+
case "ArrowLeft": return {
|
|
310
|
+
type: "move",
|
|
311
|
+
to: panView(now, step, 0)
|
|
312
|
+
};
|
|
313
|
+
case "ArrowRight": return {
|
|
314
|
+
type: "move",
|
|
315
|
+
to: panView(now, 0 - step, 0)
|
|
316
|
+
};
|
|
317
|
+
case "ArrowUp": return {
|
|
318
|
+
type: "move",
|
|
319
|
+
to: panView(now, 0, step)
|
|
320
|
+
};
|
|
321
|
+
case "ArrowDown": return {
|
|
322
|
+
type: "move",
|
|
323
|
+
to: panView(now, 0, 0 - step)
|
|
324
|
+
};
|
|
325
|
+
case "+":
|
|
326
|
+
case "=": return {
|
|
327
|
+
type: "move",
|
|
328
|
+
to: zoomView(now, middle, 1 / KEY_ZOOM, options.limits)
|
|
329
|
+
};
|
|
330
|
+
case "-":
|
|
331
|
+
case "_": return {
|
|
332
|
+
type: "move",
|
|
333
|
+
to: zoomView(now, middle, KEY_ZOOM, options.limits)
|
|
334
|
+
};
|
|
335
|
+
case "Home":
|
|
336
|
+
case "0": return {
|
|
337
|
+
type: "view",
|
|
338
|
+
view: options.home
|
|
339
|
+
};
|
|
340
|
+
default: {
|
|
341
|
+
const view = key.length === 1 ? options.views?.[key.toLowerCase()] : void 0;
|
|
342
|
+
return view === void 0 ? void 0 : {
|
|
343
|
+
type: "view",
|
|
344
|
+
view
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
// src/graph/pointers.ts
|
|
350
|
+
/** The pointers of a picture that no pointer is down on. */
|
|
351
|
+
const NO_POINTERS = {
|
|
352
|
+
at: /* @__PURE__ */ new Map(),
|
|
353
|
+
start: void 0,
|
|
354
|
+
many: false
|
|
355
|
+
};
|
|
356
|
+
/** A finger moves more than a mouse between down and up. This is the distance of a click for a finger, in CSS pixels. */
|
|
357
|
+
const TOUCH_CLICK_DISTANCE = 10;
|
|
358
|
+
/** This function gives the pointers after a pointer went down. The first pointer starts a possible click. */
|
|
359
|
+
function pointerDown(pointers, id, at) {
|
|
360
|
+
const next = new Map(pointers.at).set(id, at);
|
|
361
|
+
return next.size === 1 ? {
|
|
362
|
+
at: next,
|
|
363
|
+
start: at,
|
|
364
|
+
many: false
|
|
365
|
+
} : {
|
|
366
|
+
at: next,
|
|
367
|
+
start: pointers.start,
|
|
368
|
+
many: true
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* This function gives the pointers and the view after a pointer moved.
|
|
373
|
+
*
|
|
374
|
+
* One pointer moves the picture, so the point of the picture below the pointer stays there.
|
|
375
|
+
* Two pointers make a pinch: `pinchView` gives the view. Three pointers or more do not change the view.
|
|
376
|
+
* A pointer that is not down changes nothing.
|
|
377
|
+
*/
|
|
378
|
+
function pointerMove(pointers, id, at, view, limits = ZOOM_LIMITS) {
|
|
379
|
+
const old = pointers.at.get(id);
|
|
380
|
+
if (old === void 0) return {
|
|
381
|
+
pointers,
|
|
382
|
+
view
|
|
383
|
+
};
|
|
384
|
+
const next = {
|
|
385
|
+
...pointers,
|
|
386
|
+
at: new Map(pointers.at).set(id, at)
|
|
387
|
+
};
|
|
388
|
+
if (pointers.at.size === 1) return {
|
|
389
|
+
pointers: next,
|
|
390
|
+
view: panView(view, at.x - old.x, at.y - old.y)
|
|
391
|
+
};
|
|
392
|
+
if (pointers.at.size > 2) return {
|
|
393
|
+
pointers: next,
|
|
394
|
+
view
|
|
395
|
+
};
|
|
396
|
+
for (const [key, other] of pointers.at) if (key !== id) return {
|
|
397
|
+
pointers: next,
|
|
398
|
+
view: pinchView(view, [old, other], [at, other], limits)
|
|
399
|
+
};
|
|
400
|
+
return {
|
|
401
|
+
pointers: next,
|
|
402
|
+
view
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* This function gives the pointers after a pointer went up, and tells if the pointer made a click.
|
|
407
|
+
*
|
|
408
|
+
* A click is one pointer that went up not more than `limit` from its start, with no second pointer between.
|
|
409
|
+
* The default of `limit` is `CLICK_DISTANCE`. Use `TOUCH_CLICK_DISTANCE` for a finger.
|
|
410
|
+
*/
|
|
411
|
+
function pointerUp(pointers, id, at, limit = 4) {
|
|
412
|
+
if (!pointers.at.has(id)) return {
|
|
413
|
+
pointers,
|
|
414
|
+
click: false
|
|
415
|
+
};
|
|
416
|
+
const rest = new Map(pointers.at);
|
|
417
|
+
rest.delete(id);
|
|
418
|
+
if (rest.size > 0) return {
|
|
419
|
+
pointers: {
|
|
420
|
+
...pointers,
|
|
421
|
+
at: rest
|
|
422
|
+
},
|
|
423
|
+
click: false
|
|
424
|
+
};
|
|
425
|
+
return {
|
|
426
|
+
pointers: NO_POINTERS,
|
|
427
|
+
click: !pointers.many && pointers.start !== void 0 && isClick(pointers.start, at, limit)
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
/** This function gives the pointers after the browser stopped a pointer, for example for a gesture of the system. It makes no click. */
|
|
431
|
+
function pointerCancel(pointers, id) {
|
|
432
|
+
if (!pointers.at.has(id)) return pointers;
|
|
433
|
+
const rest = new Map(pointers.at);
|
|
434
|
+
rest.delete(id);
|
|
435
|
+
return rest.size > 0 ? {
|
|
436
|
+
...pointers,
|
|
437
|
+
at: rest
|
|
438
|
+
} : NO_POINTERS;
|
|
439
|
+
}
|
|
440
|
+
// src/graph/stack.ts
|
|
441
|
+
/**
|
|
442
|
+
* This function makes one content from a list of contents, for a flat stage that shows them together.
|
|
443
|
+
* An example is a layer of boxes below a layer of routes and a layer of labels.
|
|
444
|
+
*
|
|
445
|
+
* - The first content gives the bounds: the views and the limits of the camera come from it.
|
|
446
|
+
* - The stack draws the contents in their sequence, so the last content is on top.
|
|
447
|
+
* - A pick asks the last content first. The first record that a content gives is the record.
|
|
448
|
+
* - A record that two contents have is one record: each of them gets its highlight.
|
|
449
|
+
* - A content does not get the state of the canvas of an earlier content: the stack restores it.
|
|
450
|
+
* - The stage disposes the stack, and the stack disposes each content.
|
|
451
|
+
*/
|
|
452
|
+
function stackPictureContents(contents) {
|
|
453
|
+
const [first] = contents;
|
|
454
|
+
return {
|
|
455
|
+
get bounds() {
|
|
456
|
+
return first.bounds;
|
|
457
|
+
},
|
|
458
|
+
has: (record) => contents.some((content) => content.has(record)),
|
|
459
|
+
pick(at) {
|
|
460
|
+
for (let index = contents.length - 1; index >= 0; index -= 1) {
|
|
461
|
+
const pick = contents[index]?.pick(at);
|
|
462
|
+
if (pick !== void 0) return pick;
|
|
463
|
+
}
|
|
464
|
+
},
|
|
465
|
+
draw(context, frame, theme, highlight) {
|
|
466
|
+
let active = false;
|
|
467
|
+
for (const content of contents) {
|
|
468
|
+
context.save();
|
|
469
|
+
active = content.draw(context, frame, theme, highlight) || active;
|
|
470
|
+
context.restore();
|
|
471
|
+
}
|
|
472
|
+
return active;
|
|
473
|
+
},
|
|
474
|
+
dispose() {
|
|
475
|
+
for (const content of contents) content.dispose?.();
|
|
476
|
+
}
|
|
477
|
+
};
|
|
478
|
+
}
|
|
479
|
+
// src/graph/stage.ts
|
|
480
|
+
/** The distance from a mouse at which a thin part is below the pointer, in CSS pixels. */
|
|
481
|
+
const PICK_SLACK = 5;
|
|
482
|
+
/** The distance from a finger or a pen at which a thin part is below the pointer, in CSS pixels. */
|
|
483
|
+
const TOUCH_PICK_SLACK = 12;
|
|
484
|
+
/** The factor of the zoom for a double click. */
|
|
485
|
+
const DOUBLE_CLICK_ZOOM = 2;
|
|
486
|
+
/** The largest number of pixels of the canvas for one CSS pixel. A larger number costs memory, and a person does not see it. */
|
|
487
|
+
const LARGEST_PIXEL_RATIO = 3;
|
|
488
|
+
/**
|
|
489
|
+
* This function makes a flat stage in a container of a page. The stage fills the container, so give the container a size.
|
|
490
|
+
*
|
|
491
|
+
* A person moves the picture with a drag, and changes the zoom with the wheel, with two fingers or with a double click.
|
|
492
|
+
* A click selects the record below the pointer. With the keyboard, the arrow keys move the camera, `+` and `-` change the zoom,
|
|
493
|
+
* and `Home` shows the first view. The stage makes a picture only after a change.
|
|
494
|
+
*
|
|
495
|
+
* The function gives `undefined` when the browser gives no 2D context for a canvas. It does not throw.
|
|
496
|
+
*/
|
|
497
|
+
function createPictureStage(container, options) {
|
|
498
|
+
const canvas = container.ownerDocument.createElement("canvas");
|
|
499
|
+
const made = canvas.getContext("2d");
|
|
500
|
+
if (made === null) return void 0;
|
|
501
|
+
const context = made;
|
|
502
|
+
canvas.style.display = "block";
|
|
503
|
+
canvas.style.width = "100%";
|
|
504
|
+
canvas.style.height = "100%";
|
|
505
|
+
canvas.style.cursor = "grab";
|
|
506
|
+
canvas.style.touchAction = "none";
|
|
507
|
+
canvas.tabIndex = 0;
|
|
508
|
+
canvas.setAttribute("role", "application");
|
|
509
|
+
canvas.setAttribute("aria-label", options.label);
|
|
510
|
+
container.append(canvas);
|
|
511
|
+
const views = {
|
|
512
|
+
all: aimAll(),
|
|
513
|
+
...options.views
|
|
514
|
+
};
|
|
515
|
+
const home = options.home ?? "all";
|
|
516
|
+
const baseLimits = options.limits ?? ZOOM_LIMITS;
|
|
517
|
+
const wheel = options.wheel ?? "in-use";
|
|
518
|
+
let content = options.content;
|
|
519
|
+
let theme = options.theme;
|
|
520
|
+
let insets = options.insets ?? {};
|
|
521
|
+
let highlights = NO_HIGHLIGHTS;
|
|
522
|
+
/** The size of the picture, in CSS pixels. */
|
|
523
|
+
let width = 0;
|
|
524
|
+
let height = 0;
|
|
525
|
+
let pixelRatio = 1;
|
|
526
|
+
/** This value is true after the container gave a size. A stage with no size makes no picture. */
|
|
527
|
+
let sized = false;
|
|
528
|
+
let area = freeArea({
|
|
529
|
+
width,
|
|
530
|
+
height
|
|
531
|
+
}, insets);
|
|
532
|
+
let limits = baseLimits;
|
|
533
|
+
let view = UNIT_VIEW;
|
|
534
|
+
/** The view that the camera has, or goes to: a name of the views, or an aim. */
|
|
535
|
+
let aim = home;
|
|
536
|
+
let move;
|
|
537
|
+
/** This value is true after a person moved the view. Then a new size of the container does not aim the camera again. */
|
|
538
|
+
let moved = false;
|
|
539
|
+
/** This value is true until the content had a picture with no time. */
|
|
540
|
+
let settle = true;
|
|
541
|
+
/** This value is true while a person uses the picture. The wheel then changes the zoom. */
|
|
542
|
+
let inUse = false;
|
|
543
|
+
let pointers = NO_POINTERS;
|
|
544
|
+
/** This value is true while a pointer that is down moves the picture. */
|
|
545
|
+
let dragging = false;
|
|
546
|
+
/** The view that `onView` got last. */
|
|
547
|
+
let told;
|
|
548
|
+
let frame = 0;
|
|
549
|
+
let lastTime = 0;
|
|
550
|
+
let disposed = false;
|
|
551
|
+
const invalidate = () => {
|
|
552
|
+
if (frame === 0 && !disposed) frame = requestAnimationFrame(tick);
|
|
553
|
+
};
|
|
554
|
+
const setCursor = () => {
|
|
555
|
+
canvas.style.cursor = dragging ? "grabbing" : highlights.hovered === void 0 ? "grab" : "pointer";
|
|
556
|
+
};
|
|
557
|
+
/** This function sets the free area and the limits of the zoom, from the size, the insets and the content. */
|
|
558
|
+
const setArea = () => {
|
|
559
|
+
area = freeArea({
|
|
560
|
+
width,
|
|
561
|
+
height
|
|
562
|
+
}, insets);
|
|
563
|
+
limits = zoomLimitsFor(content.bounds, area, baseLimits);
|
|
564
|
+
};
|
|
565
|
+
const aimFrame = () => ({
|
|
566
|
+
bounds: content.bounds,
|
|
567
|
+
area,
|
|
568
|
+
view,
|
|
569
|
+
limits
|
|
570
|
+
});
|
|
571
|
+
/** This function moves the camera to a view, with a move or immediately. A picture with no size has no move. */
|
|
572
|
+
const glide = (to, animate) => {
|
|
573
|
+
if (animate && sized && !lessMotion() && !sameView(view, to)) move = {
|
|
574
|
+
from: view,
|
|
575
|
+
to,
|
|
576
|
+
start: performance.now(),
|
|
577
|
+
duration: 380
|
|
578
|
+
};
|
|
579
|
+
else {
|
|
580
|
+
move = void 0;
|
|
581
|
+
view = to;
|
|
582
|
+
}
|
|
583
|
+
invalidate();
|
|
584
|
+
};
|
|
585
|
+
const goTo = (next, animate) => {
|
|
586
|
+
const found = typeof next === "string" ? views[next] : next;
|
|
587
|
+
if (found === void 0) return;
|
|
588
|
+
aim = next;
|
|
589
|
+
moved = false;
|
|
590
|
+
glide(found(aimFrame()), animate);
|
|
591
|
+
};
|
|
592
|
+
/**
|
|
593
|
+
* This function sets a view that a person made, immediately. The zoom stays in its limits, and a part of the picture stays in the free area.
|
|
594
|
+
* A zoom that the limits change keeps the point of the picture at the middle of the free area.
|
|
595
|
+
*/
|
|
596
|
+
const hold = (base) => {
|
|
597
|
+
const k = clampZoom(base.k, limits);
|
|
598
|
+
const middle = middleOf(area);
|
|
599
|
+
move = void 0;
|
|
600
|
+
view = keepRect(k === base.k ? base : viewAt(toPicture(base, middle), middle, k), content.bounds, area);
|
|
601
|
+
invalidate();
|
|
602
|
+
};
|
|
603
|
+
/** This function sets a view that a person made with a pointer, the wheel or a key. */
|
|
604
|
+
const steer = (next) => {
|
|
605
|
+
moved = true;
|
|
606
|
+
hold(next);
|
|
607
|
+
};
|
|
608
|
+
/**
|
|
609
|
+
* This function sets the size of the canvas from the size of the container and the pixels of the screen.
|
|
610
|
+
* It gives true after a change. A container with no size changes nothing.
|
|
611
|
+
*/
|
|
612
|
+
const setSize = () => {
|
|
613
|
+
const wide = container.clientWidth;
|
|
614
|
+
const tall = container.clientHeight;
|
|
615
|
+
if (wide === 0 || tall === 0) return false;
|
|
616
|
+
const ratio = Math.min(globalThis.devicePixelRatio > 0 ? globalThis.devicePixelRatio : 1, LARGEST_PIXEL_RATIO);
|
|
617
|
+
if (wide === width && tall === height && ratio === pixelRatio) return false;
|
|
618
|
+
width = wide;
|
|
619
|
+
height = tall;
|
|
620
|
+
pixelRatio = ratio;
|
|
621
|
+
canvas.width = Math.round(wide * ratio);
|
|
622
|
+
canvas.height = Math.round(tall * ratio);
|
|
623
|
+
return true;
|
|
624
|
+
};
|
|
625
|
+
/** This function sets the camera after a change of the size of the picture. */
|
|
626
|
+
const fitAgain = () => {
|
|
627
|
+
const before = area;
|
|
628
|
+
const first = !sized;
|
|
629
|
+
sized = true;
|
|
630
|
+
setArea();
|
|
631
|
+
if (first || !moved) {
|
|
632
|
+
goTo(aim, false);
|
|
633
|
+
return;
|
|
634
|
+
}
|
|
635
|
+
const base = move?.to ?? view;
|
|
636
|
+
hold(viewAt(toPicture(base, middleOf(before)), middleOf(area), base.k));
|
|
637
|
+
};
|
|
638
|
+
function tick(now) {
|
|
639
|
+
frame = 0;
|
|
640
|
+
if (disposed) return;
|
|
641
|
+
if (setSize()) fitAgain();
|
|
642
|
+
if (!sized) return;
|
|
643
|
+
const seconds = lastTime === 0 ? 1 / 60 : Math.min((now - lastTime) / 1e3, .1);
|
|
644
|
+
let active = false;
|
|
645
|
+
if (move !== void 0) {
|
|
646
|
+
const step = pictureMoveAt(move, now);
|
|
647
|
+
view = step.view;
|
|
648
|
+
if (step.done) move = void 0;
|
|
649
|
+
active = !step.done;
|
|
650
|
+
}
|
|
651
|
+
context.setTransform(1, 0, 0, 1, 0, 0);
|
|
652
|
+
context.clearRect(0, 0, canvas.width, canvas.height);
|
|
653
|
+
context.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0);
|
|
654
|
+
const shown = highlights;
|
|
655
|
+
const drawing = content.draw(context, {
|
|
656
|
+
view,
|
|
657
|
+
width,
|
|
658
|
+
height,
|
|
659
|
+
area,
|
|
660
|
+
pixelRatio,
|
|
661
|
+
seconds,
|
|
662
|
+
settle: settle || lessMotion()
|
|
663
|
+
}, theme, (record) => highlightOf(shown, record));
|
|
664
|
+
settle = false;
|
|
665
|
+
active = drawing || active;
|
|
666
|
+
lastTime = active ? now : 0;
|
|
667
|
+
if (told === void 0 || !sameView(told, view)) {
|
|
668
|
+
told = view;
|
|
669
|
+
options.onView?.(view);
|
|
670
|
+
}
|
|
671
|
+
if (active) invalidate();
|
|
672
|
+
}
|
|
673
|
+
/** This function gives the position of a pointer in the picture, in CSS pixels from its top left corner. */
|
|
674
|
+
const positionOf = (event) => {
|
|
675
|
+
const box = canvas.getBoundingClientRect();
|
|
676
|
+
return {
|
|
677
|
+
x: event.clientX - box.left,
|
|
678
|
+
y: event.clientY - box.top
|
|
679
|
+
};
|
|
680
|
+
};
|
|
681
|
+
const pickAt = (screen, slack) => content.pick({
|
|
682
|
+
point: toPicture(view, screen),
|
|
683
|
+
screen,
|
|
684
|
+
view,
|
|
685
|
+
slack
|
|
686
|
+
});
|
|
687
|
+
const setHover = (pick) => {
|
|
688
|
+
const record = pick?.record;
|
|
689
|
+
if (record === highlights.hovered) return;
|
|
690
|
+
highlights = {
|
|
691
|
+
...highlights,
|
|
692
|
+
hovered: record
|
|
693
|
+
};
|
|
694
|
+
setCursor();
|
|
695
|
+
invalidate();
|
|
696
|
+
options.onHover?.(pick?.value);
|
|
697
|
+
};
|
|
698
|
+
const listeners = new AbortController();
|
|
699
|
+
const signal = listeners.signal;
|
|
700
|
+
canvas.addEventListener("pointerdown", (event) => {
|
|
701
|
+
if (event.button !== 0) return;
|
|
702
|
+
inUse = true;
|
|
703
|
+
canvas.focus({ preventScroll: true });
|
|
704
|
+
try {
|
|
705
|
+
canvas.setPointerCapture(event.pointerId);
|
|
706
|
+
} catch {}
|
|
707
|
+
if (move !== void 0) {
|
|
708
|
+
move = void 0;
|
|
709
|
+
moved = true;
|
|
710
|
+
}
|
|
711
|
+
pointers = pointerDown(pointers, event.pointerId, positionOf(event));
|
|
712
|
+
}, { signal });
|
|
713
|
+
canvas.addEventListener("pointermove", (event) => {
|
|
714
|
+
if (pointers.at.has(event.pointerId)) {
|
|
715
|
+
const next = pointerMove(pointers, event.pointerId, positionOf(event), view, limits);
|
|
716
|
+
pointers = next.pointers;
|
|
717
|
+
if (sameView(next.view, view)) return;
|
|
718
|
+
dragging = true;
|
|
719
|
+
setCursor();
|
|
720
|
+
steer(next.view);
|
|
721
|
+
return;
|
|
722
|
+
}
|
|
723
|
+
if (event.pointerType !== "touch" && pointers.at.size === 0) setHover(pickAt(positionOf(event), 5));
|
|
724
|
+
}, { signal });
|
|
725
|
+
canvas.addEventListener("pointerup", (event) => {
|
|
726
|
+
if (!pointers.at.has(event.pointerId)) return;
|
|
727
|
+
const mouse = event.pointerType === "mouse";
|
|
728
|
+
const position = positionOf(event);
|
|
729
|
+
const up = pointerUp(pointers, event.pointerId, position, mouse ? 4 : 10);
|
|
730
|
+
pointers = up.pointers;
|
|
731
|
+
if (pointers.at.size === 0) {
|
|
732
|
+
dragging = false;
|
|
733
|
+
setCursor();
|
|
734
|
+
}
|
|
735
|
+
if (!up.click) return;
|
|
736
|
+
const pick = pickAt(position, mouse ? 5 : 12);
|
|
737
|
+
highlights = {
|
|
738
|
+
...highlights,
|
|
739
|
+
selected: pick?.record
|
|
740
|
+
};
|
|
741
|
+
invalidate();
|
|
742
|
+
options.onSelect?.(pick?.value);
|
|
743
|
+
}, { signal });
|
|
744
|
+
canvas.addEventListener("pointercancel", (event) => {
|
|
745
|
+
pointers = pointerCancel(pointers, event.pointerId);
|
|
746
|
+
if (pointers.at.size > 0) return;
|
|
747
|
+
dragging = false;
|
|
748
|
+
setCursor();
|
|
749
|
+
}, { signal });
|
|
750
|
+
canvas.addEventListener("pointerleave", (event) => {
|
|
751
|
+
setHover(void 0);
|
|
752
|
+
if (event.pointerType === "mouse") inUse = false;
|
|
753
|
+
}, { signal });
|
|
754
|
+
canvas.addEventListener("blur", () => {
|
|
755
|
+
inUse = false;
|
|
756
|
+
}, { signal });
|
|
757
|
+
canvas.addEventListener("wheel", (event) => {
|
|
758
|
+
if (wheel === "in-use" && !inUse && !event.ctrlKey) return;
|
|
759
|
+
event.preventDefault();
|
|
760
|
+
steer(zoomView(view, positionOf(event), wheelFactor(event.deltaY, event.deltaMode, event.ctrlKey), limits));
|
|
761
|
+
}, {
|
|
762
|
+
signal,
|
|
763
|
+
passive: false
|
|
764
|
+
});
|
|
765
|
+
canvas.addEventListener("dblclick", (event) => {
|
|
766
|
+
event.preventDefault();
|
|
767
|
+
moved = true;
|
|
768
|
+
glide(keepRect(zoomView(view, positionOf(event), 2, limits), content.bounds, area), true);
|
|
769
|
+
}, { signal });
|
|
770
|
+
canvas.addEventListener("keydown", (event) => {
|
|
771
|
+
if (event.altKey || event.ctrlKey || event.metaKey) return;
|
|
772
|
+
const action = pictureKeyAction(event.key, view, area, {
|
|
773
|
+
home,
|
|
774
|
+
views: options.keys,
|
|
775
|
+
limits
|
|
776
|
+
});
|
|
777
|
+
if (action === void 0) return;
|
|
778
|
+
event.preventDefault();
|
|
779
|
+
inUse = true;
|
|
780
|
+
if (action.type === "view") goTo(action.view, true);
|
|
781
|
+
else steer(action.to);
|
|
782
|
+
}, { signal });
|
|
783
|
+
const observer = new ResizeObserver(() => {
|
|
784
|
+
if (!disposed && setSize()) fitAgain();
|
|
785
|
+
});
|
|
786
|
+
if (setSize()) fitAgain();
|
|
787
|
+
observer.observe(container);
|
|
788
|
+
invalidate();
|
|
789
|
+
return {
|
|
790
|
+
canvas,
|
|
791
|
+
setContent(next) {
|
|
792
|
+
if (disposed || next === content) return;
|
|
793
|
+
content.dispose?.();
|
|
794
|
+
content = next;
|
|
795
|
+
const selected = highlights.selected !== void 0 && content.has(highlights.selected) ? highlights.selected : void 0;
|
|
796
|
+
highlights = {
|
|
797
|
+
...highlights,
|
|
798
|
+
hovered: void 0,
|
|
799
|
+
selected
|
|
800
|
+
};
|
|
801
|
+
settle = true;
|
|
802
|
+
setCursor();
|
|
803
|
+
setArea();
|
|
804
|
+
if (moved) hold(move?.to ?? view);
|
|
805
|
+
else goTo(aim, false);
|
|
806
|
+
},
|
|
807
|
+
setTheme(next) {
|
|
808
|
+
theme = next;
|
|
809
|
+
invalidate();
|
|
810
|
+
},
|
|
811
|
+
setView(next, animate = true) {
|
|
812
|
+
goTo(next, animate);
|
|
813
|
+
},
|
|
814
|
+
setInsets(next) {
|
|
815
|
+
insets = next;
|
|
816
|
+
setArea();
|
|
817
|
+
if (!sized) return;
|
|
818
|
+
if (moved) hold(move?.to ?? view);
|
|
819
|
+
else goTo(aim, true);
|
|
820
|
+
},
|
|
821
|
+
view: () => view,
|
|
822
|
+
area: () => area,
|
|
823
|
+
zoomBy(factor, animate = true) {
|
|
824
|
+
moved = true;
|
|
825
|
+
glide(keepRect(zoomView(move?.to ?? view, middleOf(area), factor, limits), content.bounds, area), animate);
|
|
826
|
+
},
|
|
827
|
+
highlight(records) {
|
|
828
|
+
highlights = {
|
|
829
|
+
...highlights,
|
|
830
|
+
highlighted: new Set(records)
|
|
831
|
+
};
|
|
832
|
+
invalidate();
|
|
833
|
+
},
|
|
834
|
+
select(record) {
|
|
835
|
+
highlights = {
|
|
836
|
+
...highlights,
|
|
837
|
+
selected: record
|
|
838
|
+
};
|
|
839
|
+
invalidate();
|
|
840
|
+
},
|
|
841
|
+
refresh: invalidate,
|
|
842
|
+
dispose() {
|
|
843
|
+
if (disposed) return;
|
|
844
|
+
disposed = true;
|
|
845
|
+
cancelAnimationFrame(frame);
|
|
846
|
+
observer.disconnect();
|
|
847
|
+
listeners.abort();
|
|
848
|
+
content.dispose?.();
|
|
849
|
+
canvas.remove();
|
|
850
|
+
}
|
|
851
|
+
};
|
|
852
|
+
}
|
|
853
|
+
export { DOUBLE_CLICK_ZOOM, FIT_PADDING, KEEP_IN_VIEW, NO_POINTERS, PICK_SLACK, SMALLEST_AREA, TOUCH_CLICK_DISTANCE, TOUCH_PICK_SLACK, UNIT_VIEW, WHEEL_LINE, WHEEL_PINCH, WHEEL_SPEED, ZOOM_LIMITS, aimAll, aimRects, aimReveal, clampZoom, createPictureStage, fitRect, frameRects, freeArea, keepRect, panView, pictureKeyAction, pictureMoveAt, pinchView, pointerCancel, pointerDown, pointerMove, pointerUp, rectToScreen, revealRects, showsRect, stackPictureContents, toPicture, toScreen, viewAt, viewBetween, wheelFactor, zoomLimitsFor, zoomView };
|
|
854
|
+
|
|
855
|
+
//# sourceMappingURL=graph.js.map
|