@mocanvas/wasm 1.0.0 → 3.1.1

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/pkg/mocanvas.d.ts CHANGED
@@ -147,6 +147,22 @@ export class Engine {
147
147
  * Number of shapes in the scene.
148
148
  */
149
149
  shape_count(): number;
150
+ /**
151
+ * The outline a `dash: "draw"` shape is actually drawn with, as path words
152
+ * → `f32_ptr()`. Returns the word count, or `0` when the shape is missing
153
+ * or is not drawn in that style.
154
+ *
155
+ * The hand-drawn style does not stroke the shape's geometry; it strokes a
156
+ * perturbed, corner-rounded sketch of it, built here and never shared. So
157
+ * anything on the host side that wants to trace what the user can *see* —
158
+ * a selection outline, above all — had only the mathematical outline to go
159
+ * on and disagreed with the drawing at every corner.
160
+ *
161
+ * It is the same call the renderer makes, from the same path, style and
162
+ * seed, so the words that come back describe the very curve on screen and
163
+ * not a second guess at it.
164
+ */
165
+ sketch_path(handle: number): number;
150
166
  /**
151
167
  * Take the last error message, if any.
152
168
  */
@@ -209,6 +225,7 @@ export interface InitOutput {
209
225
  readonly engine_query_box: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
210
226
  readonly engine_set_viewport_pad: (a: number, b: number) => void;
211
227
  readonly engine_shape_count: (a: number) => number;
228
+ readonly engine_sketch_path: (a: number, b: number) => number;
212
229
  readonly engine_take_error: (a: number) => [number, number];
213
230
  readonly engine_union_bounds: (a: number, b: number) => number;
214
231
  readonly engine_vertices_len: (a: number) => number;
package/pkg/mocanvas.js CHANGED
@@ -289,6 +289,27 @@ export class Engine {
289
289
  const ret = wasm.engine_shape_count(this.__wbg_ptr);
290
290
  return ret >>> 0;
291
291
  }
292
+ /**
293
+ * The outline a `dash: "draw"` shape is actually drawn with, as path words
294
+ * → `f32_ptr()`. Returns the word count, or `0` when the shape is missing
295
+ * or is not drawn in that style.
296
+ *
297
+ * The hand-drawn style does not stroke the shape's geometry; it strokes a
298
+ * perturbed, corner-rounded sketch of it, built here and never shared. So
299
+ * anything on the host side that wants to trace what the user can *see* —
300
+ * a selection outline, above all — had only the mathematical outline to go
301
+ * on and disagreed with the drawing at every corner.
302
+ *
303
+ * It is the same call the renderer makes, from the same path, style and
304
+ * seed, so the words that come back describe the very curve on screen and
305
+ * not a second guess at it.
306
+ * @param {number} handle
307
+ * @returns {number}
308
+ */
309
+ sketch_path(handle) {
310
+ const ret = wasm.engine_sketch_path(this.__wbg_ptr, handle);
311
+ return ret >>> 0;
312
+ }
292
313
  /**
293
314
  * Take the last error message, if any.
294
315
  * @returns {string | undefined}
Binary file
@@ -31,6 +31,7 @@ export const engine_page_transform: (a: number, b: number) => number;
31
31
  export const engine_query_box: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
32
32
  export const engine_set_viewport_pad: (a: number, b: number) => void;
33
33
  export const engine_shape_count: (a: number) => number;
34
+ export const engine_sketch_path: (a: number, b: number) => number;
34
35
  export const engine_take_error: (a: number) => [number, number];
35
36
  export const engine_union_bounds: (a: number, b: number) => number;
36
37
  export const engine_vertices_len: (a: number) => number;