hephaestus-wasm 0.2.0 → 0.3.0
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/hephaestus.d.ts +23 -4
- package/hephaestus.js +174 -52
- package/hephaestus_wasm.d.ts +8 -8
- package/hephaestus_wasm.js +13 -16
- package/hephaestus_wasm_bg.wasm +0 -0
- package/package.json +1 -1
package/hephaestus.d.ts
CHANGED
|
@@ -87,9 +87,8 @@ export interface PlotViewOptions {
|
|
|
87
87
|
colorScheme?: 'light' | 'dark' | 'auto';
|
|
88
88
|
/** Track the canvas's CSS box with a ResizeObserver. Default `true`. */
|
|
89
89
|
autoResize?: boolean;
|
|
90
|
-
/**
|
|
90
|
+
/** Record a hit index while drawing, enabling `pickAt`. Default `false`. */
|
|
91
91
|
picking?: boolean;
|
|
92
|
-
/** Overlay an image so right-click offers the usual save entries. */
|
|
93
92
|
/**
|
|
94
93
|
* Give the canvas the context menu an ordinary image has. A string names
|
|
95
94
|
* the saved file (`true` means `plot.png`); the name is a hint a browser
|
|
@@ -98,6 +97,23 @@ export interface PlotViewOptions {
|
|
|
98
97
|
saveOnRightClick?: boolean | string;
|
|
99
98
|
/** Set `false` to skip fetching the bundled font when none is registered. */
|
|
100
99
|
defaultFont?: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* A static image to show until the first live frame is on the canvas.
|
|
102
|
+
*
|
|
103
|
+
* An `HTMLImageElement` already in the page is adopted, which is the form
|
|
104
|
+
* that reaches the first paint: a producer that can rasterise the plot
|
|
105
|
+
* itself puts the picture in the served HTML and the viewer sees it before
|
|
106
|
+
* any script runs. A string is a URL for an element created here, which
|
|
107
|
+
* cannot beat the renderer to the screen but is the convenient form for a
|
|
108
|
+
* lazy embed.
|
|
109
|
+
*
|
|
110
|
+
* It becomes the `saveOnRightClick` overlay once the live frame replaces
|
|
111
|
+
* it, so the two share one node. Nothing touches it until there is a frame
|
|
112
|
+
* to reveal, so a renderer that never starts leaves the picture on screen —
|
|
113
|
+
* which is the whole fallback story for a browser `isSupported` refuses.
|
|
114
|
+
* Adopting an element transfers ownership: `free()` removes it.
|
|
115
|
+
*/
|
|
116
|
+
placeholder?: HTMLImageElement | string;
|
|
101
117
|
}
|
|
102
118
|
|
|
103
119
|
/** The size and dpi a document's writer recorded, if any. Advisory. */
|
|
@@ -131,12 +147,15 @@ export class PlotView {
|
|
|
131
147
|
|
|
132
148
|
/**
|
|
133
149
|
* The row id under a point, in CSS pixels, or `undefined` for empty space.
|
|
134
|
-
* Needs `picking: true
|
|
150
|
+
* Needs `picking: true`.
|
|
135
151
|
*/
|
|
136
152
|
pickAt(cssX: number, cssY: number): number | undefined;
|
|
137
153
|
|
|
138
154
|
hints(): DocumentHints;
|
|
139
155
|
|
|
140
|
-
/**
|
|
156
|
+
/**
|
|
157
|
+
* Detach observers and release the wasm-side handle. Removes the overlay
|
|
158
|
+
* image, including a `placeholder` element the page supplied.
|
|
159
|
+
*/
|
|
141
160
|
free(): void;
|
|
142
161
|
}
|
package/hephaestus.js
CHANGED
|
@@ -204,20 +204,32 @@ export async function registerDefaultFonts() {
|
|
|
204
204
|
export class PlotView {
|
|
205
205
|
/**
|
|
206
206
|
* @param {HTMLCanvasElement} canvas
|
|
207
|
-
* @param {Uint8Array|ArrayBuffer} doc bytes of a `.
|
|
207
|
+
* @param {Uint8Array|ArrayBuffer} doc bytes of a `.hep` document.
|
|
208
208
|
* @param {{ colorScheme?: 'light'|'dark'|'auto', autoResize?: boolean,
|
|
209
|
-
* picking?: boolean, saveOnRightClick?: boolean|string
|
|
210
|
-
*
|
|
211
|
-
*
|
|
209
|
+
* picking?: boolean, saveOnRightClick?: boolean|string,
|
|
210
|
+
* defaultFont?: boolean, placeholder?: HTMLImageElement|string }} [opts]
|
|
211
|
+
* `picking` makes the scene record a hit index as it draws, which costs
|
|
212
|
+
* CPU per draw call, so leave it off unless `pickAt` is going to be
|
|
213
|
+
* called.
|
|
212
214
|
* `saveOnRightClick` gives the canvas an ordinary image's context menu.
|
|
213
215
|
* Pass a string to name the saved file — a bare `true` uses `plot.png`.
|
|
214
216
|
* The name is a hint: a `data:` URL has no path for a browser to take a
|
|
215
217
|
* filename from, so it travels as a media-type parameter and an engine
|
|
216
218
|
* that ignores it falls back to whatever it would have chosen (Safari
|
|
217
|
-
* says "Unknown"). See {@link PlotView#
|
|
219
|
+
* says "Unknown"). See {@link PlotView#_enableSaveAffordance}.
|
|
218
220
|
* `defaultFont: false` suppresses fetching the bundled font when nothing
|
|
219
221
|
* else is registered, for a page that would rather render no text than
|
|
220
222
|
* pull ~260 kB.
|
|
223
|
+
* `placeholder` is a static image to show until the first live frame
|
|
224
|
+
* lands. An `HTMLImageElement` already in the page is adopted, which is
|
|
225
|
+
* the form that reaches the *first* paint: a producer that can rasterise
|
|
226
|
+
* the plot itself puts the picture in the served HTML and the viewer sees
|
|
227
|
+
* it before any script runs. A string is a URL for an element created
|
|
228
|
+
* here, which cannot beat the renderer to the screen but is the
|
|
229
|
+
* convenient form for a lazy embed. Either way it becomes the
|
|
230
|
+
* `saveOnRightClick` overlay once the live frame replaces it, so the two
|
|
231
|
+
* share one node. Nothing here touches it until there is a frame to
|
|
232
|
+
* reveal, so a renderer that never starts leaves the picture on screen.
|
|
221
233
|
*/
|
|
222
234
|
static async create(canvas, doc, opts = {}) {
|
|
223
235
|
if (!isSupported()) {
|
|
@@ -240,7 +252,13 @@ export class PlotView {
|
|
|
240
252
|
}
|
|
241
253
|
|
|
242
254
|
const handle = await PlotHandle.create(canvas, bytes, opts.picking === true);
|
|
243
|
-
|
|
255
|
+
const view = new PlotView(canvas, handle, opts);
|
|
256
|
+
// The constructor drew frame 1 synchronously and the browser has not
|
|
257
|
+
// painted since, so retiring here puts the reveal and the hide in one
|
|
258
|
+
// paint. Deferring to an animation frame would show the placeholder once
|
|
259
|
+
// more with the live frame already underneath.
|
|
260
|
+
view._retirePlaceholder();
|
|
261
|
+
return view;
|
|
244
262
|
}
|
|
245
263
|
|
|
246
264
|
/** @private — use {@link PlotView.create}. */
|
|
@@ -253,11 +271,23 @@ export class PlotView {
|
|
|
253
271
|
this._onMedia = null;
|
|
254
272
|
this._overlay = null;
|
|
255
273
|
this._refreshOverlay = null;
|
|
274
|
+
// Whether the overlay is still showing the host's picture. Until it is
|
|
275
|
+
// retired the element is opaque and the canvas beneath it is unseen, and
|
|
276
|
+
// the `error` handler and the save affordance both behave differently.
|
|
277
|
+
this._showingPlaceholder = false;
|
|
278
|
+
this._saveAs = null;
|
|
256
279
|
// Kept in step with `_applySize` so an exported PNG can declare the
|
|
257
280
|
// resolution it was actually rendered at.
|
|
258
281
|
this._dpi = 96 * (window.devicePixelRatio || 1);
|
|
259
282
|
this._freed = false;
|
|
260
283
|
|
|
284
|
+
if (opts.saveOnRightClick) {
|
|
285
|
+
this._saveAs = typeof opts.saveOnRightClick === 'string' ? opts.saveOnRightClick : 'plot.png';
|
|
286
|
+
}
|
|
287
|
+
// Before the first draw, so the picture is in place if anything below
|
|
288
|
+
// throws — and so an adopted element is never removed and re-added.
|
|
289
|
+
this._resolveOverlay(opts.placeholder);
|
|
290
|
+
|
|
261
291
|
this.setColorScheme(opts.colorScheme ?? 'light');
|
|
262
292
|
|
|
263
293
|
if (opts.autoResize !== false) {
|
|
@@ -277,61 +307,86 @@ export class PlotView {
|
|
|
277
307
|
}
|
|
278
308
|
this._syncSize();
|
|
279
309
|
|
|
280
|
-
if (
|
|
281
|
-
this._installImageOverlay(
|
|
282
|
-
typeof opts.saveOnRightClick === 'string' ? opts.saveOnRightClick : 'plot.png',
|
|
283
|
-
);
|
|
284
|
-
}
|
|
310
|
+
if (this._saveAs !== null) this._enableSaveAffordance(this._saveAs);
|
|
285
311
|
}
|
|
286
312
|
|
|
287
313
|
/**
|
|
288
|
-
*
|
|
289
|
-
*
|
|
290
|
-
* A `<canvas>` never offers "Save image as…" / "Copy image" / drag-to-save:
|
|
291
|
-
* those come from the hit-test node being an image, and a canvas is not
|
|
292
|
-
* one. Nor can a `contextmenu` handler retarget the menu. So the only way
|
|
293
|
-
* to get the *native* affordance — rather than a bespoke menu that looks
|
|
294
|
-
* nothing like the browser's — is for the right-click to genuinely land on
|
|
295
|
-
* an `<img>`.
|
|
314
|
+
* Put the overlay image in place, adopting one the page already has.
|
|
296
315
|
*
|
|
297
|
-
*
|
|
298
|
-
*
|
|
299
|
-
*
|
|
316
|
+
* One element serves two purposes in sequence. While it is opaque it is the
|
|
317
|
+
* placeholder — a picture of this plot, on screen before the renderer
|
|
318
|
+
* exists. Once {@link PlotView#_retirePlaceholder} drops it to transparent
|
|
319
|
+
* it is the save affordance, because a `<canvas>` never offers "Save image
|
|
320
|
+
* as…" / "Copy image" / drag-to-save: those come from the hit-test node
|
|
321
|
+
* being an image, and a `contextmenu` handler cannot retarget the menu. So
|
|
322
|
+
* the only way to get the *native* affordance — rather than a bespoke menu
|
|
323
|
+
* that looks nothing like the browser's — is for the right-click to
|
|
324
|
+
* genuinely land on an `<img>`.
|
|
300
325
|
*
|
|
301
|
-
*
|
|
302
|
-
*
|
|
303
|
-
*
|
|
304
|
-
*
|
|
305
|
-
*
|
|
326
|
+
* `placeholder` is an element to adopt, a URL to create one from, or
|
|
327
|
+
* nothing. With nothing and no `saveOnRightClick` there is no overlay at
|
|
328
|
+
* all — it would sit over the canvas swallowing the pointer events a page
|
|
329
|
+
* doing its own hit testing needs. With nothing and a filename the element
|
|
330
|
+
* is created transparent, as the save affordance alone.
|
|
306
331
|
*/
|
|
307
|
-
|
|
332
|
+
_resolveOverlay(placeholder) {
|
|
333
|
+
const wanted = placeholder != null && placeholder !== '';
|
|
334
|
+
if (!wanted && this._saveAs === null) return;
|
|
308
335
|
const parent = this.canvas.parentElement;
|
|
309
336
|
if (!parent) return;
|
|
310
337
|
// The overlay is positioned against the canvas's containing block, so
|
|
311
338
|
// that block has to be positioned. Only touched when it isn't already.
|
|
312
339
|
if (getComputedStyle(parent).position === 'static') parent.style.position = 'relative';
|
|
313
340
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
'
|
|
321
|
-
'
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
341
|
+
let img = null;
|
|
342
|
+
let adopted = false;
|
|
343
|
+
if (placeholder instanceof HTMLImageElement) {
|
|
344
|
+
img = placeholder;
|
|
345
|
+
adopted = true;
|
|
346
|
+
} else if (typeof placeholder === 'string' && placeholder !== '') {
|
|
347
|
+
img = document.createElement('img');
|
|
348
|
+
img.alt = '';
|
|
349
|
+
img.src = placeholder;
|
|
350
|
+
} else {
|
|
351
|
+
img = document.createElement('img');
|
|
352
|
+
img.alt = '';
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
// Invisible but hit-testable once retired: the canvas underneath is what
|
|
356
|
+
// the viewer sees, and `opacity` (rather than `visibility` or `display`)
|
|
357
|
+
// is what keeps the element in the hit-test tree. Opaque until then.
|
|
358
|
+
this._showingPlaceholder = wanted;
|
|
359
|
+
img.style.position = 'absolute';
|
|
360
|
+
img.style.inset = '0';
|
|
361
|
+
img.style.width = '100%';
|
|
362
|
+
img.style.height = '100%';
|
|
363
|
+
img.style.pointerEvents = 'auto';
|
|
364
|
+
img.style.touchAction = 'none';
|
|
365
|
+
img.style.opacity = this._showingPlaceholder ? '1' : '0';
|
|
366
|
+
|
|
367
|
+
img.addEventListener('error', () => this._onOverlayError(img));
|
|
368
|
+
// Last child, so it stacks above the canvas without needing a z-index.
|
|
369
|
+
// Re-appending an adopted element moves it, which is what we want.
|
|
333
370
|
parent.appendChild(img);
|
|
334
371
|
this._overlay = img;
|
|
372
|
+
// An adopted element carries a description the viewer can actually use
|
|
373
|
+
// while the picture is showing; one created here describes nothing.
|
|
374
|
+
if (!adopted) img.alt = '';
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* Refresh the overlay's `src` from the live frame when a menu is plausibly
|
|
379
|
+
* about to open.
|
|
380
|
+
*
|
|
381
|
+
* Encoding is lazy: a PNG per frame would be pointless work, so the src is
|
|
382
|
+
* refreshed only on pointer entry, a right/ctrl mousedown, and
|
|
383
|
+
* `contextmenu` itself. `mousedown` matters because a browser gathers the
|
|
384
|
+
* menu's image URL from the hit test, which can precede the `contextmenu`
|
|
385
|
+
* dispatch.
|
|
386
|
+
*/
|
|
387
|
+
_enableSaveAffordance(filename) {
|
|
388
|
+
const img = this._overlay;
|
|
389
|
+
if (!img) return;
|
|
335
390
|
|
|
336
391
|
const refresh = () => {
|
|
337
392
|
if (this._freed) return;
|
|
@@ -369,7 +424,11 @@ export class PlotView {
|
|
|
369
424
|
}
|
|
370
425
|
};
|
|
371
426
|
this._refreshOverlay = refresh;
|
|
372
|
-
|
|
427
|
+
// Not while the placeholder is up: the host's picture is already a
|
|
428
|
+
// correct image of this plot, so it serves as the initial src and the
|
|
429
|
+
// first pointer entry upgrades it. That keeps a render plus a full PNG
|
|
430
|
+
// encode off the path to the first frame.
|
|
431
|
+
if (!this._showingPlaceholder) refresh();
|
|
373
432
|
|
|
374
433
|
img.addEventListener('pointerenter', refresh);
|
|
375
434
|
img.addEventListener('mousedown', (e) => {
|
|
@@ -379,6 +438,65 @@ export class PlotView {
|
|
|
379
438
|
img.addEventListener('contextmenu', refresh);
|
|
380
439
|
}
|
|
381
440
|
|
|
441
|
+
/**
|
|
442
|
+
* Reveal the canvas, and leave the overlay as whatever it is still for.
|
|
443
|
+
*
|
|
444
|
+
* Called in the same task as the first draw, so one paint both shows the
|
|
445
|
+
* live frame and hides the picture over it. There is deliberately no
|
|
446
|
+
* transition: the two images agree pixel for pixel, and blending them
|
|
447
|
+
* would show a ghost where a hard cut shows nothing.
|
|
448
|
+
*/
|
|
449
|
+
_retirePlaceholder() {
|
|
450
|
+
if (!this._showingPlaceholder) return;
|
|
451
|
+
this._showingPlaceholder = false;
|
|
452
|
+
const img = this._overlay;
|
|
453
|
+
if (!img) return;
|
|
454
|
+
if (this._saveAs === null) {
|
|
455
|
+
// Nothing else wanted the element.
|
|
456
|
+
img.remove();
|
|
457
|
+
this._overlay = null;
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
460
|
+
img.style.opacity = '0';
|
|
461
|
+
// The host's picture is now the save overlay's src, so give it the
|
|
462
|
+
// filename hint the affordance would have. A prefix rewrite on a data URL
|
|
463
|
+
// and a no-op on anything else, and the element is already invisible so
|
|
464
|
+
// a re-decode cannot flicker.
|
|
465
|
+
if (!this._nameRejected && img.src.startsWith('data:')) {
|
|
466
|
+
img.src = named(img.src, this._saveAs);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
/**
|
|
471
|
+
* A failed overlay load, handled according to which phase it is in.
|
|
472
|
+
*
|
|
473
|
+
* While the picture is showing, a failure would put broken-image chrome
|
|
474
|
+
* over a canvas nobody has seen yet, so get out of the way at once and let
|
|
475
|
+
* the plot arrive as it would with no placeholder. Afterwards, the only
|
|
476
|
+
* expected cause is an engine rejecting the `name` media-type parameter, so
|
|
477
|
+
* fall back to the same bytes unnamed — an overlay that fails to load is
|
|
478
|
+
* not an image, and a right-click would silently get the ordinary element
|
|
479
|
+
* menu instead, which is the failure this guards.
|
|
480
|
+
*/
|
|
481
|
+
_onOverlayError(img) {
|
|
482
|
+
if (this._showingPlaceholder) {
|
|
483
|
+
this._showingPlaceholder = false;
|
|
484
|
+
img.style.opacity = '0';
|
|
485
|
+
if (this._saveAs === null) {
|
|
486
|
+
img.remove();
|
|
487
|
+
if (this._overlay === img) this._overlay = null;
|
|
488
|
+
} else if (this._refreshOverlay) {
|
|
489
|
+
this._refreshOverlay();
|
|
490
|
+
}
|
|
491
|
+
return;
|
|
492
|
+
}
|
|
493
|
+
const plain = img.src.replace(/;name=[^;,]*/, '');
|
|
494
|
+
if (plain !== img.src) {
|
|
495
|
+
this._nameRejected = true;
|
|
496
|
+
img.src = plain;
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
|
|
382
500
|
/** Draw immediately, cancelling any frame already scheduled. */
|
|
383
501
|
redraw() {
|
|
384
502
|
this._renderNow();
|
|
@@ -450,13 +568,12 @@ export class PlotView {
|
|
|
450
568
|
* otherwise get wrong on a high-density display.
|
|
451
569
|
*
|
|
452
570
|
* Returns `undefined` unless the view was created with `picking: true`.
|
|
453
|
-
*
|
|
454
|
-
* never waited on.
|
|
571
|
+
* Always describes the frame on screen.
|
|
455
572
|
*/
|
|
456
573
|
pickAt(cssX, cssY) {
|
|
457
574
|
if (this._freed) return undefined;
|
|
458
575
|
const ratio = this.canvas.width / (this.canvas.clientWidth || this.canvas.width);
|
|
459
|
-
return this.handle.pickAt(
|
|
576
|
+
return this.handle.pickAt(cssX * ratio, cssY * ratio);
|
|
460
577
|
}
|
|
461
578
|
|
|
462
579
|
/**
|
|
@@ -473,7 +590,12 @@ export class PlotView {
|
|
|
473
590
|
};
|
|
474
591
|
}
|
|
475
592
|
|
|
476
|
-
/**
|
|
593
|
+
/**
|
|
594
|
+
* Detach observers and release the wasm-side handle.
|
|
595
|
+
*
|
|
596
|
+
* Removes the overlay image, including a `placeholder` element the page
|
|
597
|
+
* supplied: adopting one transfers ownership of it.
|
|
598
|
+
*/
|
|
477
599
|
free() {
|
|
478
600
|
if (this._freed) return;
|
|
479
601
|
this._freed = true;
|
package/hephaestus_wasm.d.ts
CHANGED
|
@@ -19,9 +19,10 @@ export class PlotHandle {
|
|
|
19
19
|
* synchronously. Fails if the document is unreadable or if no WebGPU
|
|
20
20
|
* adapter is available — see [`is_supported`].
|
|
21
21
|
*
|
|
22
|
-
* `picking`
|
|
23
|
-
*
|
|
24
|
-
* called.
|
|
22
|
+
* `picking` makes the scene record a spatial hit index as it is drawn.
|
|
23
|
+
* That costs CPU per draw call whether or not anything is queried, so it
|
|
24
|
+
* stays off unless [`Self::pick_at`] is going to be called. Nothing is
|
|
25
|
+
* read back from the GPU either way.
|
|
25
26
|
*/
|
|
26
27
|
static create(canvas: HTMLCanvasElement, doc: Uint8Array, picking: boolean): Promise<PlotHandle>;
|
|
27
28
|
/**
|
|
@@ -50,9 +51,8 @@ export class PlotHandle {
|
|
|
50
51
|
* pixels, so scale a pointer event by the device pixel ratio. Always
|
|
51
52
|
* `undefined` unless `picking` was passed to [`Self::create`].
|
|
52
53
|
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
* the main thread's critical path.
|
|
54
|
+
* Answers from the index the scene built while it was drawn, so it
|
|
55
|
+
* always describes the frame on screen.
|
|
56
56
|
*/
|
|
57
57
|
pickAt(x: number, y: number): number | undefined;
|
|
58
58
|
/**
|
|
@@ -172,8 +172,8 @@ export interface InitOutput {
|
|
|
172
172
|
readonly plothandle_setDark: (a: number, b: number) => void;
|
|
173
173
|
readonly registerFont: (a: number, b: number, c: number) => void;
|
|
174
174
|
readonly setGenericFamily: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
175
|
-
readonly
|
|
176
|
-
readonly
|
|
175
|
+
readonly __wasm_bindgen_func_elem_4562: (a: number, b: number, c: number, d: number) => void;
|
|
176
|
+
readonly __wasm_bindgen_func_elem_4621: (a: number, b: number, c: number, d: number) => void;
|
|
177
177
|
readonly __wbindgen_export: (a: number, b: number) => number;
|
|
178
178
|
readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
179
179
|
readonly __wbindgen_export3: (a: number) => void;
|
package/hephaestus_wasm.js
CHANGED
|
@@ -31,9 +31,10 @@ export class PlotHandle {
|
|
|
31
31
|
* synchronously. Fails if the document is unreadable or if no WebGPU
|
|
32
32
|
* adapter is available — see [`is_supported`].
|
|
33
33
|
*
|
|
34
|
-
* `picking`
|
|
35
|
-
*
|
|
36
|
-
* called.
|
|
34
|
+
* `picking` makes the scene record a spatial hit index as it is drawn.
|
|
35
|
+
* That costs CPU per draw call whether or not anything is queried, so it
|
|
36
|
+
* stays off unless [`Self::pick_at`] is going to be called. Nothing is
|
|
37
|
+
* read back from the GPU either way.
|
|
37
38
|
* @param {HTMLCanvasElement} canvas
|
|
38
39
|
* @param {Uint8Array} doc
|
|
39
40
|
* @param {boolean} picking
|
|
@@ -108,9 +109,8 @@ export class PlotHandle {
|
|
|
108
109
|
* pixels, so scale a pointer event by the device pixel ratio. Always
|
|
109
110
|
* `undefined` unless `picking` was passed to [`Self::create`].
|
|
110
111
|
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
* the main thread's critical path.
|
|
112
|
+
* Answers from the index the scene built while it was drawn, so it
|
|
113
|
+
* always describes the frame on screen.
|
|
114
114
|
* @param {number} x
|
|
115
115
|
* @param {number} y
|
|
116
116
|
* @returns {number | undefined}
|
|
@@ -609,7 +609,7 @@ function __wbg_get_imports() {
|
|
|
609
609
|
const a = state0.a;
|
|
610
610
|
state0.a = 0;
|
|
611
611
|
try {
|
|
612
|
-
return
|
|
612
|
+
return __wasm_bindgen_func_elem_4621(a, state0.b, arg0, arg1);
|
|
613
613
|
} finally {
|
|
614
614
|
state0.a = a;
|
|
615
615
|
}
|
|
@@ -638,9 +638,6 @@ function __wbg_get_imports() {
|
|
|
638
638
|
const ret = getObject(arg0).queueMicrotask;
|
|
639
639
|
return addHeapObject(ret);
|
|
640
640
|
},
|
|
641
|
-
__wbg_readPixels_044c4e00430dd6f5: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) {
|
|
642
|
-
getObject(arg0).readPixels(arg1, arg2, arg3, arg4, arg5 >>> 0, arg6 >>> 0, arg7 === 0 ? undefined : getArrayU8FromWasm0(arg7, arg8));
|
|
643
|
-
}, arguments); },
|
|
644
641
|
__wbg_resolve_020f95d838c6ef25: function(arg0) {
|
|
645
642
|
const ret = Promise.resolve(getObject(arg0));
|
|
646
643
|
return addHeapObject(ret);
|
|
@@ -719,8 +716,8 @@ function __wbg_get_imports() {
|
|
|
719
716
|
return ret;
|
|
720
717
|
},
|
|
721
718
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
722
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
723
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
719
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 290, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
720
|
+
const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_4562);
|
|
724
721
|
return addHeapObject(ret);
|
|
725
722
|
},
|
|
726
723
|
__wbindgen_cast_0000000000000002: function(arg0) {
|
|
@@ -752,10 +749,10 @@ function __wbg_get_imports() {
|
|
|
752
749
|
};
|
|
753
750
|
}
|
|
754
751
|
|
|
755
|
-
function
|
|
752
|
+
function __wasm_bindgen_func_elem_4562(arg0, arg1, arg2) {
|
|
756
753
|
try {
|
|
757
754
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
758
|
-
wasm.
|
|
755
|
+
wasm.__wasm_bindgen_func_elem_4562(retptr, arg0, arg1, addHeapObject(arg2));
|
|
759
756
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
760
757
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
761
758
|
if (r1) {
|
|
@@ -766,8 +763,8 @@ function __wasm_bindgen_func_elem_4214(arg0, arg1, arg2) {
|
|
|
766
763
|
}
|
|
767
764
|
}
|
|
768
765
|
|
|
769
|
-
function
|
|
770
|
-
wasm.
|
|
766
|
+
function __wasm_bindgen_func_elem_4621(arg0, arg1, arg2, arg3) {
|
|
767
|
+
wasm.__wasm_bindgen_func_elem_4621(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
771
768
|
}
|
|
772
769
|
|
|
773
770
|
const PlotHandleFinalization = (typeof FinalizationRegistry === 'undefined')
|
package/hephaestus_wasm_bg.wasm
CHANGED
|
Binary file
|