@open-artifact/wasm-wb-geom 0.0.0-stage → 0.2.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/LICENSE +202 -0
- package/NOTICE +5 -0
- package/README.md +5 -2
- package/generated/bytes.d.ts +3 -0
- package/generated/bytes.js +2 -0
- package/generated/open_artifact_wb_geom.d.ts +569 -0
- package/generated/open_artifact_wb_geom.js +2166 -0
- package/package.json +34 -4
- package/src/index.d.ts +9 -0
- package/src/index.js +23 -0
|
@@ -0,0 +1,2166 @@
|
|
|
1
|
+
// Generated by scripts/build-wasm.mjs from crates/open-artifact-wb-geom. Do not edit.
|
|
2
|
+
/**
|
|
3
|
+
* A board for arrow layout, kept on the WebAssembly side so planning and
|
|
4
|
+
* geometry calls do not resend it. Its plans are computed once.
|
|
5
|
+
*/
|
|
6
|
+
export class GeomBoard {
|
|
7
|
+
__destroy_into_raw() {
|
|
8
|
+
const ptr = this.__wbg_ptr;
|
|
9
|
+
this.__wbg_ptr = 0;
|
|
10
|
+
GeomBoardFinalization.unregister(this);
|
|
11
|
+
return ptr;
|
|
12
|
+
}
|
|
13
|
+
free() {
|
|
14
|
+
const ptr = this.__destroy_into_raw();
|
|
15
|
+
wasm.__wbg_geomboard_free(ptr, 0);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The geometry of every arrow, concatenated in arrow order.
|
|
19
|
+
* @returns {Float64Array}
|
|
20
|
+
*/
|
|
21
|
+
geometries() {
|
|
22
|
+
const ret = wasm.geomboard_geometries(this.__wbg_ptr);
|
|
23
|
+
var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
24
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
25
|
+
return v1;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The geometry of an arrow record with a given plan.
|
|
29
|
+
* @param {Float64Array} arrow
|
|
30
|
+
* @param {Float64Array} bends
|
|
31
|
+
* @param {number} exit_from
|
|
32
|
+
* @param {number} exit_to
|
|
33
|
+
* @param {number} stagger
|
|
34
|
+
* @returns {Float64Array}
|
|
35
|
+
*/
|
|
36
|
+
geometry(arrow, bends, exit_from, exit_to, stagger) {
|
|
37
|
+
const ptr0 = passArrayF64ToWasm0(arrow, wasm.__wbindgen_malloc);
|
|
38
|
+
const len0 = WASM_VECTOR_LEN;
|
|
39
|
+
const ptr1 = passArrayF64ToWasm0(bends, wasm.__wbindgen_malloc);
|
|
40
|
+
const len1 = WASM_VECTOR_LEN;
|
|
41
|
+
const ret = wasm.geomboard_geometry(this.__wbg_ptr, ptr0, len0, ptr1, len1, exit_from, exit_to, stagger);
|
|
42
|
+
var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
43
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
44
|
+
return v3;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* `insetArrowEndsToOutline` for an arrow record's ends.
|
|
48
|
+
* @param {Float64Array} pts
|
|
49
|
+
* @param {Float64Array} arrow
|
|
50
|
+
* @param {Float64Array} bends
|
|
51
|
+
* @param {number} side_from
|
|
52
|
+
* @param {number} side_to
|
|
53
|
+
* @param {number} exit_from
|
|
54
|
+
* @param {number} exit_to
|
|
55
|
+
* @returns {Float64Array}
|
|
56
|
+
*/
|
|
57
|
+
inset_ends(pts, arrow, bends, side_from, side_to, exit_from, exit_to) {
|
|
58
|
+
const ptr0 = passArrayF64ToWasm0(pts, wasm.__wbindgen_malloc);
|
|
59
|
+
const len0 = WASM_VECTOR_LEN;
|
|
60
|
+
const ptr1 = passArrayF64ToWasm0(arrow, wasm.__wbindgen_malloc);
|
|
61
|
+
const len1 = WASM_VECTOR_LEN;
|
|
62
|
+
const ptr2 = passArrayF64ToWasm0(bends, wasm.__wbindgen_malloc);
|
|
63
|
+
const len2 = WASM_VECTOR_LEN;
|
|
64
|
+
const ret = wasm.geomboard_inset_ends(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, side_from, side_to, exit_from, exit_to);
|
|
65
|
+
var v4 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
66
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
67
|
+
return v4;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* @param {Float64Array} elems
|
|
71
|
+
* @param {Float64Array} arrows
|
|
72
|
+
* @param {Float64Array} bends
|
|
73
|
+
*/
|
|
74
|
+
constructor(elems, arrows, bends) {
|
|
75
|
+
const ptr0 = passArrayF64ToWasm0(elems, wasm.__wbindgen_malloc);
|
|
76
|
+
const len0 = WASM_VECTOR_LEN;
|
|
77
|
+
const ptr1 = passArrayF64ToWasm0(arrows, wasm.__wbindgen_malloc);
|
|
78
|
+
const len1 = WASM_VECTOR_LEN;
|
|
79
|
+
const ptr2 = passArrayF64ToWasm0(bends, wasm.__wbindgen_malloc);
|
|
80
|
+
const len2 = WASM_VECTOR_LEN;
|
|
81
|
+
const ret = wasm.geomboard_new(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
82
|
+
this.__wbg_ptr = ret >>> 0;
|
|
83
|
+
GeomBoardFinalization.register(this, this.__wbg_ptr, this);
|
|
84
|
+
return this;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Per arrow: planned (0/1), exit from, exit to, stagger.
|
|
88
|
+
* @returns {Float64Array}
|
|
89
|
+
*/
|
|
90
|
+
plans() {
|
|
91
|
+
const ret = wasm.geomboard_plans(this.__wbg_ptr);
|
|
92
|
+
var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
93
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
94
|
+
return v1;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Sets an element's layout box (boxes are sent only for the elements
|
|
98
|
+
* arrow ends name; a draft arrow may name another one).
|
|
99
|
+
* @param {number} index
|
|
100
|
+
* @param {boolean} has_box
|
|
101
|
+
* @param {number} x
|
|
102
|
+
* @param {number} y
|
|
103
|
+
* @param {number} w
|
|
104
|
+
* @param {number} h
|
|
105
|
+
*/
|
|
106
|
+
set_layout(index, has_box, x, y, w, h) {
|
|
107
|
+
wasm.geomboard_set_layout(this.__wbg_ptr, index, has_box, x, y, w, h);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
if (Symbol.dispose) GeomBoard.prototype[Symbol.dispose] = GeomBoard.prototype.free;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* The occupancy index (`createOccupancyIndex`), held across calls.
|
|
114
|
+
*/
|
|
115
|
+
export class OccupancyGrid {
|
|
116
|
+
__destroy_into_raw() {
|
|
117
|
+
const ptr = this.__wbg_ptr;
|
|
118
|
+
this.__wbg_ptr = 0;
|
|
119
|
+
OccupancyGridFinalization.unregister(this);
|
|
120
|
+
return ptr;
|
|
121
|
+
}
|
|
122
|
+
free() {
|
|
123
|
+
const ptr = this.__destroy_into_raw();
|
|
124
|
+
wasm.__wbg_occupancygrid_free(ptr, 0);
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* @param {number} x
|
|
128
|
+
* @param {number} y
|
|
129
|
+
* @param {number} w
|
|
130
|
+
* @param {number} h
|
|
131
|
+
*/
|
|
132
|
+
add(x, y, w, h) {
|
|
133
|
+
wasm.occupancygrid_add(this.__wbg_ptr, x, y, w, h);
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* @returns {number}
|
|
137
|
+
*/
|
|
138
|
+
checks() {
|
|
139
|
+
const ret = wasm.occupancygrid_checks(this.__wbg_ptr);
|
|
140
|
+
return ret;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* @returns {number}
|
|
144
|
+
*/
|
|
145
|
+
entries() {
|
|
146
|
+
const ret = wasm.occupancygrid_entries(this.__wbg_ptr);
|
|
147
|
+
return ret;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* @param {number} x
|
|
151
|
+
* @param {number} y
|
|
152
|
+
* @param {number} w
|
|
153
|
+
* @param {number} h
|
|
154
|
+
* @param {number} margin
|
|
155
|
+
* @returns {boolean}
|
|
156
|
+
*/
|
|
157
|
+
hits(x, y, w, h, margin) {
|
|
158
|
+
const ret = wasm.occupancygrid_hits(this.__wbg_ptr, x, y, w, h, margin);
|
|
159
|
+
return ret !== 0;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* @returns {number}
|
|
163
|
+
*/
|
|
164
|
+
looked() {
|
|
165
|
+
const ret = wasm.occupancygrid_looked(this.__wbg_ptr);
|
|
166
|
+
return ret;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* An index over `[x, y, w, h]*`, added in order.
|
|
170
|
+
* @param {Float64Array} rects_flat
|
|
171
|
+
*/
|
|
172
|
+
constructor(rects_flat) {
|
|
173
|
+
const ptr0 = passArrayF64ToWasm0(rects_flat, wasm.__wbindgen_malloc);
|
|
174
|
+
const len0 = WASM_VECTOR_LEN;
|
|
175
|
+
const ret = wasm.occupancygrid_new(ptr0, len0);
|
|
176
|
+
this.__wbg_ptr = ret >>> 0;
|
|
177
|
+
OccupancyGridFinalization.register(this, this.__wbg_ptr, this);
|
|
178
|
+
return this;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
if (Symbol.dispose) OccupancyGrid.prototype[Symbol.dispose] = OccupancyGrid.prototype.free;
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* `side`: 0–3 a side, 255 none, anything else a value that is not a side.
|
|
185
|
+
* @param {number} from_x
|
|
186
|
+
* @param {number} from_y
|
|
187
|
+
* @param {number} side
|
|
188
|
+
* @param {number} x
|
|
189
|
+
* @param {number} y
|
|
190
|
+
* @param {number} snap_px
|
|
191
|
+
* @returns {Float64Array}
|
|
192
|
+
*/
|
|
193
|
+
export function align_arrow_end_point(from_x, from_y, side, x, y, snap_px) {
|
|
194
|
+
const ret = wasm.align_arrow_end_point(from_x, from_y, side, x, y, snap_px);
|
|
195
|
+
var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
196
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
197
|
+
return v1;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* @param {Float64Array} pts
|
|
202
|
+
* @returns {Float64Array}
|
|
203
|
+
*/
|
|
204
|
+
export function align_nearby_route_points(pts) {
|
|
205
|
+
const ptr0 = passArrayF64ToWasm0(pts, wasm.__wbindgen_malloc);
|
|
206
|
+
const len0 = WASM_VECTOR_LEN;
|
|
207
|
+
const ret = wasm.align_nearby_route_points(ptr0, len0);
|
|
208
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
209
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
210
|
+
return v2;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* @param {number} tip_x
|
|
215
|
+
* @param {number} tip_y
|
|
216
|
+
* @param {number} from_x
|
|
217
|
+
* @param {number} from_y
|
|
218
|
+
* @returns {Float64Array}
|
|
219
|
+
*/
|
|
220
|
+
export function arrow_circle_center(tip_x, tip_y, from_x, from_y) {
|
|
221
|
+
const ret = wasm.arrow_circle_center(tip_x, tip_y, from_x, from_y);
|
|
222
|
+
var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
223
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
224
|
+
return v1;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* @param {number} kind
|
|
229
|
+
* @param {number} tip_x
|
|
230
|
+
* @param {number} tip_y
|
|
231
|
+
* @param {number} from_x
|
|
232
|
+
* @param {number} from_y
|
|
233
|
+
* @returns {Float64Array}
|
|
234
|
+
*/
|
|
235
|
+
export function arrow_end_cap_points(kind, tip_x, tip_y, from_x, from_y) {
|
|
236
|
+
const ret = wasm.arrow_end_cap_points(kind, tip_x, tip_y, from_x, from_y);
|
|
237
|
+
var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
238
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
239
|
+
return v1;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* @param {Float64Array} route
|
|
244
|
+
* @param {Float64Array} auto
|
|
245
|
+
* @param {boolean} head_from
|
|
246
|
+
* @param {boolean} head_to
|
|
247
|
+
* @returns {Float64Array}
|
|
248
|
+
*/
|
|
249
|
+
export function arrow_end_clearances(route, auto, head_from, head_to) {
|
|
250
|
+
const ptr0 = passArrayF64ToWasm0(route, wasm.__wbindgen_malloc);
|
|
251
|
+
const len0 = WASM_VECTOR_LEN;
|
|
252
|
+
const ptr1 = passArrayF64ToWasm0(auto, wasm.__wbindgen_malloc);
|
|
253
|
+
const len1 = WASM_VECTOR_LEN;
|
|
254
|
+
const ret = wasm.arrow_end_clearances(ptr0, len0, ptr1, len1, head_from, head_to);
|
|
255
|
+
var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
256
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
257
|
+
return v3;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* @param {Float64Array} element
|
|
262
|
+
* @param {Float64Array} bounds
|
|
263
|
+
* @param {number} x
|
|
264
|
+
* @param {number} y
|
|
265
|
+
* @param {number} reach
|
|
266
|
+
* @returns {number}
|
|
267
|
+
*/
|
|
268
|
+
export function arrow_end_distance_to_element(element, bounds, x, y, reach) {
|
|
269
|
+
const ptr0 = passArrayF64ToWasm0(element, wasm.__wbindgen_malloc);
|
|
270
|
+
const len0 = WASM_VECTOR_LEN;
|
|
271
|
+
const ptr1 = passArrayF64ToWasm0(bounds, wasm.__wbindgen_malloc);
|
|
272
|
+
const len1 = WASM_VECTOR_LEN;
|
|
273
|
+
const ret = wasm.arrow_end_distance_to_element(ptr0, len0, ptr1, len1, x, y, reach);
|
|
274
|
+
return ret;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* `arrowEndSideUses`. `route` is empty or `[side from, side to, flat, …points]`.
|
|
279
|
+
* Out: side from, side to, flat, then per end: has use, order, way, depth, far.
|
|
280
|
+
* @param {Float64Array} arrow
|
|
281
|
+
* @param {Float64Array} bends
|
|
282
|
+
* @param {number} spacing
|
|
283
|
+
* @param {Float64Array} ends
|
|
284
|
+
* @param {Float64Array} route
|
|
285
|
+
* @returns {Float64Array}
|
|
286
|
+
*/
|
|
287
|
+
export function arrow_end_side_uses(arrow, bends, spacing, ends, route) {
|
|
288
|
+
const ptr0 = passArrayF64ToWasm0(arrow, wasm.__wbindgen_malloc);
|
|
289
|
+
const len0 = WASM_VECTOR_LEN;
|
|
290
|
+
const ptr1 = passArrayF64ToWasm0(bends, wasm.__wbindgen_malloc);
|
|
291
|
+
const len1 = WASM_VECTOR_LEN;
|
|
292
|
+
const ptr2 = passArrayF64ToWasm0(ends, wasm.__wbindgen_malloc);
|
|
293
|
+
const len2 = WASM_VECTOR_LEN;
|
|
294
|
+
const ptr3 = passArrayF64ToWasm0(route, wasm.__wbindgen_malloc);
|
|
295
|
+
const len3 = WASM_VECTOR_LEN;
|
|
296
|
+
const ret = wasm.arrow_end_side_uses(ptr0, len0, ptr1, len1, spacing, ptr2, len2, ptr3, len3);
|
|
297
|
+
var v5 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
298
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
299
|
+
return v5;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* @param {number} tip_x
|
|
304
|
+
* @param {number} tip_y
|
|
305
|
+
* @param {number} from_x
|
|
306
|
+
* @param {number} from_y
|
|
307
|
+
* @returns {Float64Array}
|
|
308
|
+
*/
|
|
309
|
+
export function arrow_head_points(tip_x, tip_y, from_x, from_y) {
|
|
310
|
+
const ret = wasm.arrow_head_points(tip_x, tip_y, from_x, from_y);
|
|
311
|
+
var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
312
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
313
|
+
return v1;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* @param {Float64Array} recs
|
|
318
|
+
* @param {number} index
|
|
319
|
+
* @param {number} x
|
|
320
|
+
* @param {number} y
|
|
321
|
+
* @param {number} tolerance
|
|
322
|
+
* @returns {number}
|
|
323
|
+
*/
|
|
324
|
+
export function arrow_label_beneath(recs, index, x, y, tolerance) {
|
|
325
|
+
const ptr0 = passArrayF64ToWasm0(recs, wasm.__wbindgen_malloc);
|
|
326
|
+
const len0 = WASM_VECTOR_LEN;
|
|
327
|
+
const ret = wasm.arrow_label_beneath(ptr0, len0, index, x, y, tolerance);
|
|
328
|
+
return ret;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* `label`: `[has, onLine, x, y, w, h]`; `line`: `[x1, y1, x2, y2, bent]`.
|
|
333
|
+
* Handles as `[leg, x, y, level]`.
|
|
334
|
+
* @param {Float64Array} elbow
|
|
335
|
+
* @param {boolean} attached_from
|
|
336
|
+
* @param {boolean} attached_to
|
|
337
|
+
* @param {number} clear_from
|
|
338
|
+
* @param {number} clear_to
|
|
339
|
+
* @param {Float64Array} label
|
|
340
|
+
* @param {number} reach
|
|
341
|
+
* @param {number} zoom
|
|
342
|
+
* @param {Float64Array} line
|
|
343
|
+
* @returns {Float64Array}
|
|
344
|
+
*/
|
|
345
|
+
export function arrow_leg_handles(elbow, attached_from, attached_to, clear_from, clear_to, label, reach, zoom, line) {
|
|
346
|
+
const ptr0 = passArrayF64ToWasm0(elbow, wasm.__wbindgen_malloc);
|
|
347
|
+
const len0 = WASM_VECTOR_LEN;
|
|
348
|
+
const ptr1 = passArrayF64ToWasm0(label, wasm.__wbindgen_malloc);
|
|
349
|
+
const len1 = WASM_VECTOR_LEN;
|
|
350
|
+
const ptr2 = passArrayF64ToWasm0(line, wasm.__wbindgen_malloc);
|
|
351
|
+
const len2 = WASM_VECTOR_LEN;
|
|
352
|
+
const ret = wasm.arrow_leg_handles(ptr0, len0, attached_from, attached_to, clear_from, clear_to, ptr1, len1, reach, zoom, ptr2, len2);
|
|
353
|
+
var v4 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
354
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
355
|
+
return v4;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* @param {Float64Array} coords
|
|
360
|
+
* @returns {Float64Array}
|
|
361
|
+
*/
|
|
362
|
+
export function arrow_line_bounds(coords) {
|
|
363
|
+
const ptr0 = passArrayF64ToWasm0(coords, wasm.__wbindgen_malloc);
|
|
364
|
+
const len0 = WASM_VECTOR_LEN;
|
|
365
|
+
const ret = wasm.arrow_line_bounds(ptr0, len0);
|
|
366
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
367
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
368
|
+
return v2;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* `outlineHitFraction` of an element record: empty for `undefined`.
|
|
373
|
+
* @param {Float64Array} element
|
|
374
|
+
* @param {number} sx
|
|
375
|
+
* @param {number} sy
|
|
376
|
+
* @param {number} ex
|
|
377
|
+
* @param {number} ey
|
|
378
|
+
* @returns {Float64Array}
|
|
379
|
+
*/
|
|
380
|
+
export function arrow_outline_hit_fraction(element, sx, sy, ex, ey) {
|
|
381
|
+
const ptr0 = passArrayF64ToWasm0(element, wasm.__wbindgen_malloc);
|
|
382
|
+
const len0 = WASM_VECTOR_LEN;
|
|
383
|
+
const ret = wasm.arrow_outline_hit_fraction(ptr0, len0, sx, sy, ex, ey);
|
|
384
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
385
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
386
|
+
return v2;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* @param {Float64Array} elbow
|
|
391
|
+
* @param {boolean} head_from
|
|
392
|
+
* @param {boolean} head_to
|
|
393
|
+
* @returns {Float64Array}
|
|
394
|
+
*/
|
|
395
|
+
export function arrow_polyline(elbow, head_from, head_to) {
|
|
396
|
+
const ptr0 = passArrayF64ToWasm0(elbow, wasm.__wbindgen_malloc);
|
|
397
|
+
const len0 = WASM_VECTOR_LEN;
|
|
398
|
+
const ret = wasm.arrow_polyline(ptr0, len0, head_from, head_to);
|
|
399
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
400
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
401
|
+
return v2;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* @param {Float64Array} element
|
|
406
|
+
* @param {number} side
|
|
407
|
+
* @param {number} at
|
|
408
|
+
* @returns {number}
|
|
409
|
+
*/
|
|
410
|
+
export function arrow_rotated_outline_inset(element, side, at) {
|
|
411
|
+
const ptr0 = passArrayF64ToWasm0(element, wasm.__wbindgen_malloc);
|
|
412
|
+
const len0 = WASM_VECTOR_LEN;
|
|
413
|
+
const ret = wasm.arrow_rotated_outline_inset(ptr0, len0, side, at);
|
|
414
|
+
return ret;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
/**
|
|
418
|
+
* `routeElbowArrow`: empty, or `[side from, side to, exit from, exit to, flags, …points]`;
|
|
419
|
+
* flags: 1 bent, 2 flat, 4 z, 8 the exits are the spread's (else none).
|
|
420
|
+
* @param {Float64Array} arrow
|
|
421
|
+
* @param {Float64Array} bends
|
|
422
|
+
* @param {Float64Array} ends
|
|
423
|
+
* @param {number} exit_from
|
|
424
|
+
* @param {number} exit_to
|
|
425
|
+
* @param {number} stagger
|
|
426
|
+
* @param {boolean} turns
|
|
427
|
+
* @returns {Float64Array}
|
|
428
|
+
*/
|
|
429
|
+
export function arrow_route_elbow(arrow, bends, ends, exit_from, exit_to, stagger, turns) {
|
|
430
|
+
const ptr0 = passArrayF64ToWasm0(arrow, wasm.__wbindgen_malloc);
|
|
431
|
+
const len0 = WASM_VECTOR_LEN;
|
|
432
|
+
const ptr1 = passArrayF64ToWasm0(bends, wasm.__wbindgen_malloc);
|
|
433
|
+
const len1 = WASM_VECTOR_LEN;
|
|
434
|
+
const ptr2 = passArrayF64ToWasm0(ends, wasm.__wbindgen_malloc);
|
|
435
|
+
const len2 = WASM_VECTOR_LEN;
|
|
436
|
+
const ret = wasm.arrow_route_elbow(ptr0, len0, ptr1, len1, ptr2, len2, exit_from, exit_to, stagger, turns);
|
|
437
|
+
var v4 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
438
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
439
|
+
return v4;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* `shapeOutlineSegments`, 4 numbers per segment.
|
|
444
|
+
* @param {number} kind
|
|
445
|
+
* @param {number} w
|
|
446
|
+
* @param {number} h
|
|
447
|
+
* @returns {Float64Array}
|
|
448
|
+
*/
|
|
449
|
+
export function arrow_shape_outline_segments(kind, w, h) {
|
|
450
|
+
const ret = wasm.arrow_shape_outline_segments(kind, w, h);
|
|
451
|
+
var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
452
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
453
|
+
return v1;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
/**
|
|
457
|
+
* `spreadArrowEndOffsets` (only each use's `way` matters).
|
|
458
|
+
* @param {Float64Array} ways
|
|
459
|
+
* @param {number} side_length
|
|
460
|
+
* @returns {Float64Array}
|
|
461
|
+
*/
|
|
462
|
+
export function arrow_spread_end_offsets(ways, side_length) {
|
|
463
|
+
const ptr0 = passArrayF64ToWasm0(ways, wasm.__wbindgen_malloc);
|
|
464
|
+
const len0 = WASM_VECTOR_LEN;
|
|
465
|
+
const ret = wasm.arrow_spread_end_offsets(ptr0, len0, side_length);
|
|
466
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
467
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
468
|
+
return v2;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
/**
|
|
472
|
+
* `staggerParallelArrows` from each arrow's `[place, has Z, start x, y, corner x, y, end x, y]`;
|
|
473
|
+
* out: `[arrow index, stagger]` pairs in the order they are set.
|
|
474
|
+
* @param {Float64Array} legs
|
|
475
|
+
* @returns {Float64Array}
|
|
476
|
+
*/
|
|
477
|
+
export function arrow_stagger_parallel(legs) {
|
|
478
|
+
const ptr0 = passArrayF64ToWasm0(legs, wasm.__wbindgen_malloc);
|
|
479
|
+
const len0 = WASM_VECTOR_LEN;
|
|
480
|
+
const ret = wasm.arrow_stagger_parallel(ptr0, len0);
|
|
481
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
482
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
483
|
+
return v2;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
/**
|
|
487
|
+
* `straightenFacingArrowExits` up to the `canUseExit` checks: `[0]` keep the
|
|
488
|
+
* exits, or `[1, a0, a1, b0, b1]` candidates to try in order.
|
|
489
|
+
* @param {Float64Array} arrow
|
|
490
|
+
* @param {Float64Array} bends
|
|
491
|
+
* @param {number} exit_from
|
|
492
|
+
* @param {number} exit_to
|
|
493
|
+
* @param {number} prefer_end
|
|
494
|
+
* @param {number} side_from
|
|
495
|
+
* @param {number} side_to
|
|
496
|
+
* @param {Float64Array} ends
|
|
497
|
+
* @returns {Float64Array}
|
|
498
|
+
*/
|
|
499
|
+
export function arrow_straighten_candidates(arrow, bends, exit_from, exit_to, prefer_end, side_from, side_to, ends) {
|
|
500
|
+
const ptr0 = passArrayF64ToWasm0(arrow, wasm.__wbindgen_malloc);
|
|
501
|
+
const len0 = WASM_VECTOR_LEN;
|
|
502
|
+
const ptr1 = passArrayF64ToWasm0(bends, wasm.__wbindgen_malloc);
|
|
503
|
+
const len1 = WASM_VECTOR_LEN;
|
|
504
|
+
const ptr2 = passArrayF64ToWasm0(ends, wasm.__wbindgen_malloc);
|
|
505
|
+
const len2 = WASM_VECTOR_LEN;
|
|
506
|
+
const ret = wasm.arrow_straighten_candidates(ptr0, len0, ptr1, len1, exit_from, exit_to, prefer_end, side_from, side_to, ptr2, len2);
|
|
507
|
+
var v4 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
508
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
509
|
+
return v4;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
/**
|
|
513
|
+
* Empty for a single leg, else `[first, …at]`.
|
|
514
|
+
* @param {Float64Array} pts
|
|
515
|
+
* @returns {Float64Array}
|
|
516
|
+
*/
|
|
517
|
+
export function bends_from_route(pts) {
|
|
518
|
+
const ptr0 = passArrayF64ToWasm0(pts, wasm.__wbindgen_malloc);
|
|
519
|
+
const len0 = WASM_VECTOR_LEN;
|
|
520
|
+
const ret = wasm.bends_from_route(ptr0, len0);
|
|
521
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
522
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
523
|
+
return v2;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
/**
|
|
527
|
+
* Empty: undefined; `[0]` straight; `[1, problem]`; `[2, first, …at]`.
|
|
528
|
+
* @param {Float64Array} two_boxes
|
|
529
|
+
* @param {number} from_side
|
|
530
|
+
* @param {number} to_side
|
|
531
|
+
* @param {Float64Array} pts
|
|
532
|
+
* @param {number} max_bends
|
|
533
|
+
* @param {number} tolerance
|
|
534
|
+
* @returns {Float64Array}
|
|
535
|
+
*/
|
|
536
|
+
export function bends_through_points(two_boxes, from_side, to_side, pts, max_bends, tolerance) {
|
|
537
|
+
const ptr0 = passArrayF64ToWasm0(two_boxes, wasm.__wbindgen_malloc);
|
|
538
|
+
const len0 = WASM_VECTOR_LEN;
|
|
539
|
+
const ptr1 = passArrayF64ToWasm0(pts, wasm.__wbindgen_malloc);
|
|
540
|
+
const len1 = WASM_VECTOR_LEN;
|
|
541
|
+
const ret = wasm.bends_through_points(ptr0, len0, from_side, to_side, ptr1, len1, max_bends, tolerance);
|
|
542
|
+
var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
543
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
544
|
+
return v3;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
/**
|
|
548
|
+
* @param {Float64Array} two_boxes
|
|
549
|
+
* @returns {boolean}
|
|
550
|
+
*/
|
|
551
|
+
export function boxes_overlap(two_boxes) {
|
|
552
|
+
const ptr0 = passArrayF64ToWasm0(two_boxes, wasm.__wbindgen_malloc);
|
|
553
|
+
const len0 = WASM_VECTOR_LEN;
|
|
554
|
+
const ret = wasm.boxes_overlap(ptr0, len0);
|
|
555
|
+
return ret !== 0;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
/**
|
|
559
|
+
* `[-1, …points]`, or `[problem]`.
|
|
560
|
+
* @param {Float64Array} two_boxes
|
|
561
|
+
* @param {number} from_side
|
|
562
|
+
* @param {number} to_side
|
|
563
|
+
* @param {number} first_axis
|
|
564
|
+
* @param {Float64Array} bends
|
|
565
|
+
* @param {number} extra_clearance
|
|
566
|
+
* @param {number} offset_from
|
|
567
|
+
* @param {number} offset_to
|
|
568
|
+
* @returns {Float64Array}
|
|
569
|
+
*/
|
|
570
|
+
export function build_route_from_bends(two_boxes, from_side, to_side, first_axis, bends, extra_clearance, offset_from, offset_to) {
|
|
571
|
+
const ptr0 = passArrayF64ToWasm0(two_boxes, wasm.__wbindgen_malloc);
|
|
572
|
+
const len0 = WASM_VECTOR_LEN;
|
|
573
|
+
const ptr1 = passArrayF64ToWasm0(bends, wasm.__wbindgen_malloc);
|
|
574
|
+
const len1 = WASM_VECTOR_LEN;
|
|
575
|
+
const ret = wasm.build_route_from_bends(ptr0, len0, from_side, to_side, first_axis, ptr1, len1, extra_clearance, offset_from, offset_to);
|
|
576
|
+
var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
577
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
578
|
+
return v3;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
/**
|
|
582
|
+
* @param {Float64Array} b
|
|
583
|
+
* @param {number} view_w
|
|
584
|
+
* @param {number} view_h
|
|
585
|
+
* @param {number} padding
|
|
586
|
+
* @param {number} max_zoom
|
|
587
|
+
* @returns {Float64Array}
|
|
588
|
+
*/
|
|
589
|
+
export function camera_to_fit_box(b, view_w, view_h, padding, max_zoom) {
|
|
590
|
+
const ptr0 = passArrayF64ToWasm0(b, wasm.__wbindgen_malloc);
|
|
591
|
+
const len0 = WASM_VECTOR_LEN;
|
|
592
|
+
const ret = wasm.camera_to_fit_box(ptr0, len0, view_w, view_h, padding, max_zoom);
|
|
593
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
594
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
595
|
+
return v2;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
/**
|
|
599
|
+
* @param {Float64Array} pts
|
|
600
|
+
* @param {number} index
|
|
601
|
+
* @param {boolean} attached_from
|
|
602
|
+
* @param {boolean} attached_to
|
|
603
|
+
* @param {number} stub_from
|
|
604
|
+
* @param {number} stub_to
|
|
605
|
+
* @returns {boolean}
|
|
606
|
+
*/
|
|
607
|
+
export function can_move_route_segment(pts, index, attached_from, attached_to, stub_from, stub_to) {
|
|
608
|
+
const ptr0 = passArrayF64ToWasm0(pts, wasm.__wbindgen_malloc);
|
|
609
|
+
const len0 = WASM_VECTOR_LEN;
|
|
610
|
+
const ret = wasm.can_move_route_segment(ptr0, len0, index, attached_from, attached_to, stub_from, stub_to);
|
|
611
|
+
return ret !== 0;
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
/**
|
|
615
|
+
* @param {number} zoom_value
|
|
616
|
+
* @param {Float64Array} b
|
|
617
|
+
* @param {number} view_w
|
|
618
|
+
* @param {number} view_h
|
|
619
|
+
* @param {number} inset_top
|
|
620
|
+
* @param {number} inset_bottom
|
|
621
|
+
* @returns {Float64Array}
|
|
622
|
+
*/
|
|
623
|
+
export function center_camera_on(zoom_value, b, view_w, view_h, inset_top, inset_bottom) {
|
|
624
|
+
const ptr0 = passArrayF64ToWasm0(b, wasm.__wbindgen_malloc);
|
|
625
|
+
const len0 = WASM_VECTOR_LEN;
|
|
626
|
+
const ret = wasm.center_camera_on(zoom_value, ptr0, len0, view_w, view_h, inset_top, inset_bottom);
|
|
627
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
628
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
629
|
+
return v2;
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
/**
|
|
633
|
+
* -1 when the route is valid, else the problem code.
|
|
634
|
+
* @param {Float64Array} pts
|
|
635
|
+
* @param {Float64Array} two_boxes
|
|
636
|
+
* @param {number} from_side
|
|
637
|
+
* @param {number} to_side
|
|
638
|
+
* @param {number} extra_clearance
|
|
639
|
+
* @returns {number}
|
|
640
|
+
*/
|
|
641
|
+
export function check_arrow_route(pts, two_boxes, from_side, to_side, extra_clearance) {
|
|
642
|
+
const ptr0 = passArrayF64ToWasm0(pts, wasm.__wbindgen_malloc);
|
|
643
|
+
const len0 = WASM_VECTOR_LEN;
|
|
644
|
+
const ptr1 = passArrayF64ToWasm0(two_boxes, wasm.__wbindgen_malloc);
|
|
645
|
+
const len1 = WASM_VECTOR_LEN;
|
|
646
|
+
const ret = wasm.check_arrow_route(ptr0, len0, ptr1, len1, from_side, to_side, extra_clearance);
|
|
647
|
+
return ret;
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
/**
|
|
651
|
+
* @param {number} z
|
|
652
|
+
* @returns {number}
|
|
653
|
+
*/
|
|
654
|
+
export function clamp_zoom(z) {
|
|
655
|
+
const ret = wasm.clamp_zoom(z);
|
|
656
|
+
return ret;
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
/**
|
|
660
|
+
* @param {Float64Array} pts
|
|
661
|
+
* @returns {string}
|
|
662
|
+
*/
|
|
663
|
+
export function closed_ink_loop_path(pts) {
|
|
664
|
+
let deferred2_0;
|
|
665
|
+
let deferred2_1;
|
|
666
|
+
try {
|
|
667
|
+
const ptr0 = passArrayF64ToWasm0(pts, wasm.__wbindgen_malloc);
|
|
668
|
+
const len0 = WASM_VECTOR_LEN;
|
|
669
|
+
const ret = wasm.closed_ink_loop_path(ptr0, len0);
|
|
670
|
+
deferred2_0 = ret[0];
|
|
671
|
+
deferred2_1 = ret[1];
|
|
672
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
673
|
+
} finally {
|
|
674
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
/**
|
|
679
|
+
* @param {number} scale
|
|
680
|
+
* @param {number} z
|
|
681
|
+
* @returns {number}
|
|
682
|
+
*/
|
|
683
|
+
export function container_title_band_height_at(scale, z) {
|
|
684
|
+
const ret = wasm.container_title_band_height_at(scale, z);
|
|
685
|
+
return ret;
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
/**
|
|
689
|
+
* `measured` is NaN when the title is not measured.
|
|
690
|
+
* @param {Float64Array} section
|
|
691
|
+
* @param {number} text_length
|
|
692
|
+
* @param {number} measured
|
|
693
|
+
* @param {number} scale
|
|
694
|
+
* @param {number} z
|
|
695
|
+
* @param {boolean} has_measured
|
|
696
|
+
* @returns {Float64Array}
|
|
697
|
+
*/
|
|
698
|
+
export function container_title_bounds(section, text_length, measured, scale, z, has_measured) {
|
|
699
|
+
const ptr0 = passArrayF64ToWasm0(section, wasm.__wbindgen_malloc);
|
|
700
|
+
const len0 = WASM_VECTOR_LEN;
|
|
701
|
+
const ret = wasm.container_title_bounds(ptr0, len0, text_length, measured, scale, z, has_measured);
|
|
702
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
703
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
704
|
+
return v2;
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
/**
|
|
708
|
+
* @param {number} band_height
|
|
709
|
+
* @returns {number}
|
|
710
|
+
*/
|
|
711
|
+
export function container_title_scale_for_band(band_height) {
|
|
712
|
+
const ret = wasm.container_title_scale_for_band(band_height);
|
|
713
|
+
return ret;
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
/**
|
|
717
|
+
* @param {number} z
|
|
718
|
+
* @param {number} max_scale
|
|
719
|
+
* @returns {number}
|
|
720
|
+
*/
|
|
721
|
+
export function container_title_scale_for_zoom(z, max_scale) {
|
|
722
|
+
const ret = wasm.container_title_scale_for_zoom(z, max_scale);
|
|
723
|
+
return ret;
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
/**
|
|
727
|
+
* @param {Float64Array} section
|
|
728
|
+
* @param {number} measured
|
|
729
|
+
* @param {number} scale
|
|
730
|
+
* @param {number} z
|
|
731
|
+
* @returns {Float64Array}
|
|
732
|
+
*/
|
|
733
|
+
export function container_title_text_bounds(section, measured, scale, z) {
|
|
734
|
+
const ptr0 = passArrayF64ToWasm0(section, wasm.__wbindgen_malloc);
|
|
735
|
+
const len0 = WASM_VECTOR_LEN;
|
|
736
|
+
const ret = wasm.container_title_text_bounds(ptr0, len0, measured, scale, z);
|
|
737
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
738
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
739
|
+
return v2;
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
/**
|
|
743
|
+
* @param {number} kind
|
|
744
|
+
* @param {number} width
|
|
745
|
+
* @param {number} height
|
|
746
|
+
* @param {number} side_code
|
|
747
|
+
* @param {number} line_offset
|
|
748
|
+
* @param {number} fallback
|
|
749
|
+
* @returns {number}
|
|
750
|
+
*/
|
|
751
|
+
export function curved_shape_edge_inset(kind, width, height, side_code, line_offset, fallback) {
|
|
752
|
+
const ret = wasm.curved_shape_edge_inset(kind, width, height, side_code, line_offset, fallback);
|
|
753
|
+
return ret;
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
/**
|
|
757
|
+
* Segments as `[x1, y1, x2, y2, …]`; empty for kinds that are not curved.
|
|
758
|
+
* @param {number} kind
|
|
759
|
+
* @param {number} width
|
|
760
|
+
* @param {number} height
|
|
761
|
+
* @returns {Float64Array}
|
|
762
|
+
*/
|
|
763
|
+
export function curved_shape_line_segments(kind, width, height) {
|
|
764
|
+
const ret = wasm.curved_shape_line_segments(kind, width, height);
|
|
765
|
+
var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
766
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
767
|
+
return v1;
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
/**
|
|
771
|
+
* @param {number} kind
|
|
772
|
+
* @param {number} width
|
|
773
|
+
* @param {number} height
|
|
774
|
+
* @returns {string | undefined}
|
|
775
|
+
*/
|
|
776
|
+
export function cylinder_cap_path_data(kind, width, height) {
|
|
777
|
+
const ret = wasm.cylinder_cap_path_data(kind, width, height);
|
|
778
|
+
let v1;
|
|
779
|
+
if (ret[0] !== 0) {
|
|
780
|
+
v1 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
781
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
782
|
+
}
|
|
783
|
+
return v1;
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
/**
|
|
787
|
+
* @param {number} px
|
|
788
|
+
* @param {number} py
|
|
789
|
+
* @param {number} x1
|
|
790
|
+
* @param {number} y1
|
|
791
|
+
* @param {number} x2
|
|
792
|
+
* @param {number} y2
|
|
793
|
+
* @returns {number}
|
|
794
|
+
*/
|
|
795
|
+
export function distance_to_segment_sq(px, py, x1, y1, x2, y2) {
|
|
796
|
+
const ret = wasm.distance_to_segment_sq(px, py, x1, y1, x2, y2);
|
|
797
|
+
return ret;
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
/**
|
|
801
|
+
* @param {Float64Array} pts
|
|
802
|
+
* @returns {Float64Array}
|
|
803
|
+
*/
|
|
804
|
+
export function drop_collinear_points(pts) {
|
|
805
|
+
const ptr0 = passArrayF64ToWasm0(pts, wasm.__wbindgen_malloc);
|
|
806
|
+
const len0 = WASM_VECTOR_LEN;
|
|
807
|
+
const ret = wasm.drop_collinear_points(ptr0, len0);
|
|
808
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
809
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
810
|
+
return v2;
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
/**
|
|
814
|
+
* `ends`: start.x, start.y, hasStartDir, startDir.x, startDir.y, end.x, end.y, hasEndDir, endDir.x, endDir.y.
|
|
815
|
+
* @param {Float64Array} ends
|
|
816
|
+
* @param {Float64Array} through
|
|
817
|
+
* @returns {Float64Array}
|
|
818
|
+
*/
|
|
819
|
+
export function elbow_path_through_points(ends, through) {
|
|
820
|
+
const ptr0 = passArrayF64ToWasm0(ends, wasm.__wbindgen_malloc);
|
|
821
|
+
const len0 = WASM_VECTOR_LEN;
|
|
822
|
+
const ptr1 = passArrayF64ToWasm0(through, wasm.__wbindgen_malloc);
|
|
823
|
+
const len1 = WASM_VECTOR_LEN;
|
|
824
|
+
const ret = wasm.elbow_path_through_points(ptr0, len0, ptr1, len1);
|
|
825
|
+
var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
826
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
827
|
+
return v3;
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
/**
|
|
831
|
+
* `ends`: two id numbers per element, -1 unless both ends name elements.
|
|
832
|
+
* @param {Float64Array} recs
|
|
833
|
+
* @param {Uint32Array} ids
|
|
834
|
+
* @param {Float64Array} ends
|
|
835
|
+
* @param {Float64Array} marquee
|
|
836
|
+
* @returns {Uint32Array}
|
|
837
|
+
*/
|
|
838
|
+
export function elements_in_marquee(recs, ids, ends, marquee) {
|
|
839
|
+
const ptr0 = passArrayF64ToWasm0(recs, wasm.__wbindgen_malloc);
|
|
840
|
+
const len0 = WASM_VECTOR_LEN;
|
|
841
|
+
const ptr1 = passArray32ToWasm0(ids, wasm.__wbindgen_malloc);
|
|
842
|
+
const len1 = WASM_VECTOR_LEN;
|
|
843
|
+
const ptr2 = passArrayF64ToWasm0(ends, wasm.__wbindgen_malloc);
|
|
844
|
+
const len2 = WASM_VECTOR_LEN;
|
|
845
|
+
const ptr3 = passArrayF64ToWasm0(marquee, wasm.__wbindgen_malloc);
|
|
846
|
+
const len3 = WASM_VECTOR_LEN;
|
|
847
|
+
const ret = wasm.elements_in_marquee(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
848
|
+
var v5 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
|
|
849
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
850
|
+
return v5;
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
/**
|
|
854
|
+
* `lines`: `[wordCount, …lengths]` per line.
|
|
855
|
+
* @param {Float64Array} lines
|
|
856
|
+
* @param {number} px
|
|
857
|
+
* @param {Float64Array} b
|
|
858
|
+
* @param {number} align_x
|
|
859
|
+
* @param {number} align_y
|
|
860
|
+
* @returns {Float64Array}
|
|
861
|
+
*/
|
|
862
|
+
export function estimate_text_box(lines, px, b, align_x, align_y) {
|
|
863
|
+
const ptr0 = passArrayF64ToWasm0(lines, wasm.__wbindgen_malloc);
|
|
864
|
+
const len0 = WASM_VECTOR_LEN;
|
|
865
|
+
const ptr1 = passArrayF64ToWasm0(b, wasm.__wbindgen_malloc);
|
|
866
|
+
const len1 = WASM_VECTOR_LEN;
|
|
867
|
+
const ret = wasm.estimate_text_box(ptr0, len0, px, ptr1, len1, align_x, align_y);
|
|
868
|
+
var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
869
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
870
|
+
return v3;
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
/**
|
|
874
|
+
* `[index, side]`, or empty when nothing is within reach.
|
|
875
|
+
* @param {Float64Array} elements
|
|
876
|
+
* @param {number} x
|
|
877
|
+
* @param {number} y
|
|
878
|
+
* @param {number} reach
|
|
879
|
+
* @returns {Float64Array}
|
|
880
|
+
*/
|
|
881
|
+
export function find_arrow_end_target(elements, x, y, reach) {
|
|
882
|
+
const ptr0 = passArrayF64ToWasm0(elements, wasm.__wbindgen_malloc);
|
|
883
|
+
const len0 = WASM_VECTOR_LEN;
|
|
884
|
+
const ret = wasm.find_arrow_end_target(ptr0, len0, x, y, reach);
|
|
885
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
886
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
887
|
+
return v2;
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
/**
|
|
891
|
+
* `findFreeSpots` over `grid` with the board's item boxes and section
|
|
892
|
+
* rectangles; sizes are `[w, h]*`. Per size `[found, x, y, w, h, fine]`.
|
|
893
|
+
* Unless `dry`, found spots are added to the grid.
|
|
894
|
+
* @param {OccupancyGrid} grid
|
|
895
|
+
* @param {Float64Array} items
|
|
896
|
+
* @param {Float64Array} sections
|
|
897
|
+
* @param {Float64Array} sizes
|
|
898
|
+
* @param {Float64Array} request_flat
|
|
899
|
+
* @param {boolean} dry
|
|
900
|
+
* @returns {Float64Array}
|
|
901
|
+
*/
|
|
902
|
+
export function find_free_spots(grid, items, sections, sizes, request_flat, dry) {
|
|
903
|
+
_assertClass(grid, OccupancyGrid);
|
|
904
|
+
const ptr0 = passArrayF64ToWasm0(items, wasm.__wbindgen_malloc);
|
|
905
|
+
const len0 = WASM_VECTOR_LEN;
|
|
906
|
+
const ptr1 = passArrayF64ToWasm0(sections, wasm.__wbindgen_malloc);
|
|
907
|
+
const len1 = WASM_VECTOR_LEN;
|
|
908
|
+
const ptr2 = passArrayF64ToWasm0(sizes, wasm.__wbindgen_malloc);
|
|
909
|
+
const len2 = WASM_VECTOR_LEN;
|
|
910
|
+
const ptr3 = passArrayF64ToWasm0(request_flat, wasm.__wbindgen_malloc);
|
|
911
|
+
const len3 = WASM_VECTOR_LEN;
|
|
912
|
+
const ret = wasm.find_free_spots(grid.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, dry);
|
|
913
|
+
var v5 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
914
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
915
|
+
return v5;
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
/**
|
|
919
|
+
* @param {number} zoom_value
|
|
920
|
+
* @param {Float64Array} b
|
|
921
|
+
* @param {number} view_w
|
|
922
|
+
* @param {number} view_h
|
|
923
|
+
* @param {number} inset_top
|
|
924
|
+
* @param {number} inset_bottom
|
|
925
|
+
* @param {number} margin
|
|
926
|
+
* @returns {boolean}
|
|
927
|
+
*/
|
|
928
|
+
export function fits_in_viewport(zoom_value, b, view_w, view_h, inset_top, inset_bottom, margin) {
|
|
929
|
+
const ptr0 = passArrayF64ToWasm0(b, wasm.__wbindgen_malloc);
|
|
930
|
+
const len0 = WASM_VECTOR_LEN;
|
|
931
|
+
const ret = wasm.fits_in_viewport(zoom_value, ptr0, len0, view_w, view_h, inset_top, inset_bottom, margin);
|
|
932
|
+
return ret !== 0;
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
/**
|
|
936
|
+
* `freeSpaceCandidates` → `[x, y, fine]*`.
|
|
937
|
+
* @param {Float64Array} request_flat
|
|
938
|
+
* @param {number} size_w
|
|
939
|
+
* @param {number} size_h
|
|
940
|
+
* @param {Float64Array} items
|
|
941
|
+
* @returns {Float64Array}
|
|
942
|
+
*/
|
|
943
|
+
export function free_space_candidates(request_flat, size_w, size_h, items) {
|
|
944
|
+
const ptr0 = passArrayF64ToWasm0(request_flat, wasm.__wbindgen_malloc);
|
|
945
|
+
const len0 = WASM_VECTOR_LEN;
|
|
946
|
+
const ptr1 = passArrayF64ToWasm0(items, wasm.__wbindgen_malloc);
|
|
947
|
+
const len1 = WASM_VECTOR_LEN;
|
|
948
|
+
const ret = wasm.free_space_candidates(ptr0, len0, size_w, size_h, ptr1, len1);
|
|
949
|
+
var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
950
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
951
|
+
return v3;
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
/**
|
|
955
|
+
* `[index, x, y]*` in reading order.
|
|
956
|
+
* @param {Float64Array} rects
|
|
957
|
+
* @param {number} gap
|
|
958
|
+
* @returns {Float64Array}
|
|
959
|
+
*/
|
|
960
|
+
export function grid_layout_of_rects(rects, gap) {
|
|
961
|
+
const ptr0 = passArrayF64ToWasm0(rects, wasm.__wbindgen_malloc);
|
|
962
|
+
const len0 = WASM_VECTOR_LEN;
|
|
963
|
+
const ret = wasm.grid_layout_of_rects(ptr0, len0, gap);
|
|
964
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
965
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
966
|
+
return v2;
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
/**
|
|
970
|
+
* @param {Float64Array} r
|
|
971
|
+
* @param {number} edge_x
|
|
972
|
+
* @param {number} edge_y
|
|
973
|
+
* @param {Float64Array} g
|
|
974
|
+
* @returns {Uint32Array}
|
|
975
|
+
*/
|
|
976
|
+
export function guides_touching_edges(r, edge_x, edge_y, g) {
|
|
977
|
+
const ptr0 = passArrayF64ToWasm0(r, wasm.__wbindgen_malloc);
|
|
978
|
+
const len0 = WASM_VECTOR_LEN;
|
|
979
|
+
const ptr1 = passArrayF64ToWasm0(g, wasm.__wbindgen_malloc);
|
|
980
|
+
const len1 = WASM_VECTOR_LEN;
|
|
981
|
+
const ret = wasm.guides_touching_edges(ptr0, len0, edge_x, edge_y, ptr1, len1);
|
|
982
|
+
var v3 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
|
|
983
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
984
|
+
return v3;
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
/**
|
|
988
|
+
* @param {number} kind
|
|
989
|
+
* @param {number} width
|
|
990
|
+
* @param {number} height
|
|
991
|
+
* @param {Uint16Array} seed
|
|
992
|
+
* @returns {string}
|
|
993
|
+
*/
|
|
994
|
+
export function hand_drawn_shape_outline(kind, width, height, seed) {
|
|
995
|
+
let deferred2_0;
|
|
996
|
+
let deferred2_1;
|
|
997
|
+
try {
|
|
998
|
+
const ptr0 = passArray16ToWasm0(seed, wasm.__wbindgen_malloc);
|
|
999
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1000
|
+
const ret = wasm.hand_drawn_shape_outline(kind, width, height, ptr0, len0);
|
|
1001
|
+
deferred2_0 = ret[0];
|
|
1002
|
+
deferred2_1 = ret[1];
|
|
1003
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1004
|
+
} finally {
|
|
1005
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
/**
|
|
1010
|
+
* Many outlines at once: `shapes` is `[kind, w, h]` per shape, `seeds` the
|
|
1011
|
+
* UTF-16 seeds concatenated with `seed_lengths` giving each one's length.
|
|
1012
|
+
* Returns the path data joined with `\n` (path data never contains one).
|
|
1013
|
+
* @param {Float64Array} shapes
|
|
1014
|
+
* @param {Uint16Array} seeds
|
|
1015
|
+
* @param {Uint32Array} seed_lengths
|
|
1016
|
+
* @returns {string}
|
|
1017
|
+
*/
|
|
1018
|
+
export function hand_drawn_shape_outlines(shapes, seeds, seed_lengths) {
|
|
1019
|
+
let deferred4_0;
|
|
1020
|
+
let deferred4_1;
|
|
1021
|
+
try {
|
|
1022
|
+
const ptr0 = passArrayF64ToWasm0(shapes, wasm.__wbindgen_malloc);
|
|
1023
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1024
|
+
const ptr1 = passArray16ToWasm0(seeds, wasm.__wbindgen_malloc);
|
|
1025
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1026
|
+
const ptr2 = passArray32ToWasm0(seed_lengths, wasm.__wbindgen_malloc);
|
|
1027
|
+
const len2 = WASM_VECTOR_LEN;
|
|
1028
|
+
const ret = wasm.hand_drawn_shape_outlines(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
1029
|
+
deferred4_0 = ret[0];
|
|
1030
|
+
deferred4_1 = ret[1];
|
|
1031
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1032
|
+
} finally {
|
|
1033
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
/**
|
|
1038
|
+
* 1 hit, 0 missed, -1 `undefined` (an unknown type).
|
|
1039
|
+
* @param {Float64Array} rec
|
|
1040
|
+
* @param {number} x
|
|
1041
|
+
* @param {number} y
|
|
1042
|
+
* @param {number} tolerance
|
|
1043
|
+
* @returns {number}
|
|
1044
|
+
*/
|
|
1045
|
+
export function hit_test_element(rec, x, y, tolerance) {
|
|
1046
|
+
const ptr0 = passArrayF64ToWasm0(rec, wasm.__wbindgen_malloc);
|
|
1047
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1048
|
+
const ret = wasm.hit_test_element(ptr0, len0, x, y, tolerance);
|
|
1049
|
+
return ret;
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
/**
|
|
1053
|
+
* @param {number} x
|
|
1054
|
+
* @param {number} y
|
|
1055
|
+
* @param {number} size
|
|
1056
|
+
* @returns {string}
|
|
1057
|
+
*/
|
|
1058
|
+
export function ink_corner_blob(x, y, size) {
|
|
1059
|
+
let deferred1_0;
|
|
1060
|
+
let deferred1_1;
|
|
1061
|
+
try {
|
|
1062
|
+
const ret = wasm.ink_corner_blob(x, y, size);
|
|
1063
|
+
deferred1_0 = ret[0];
|
|
1064
|
+
deferred1_1 = ret[1];
|
|
1065
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1066
|
+
} finally {
|
|
1067
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
/**
|
|
1072
|
+
* Polylines as `[count, …(closed, pointCount, …points, cornerCount, …corners)]`.
|
|
1073
|
+
* @param {Float64Array} cmds
|
|
1074
|
+
* @param {number} step
|
|
1075
|
+
* @returns {Float64Array}
|
|
1076
|
+
*/
|
|
1077
|
+
export function ink_flatten_path(cmds, step) {
|
|
1078
|
+
const ptr0 = passArrayF64ToWasm0(cmds, wasm.__wbindgen_malloc);
|
|
1079
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1080
|
+
const ret = wasm.ink_flatten_path(ptr0, len0, step);
|
|
1081
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
1082
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1083
|
+
return v2;
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
/**
|
|
1087
|
+
* @param {Float64Array} pts
|
|
1088
|
+
* @param {Uint32Array} corners
|
|
1089
|
+
* @param {boolean} closed
|
|
1090
|
+
* @param {number} strength
|
|
1091
|
+
* @param {Uint16Array} seed
|
|
1092
|
+
* @returns {string}
|
|
1093
|
+
*/
|
|
1094
|
+
export function ink_polyline_outline(pts, corners, closed, strength, seed) {
|
|
1095
|
+
let deferred4_0;
|
|
1096
|
+
let deferred4_1;
|
|
1097
|
+
try {
|
|
1098
|
+
const ptr0 = passArrayF64ToWasm0(pts, wasm.__wbindgen_malloc);
|
|
1099
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1100
|
+
const ptr1 = passArray32ToWasm0(corners, wasm.__wbindgen_malloc);
|
|
1101
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1102
|
+
const ptr2 = passArray16ToWasm0(seed, wasm.__wbindgen_malloc);
|
|
1103
|
+
const len2 = WASM_VECTOR_LEN;
|
|
1104
|
+
const ret = wasm.ink_polyline_outline(ptr0, len0, ptr1, len1, closed, strength, ptr2, len2);
|
|
1105
|
+
deferred4_0 = ret[0];
|
|
1106
|
+
deferred4_1 = ret[1];
|
|
1107
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1108
|
+
} finally {
|
|
1109
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
1110
|
+
}
|
|
1111
|
+
}
|
|
1112
|
+
|
|
1113
|
+
/**
|
|
1114
|
+
* `which` 0: press, 1: stray.
|
|
1115
|
+
* @param {number} length
|
|
1116
|
+
* @param {number} strength
|
|
1117
|
+
* @param {Uint16Array} seed
|
|
1118
|
+
* @param {number} which
|
|
1119
|
+
* @param {number} at
|
|
1120
|
+
* @returns {number}
|
|
1121
|
+
*/
|
|
1122
|
+
export function ink_pressure(length, strength, seed, which, at) {
|
|
1123
|
+
const ptr0 = passArray16ToWasm0(seed, wasm.__wbindgen_malloc);
|
|
1124
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1125
|
+
const ret = wasm.ink_pressure(length, strength, ptr0, len0, which, at);
|
|
1126
|
+
return ret;
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
/**
|
|
1130
|
+
* @param {Float64Array} pts
|
|
1131
|
+
* @returns {string}
|
|
1132
|
+
*/
|
|
1133
|
+
export function ink_side_path(pts) {
|
|
1134
|
+
let deferred2_0;
|
|
1135
|
+
let deferred2_1;
|
|
1136
|
+
try {
|
|
1137
|
+
const ptr0 = passArrayF64ToWasm0(pts, wasm.__wbindgen_malloc);
|
|
1138
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1139
|
+
const ret = wasm.ink_side_path(ptr0, len0);
|
|
1140
|
+
deferred2_0 = ret[0];
|
|
1141
|
+
deferred2_1 = ret[1];
|
|
1142
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1143
|
+
} finally {
|
|
1144
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1148
|
+
/**
|
|
1149
|
+
* @param {number} count
|
|
1150
|
+
* @param {Float64Array} values
|
|
1151
|
+
* @param {number} x
|
|
1152
|
+
* @returns {number}
|
|
1153
|
+
*/
|
|
1154
|
+
export function ink_value_noise(count, values, x) {
|
|
1155
|
+
const ptr0 = passArrayF64ToWasm0(values, wasm.__wbindgen_malloc);
|
|
1156
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1157
|
+
const ret = wasm.ink_value_noise(count, ptr0, len0, x);
|
|
1158
|
+
return ret;
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
/**
|
|
1162
|
+
* @param {Float64Array} cam
|
|
1163
|
+
* @param {Float64Array} b
|
|
1164
|
+
* @param {number} view_w
|
|
1165
|
+
* @param {number} view_h
|
|
1166
|
+
* @returns {boolean}
|
|
1167
|
+
*/
|
|
1168
|
+
export function is_offscreen(cam, b, view_w, view_h) {
|
|
1169
|
+
const ptr0 = passArrayF64ToWasm0(cam, wasm.__wbindgen_malloc);
|
|
1170
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1171
|
+
const ptr1 = passArrayF64ToWasm0(b, wasm.__wbindgen_malloc);
|
|
1172
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1173
|
+
const ret = wasm.is_offscreen(ptr0, len0, ptr1, len1, view_w, view_h);
|
|
1174
|
+
return ret !== 0;
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1177
|
+
/**
|
|
1178
|
+
* @param {Float64Array} pts
|
|
1179
|
+
* @param {number} index
|
|
1180
|
+
* @param {number} target
|
|
1181
|
+
* @param {boolean} attached_from
|
|
1182
|
+
* @param {boolean} attached_to
|
|
1183
|
+
* @param {number} stub_from
|
|
1184
|
+
* @param {number} stub_to
|
|
1185
|
+
* @returns {Float64Array}
|
|
1186
|
+
*/
|
|
1187
|
+
export function move_route_segment(pts, index, target, attached_from, attached_to, stub_from, stub_to) {
|
|
1188
|
+
const ptr0 = passArrayF64ToWasm0(pts, wasm.__wbindgen_malloc);
|
|
1189
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1190
|
+
const ret = wasm.move_route_segment(ptr0, len0, index, target, attached_from, attached_to, stub_from, stub_to);
|
|
1191
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
1192
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1193
|
+
return v2;
|
|
1194
|
+
}
|
|
1195
|
+
|
|
1196
|
+
/**
|
|
1197
|
+
* `[x, y, …relative points]`.
|
|
1198
|
+
* @param {Float64Array} pts
|
|
1199
|
+
* @returns {Float64Array}
|
|
1200
|
+
*/
|
|
1201
|
+
export function normalize_stroke_points(pts) {
|
|
1202
|
+
const ptr0 = passArrayF64ToWasm0(pts, wasm.__wbindgen_malloc);
|
|
1203
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1204
|
+
const ret = wasm.normalize_stroke_points(ptr0, len0);
|
|
1205
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
1206
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1207
|
+
return v2;
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
/**
|
|
1211
|
+
* The occupied pieces of arrows and drawings. Records: arrow `[0, x1, y1,
|
|
1212
|
+
* x2, y2, elbowCount (-1 for none), elbow…]`, drawing `[1, x, y, width,
|
|
1213
|
+
* count, points…]`. Per record `[n, rect×4…]`.
|
|
1214
|
+
* @param {Float64Array} records
|
|
1215
|
+
* @returns {Float64Array}
|
|
1216
|
+
*/
|
|
1217
|
+
export function occupied_pieces(records) {
|
|
1218
|
+
const ptr0 = passArrayF64ToWasm0(records, wasm.__wbindgen_malloc);
|
|
1219
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1220
|
+
const ret = wasm.occupied_pieces(ptr0, len0);
|
|
1221
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
1222
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1223
|
+
return v2;
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
/**
|
|
1227
|
+
* @param {number} kind
|
|
1228
|
+
* @param {Float64Array} shape
|
|
1229
|
+
* @param {Float64Array} b
|
|
1230
|
+
* @returns {boolean}
|
|
1231
|
+
*/
|
|
1232
|
+
export function outline_crosses_box(kind, shape, b) {
|
|
1233
|
+
const ptr0 = passArrayF64ToWasm0(shape, wasm.__wbindgen_malloc);
|
|
1234
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1235
|
+
const ptr1 = passArrayF64ToWasm0(b, wasm.__wbindgen_malloc);
|
|
1236
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1237
|
+
const ret = wasm.outline_crosses_box(kind, ptr0, len0, ptr1, len1);
|
|
1238
|
+
return ret !== 0;
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1241
|
+
/**
|
|
1242
|
+
* `[x, y]`, or `[]` when nothing moves.
|
|
1243
|
+
* @param {Float64Array} cam
|
|
1244
|
+
* @param {Float64Array} b
|
|
1245
|
+
* @param {number} view_w
|
|
1246
|
+
* @param {number} view_h
|
|
1247
|
+
* @param {number} inset_top
|
|
1248
|
+
* @param {number} inset_bottom
|
|
1249
|
+
* @param {number} margin
|
|
1250
|
+
* @returns {Float64Array}
|
|
1251
|
+
*/
|
|
1252
|
+
export function pan_camera_to_reveal(cam, b, view_w, view_h, inset_top, inset_bottom, margin) {
|
|
1253
|
+
const ptr0 = passArrayF64ToWasm0(cam, wasm.__wbindgen_malloc);
|
|
1254
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1255
|
+
const ptr1 = passArrayF64ToWasm0(b, wasm.__wbindgen_malloc);
|
|
1256
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1257
|
+
const ret = wasm.pan_camera_to_reveal(ptr0, len0, ptr1, len1, view_w, view_h, inset_top, inset_bottom, margin);
|
|
1258
|
+
var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
1259
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1260
|
+
return v3;
|
|
1261
|
+
}
|
|
1262
|
+
|
|
1263
|
+
/**
|
|
1264
|
+
* `elbow`: false for `placeArrowLabel` on a line that is not an elbow of
|
|
1265
|
+
* three or more points, true for `placeElbowArrowLabel`.
|
|
1266
|
+
* @param {Float64Array} line_values
|
|
1267
|
+
* @param {number} head_from
|
|
1268
|
+
* @param {number} head_to
|
|
1269
|
+
* @param {number} word_count
|
|
1270
|
+
* @param {Float64Array} widths
|
|
1271
|
+
* @param {number} space
|
|
1272
|
+
* @param {Float64Array} ends
|
|
1273
|
+
* @param {boolean} elbow
|
|
1274
|
+
* @returns {Float64Array}
|
|
1275
|
+
*/
|
|
1276
|
+
export function place_arrow_label(line_values, head_from, head_to, word_count, widths, space, ends, elbow) {
|
|
1277
|
+
const ptr0 = passArrayF64ToWasm0(line_values, wasm.__wbindgen_malloc);
|
|
1278
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1279
|
+
const ptr1 = passArrayF64ToWasm0(widths, wasm.__wbindgen_malloc);
|
|
1280
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1281
|
+
const ptr2 = passArrayF64ToWasm0(ends, wasm.__wbindgen_malloc);
|
|
1282
|
+
const len2 = WASM_VECTOR_LEN;
|
|
1283
|
+
const ret = wasm.place_arrow_label(ptr0, len0, head_from, head_to, word_count, ptr1, len1, space, ptr2, len2, elbow);
|
|
1284
|
+
var v4 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
1285
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1286
|
+
return v4;
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1289
|
+
/**
|
|
1290
|
+
* Empty when there is no route, else `[shape, hasJog, jog, …points]`.
|
|
1291
|
+
* @param {Float64Array} two_boxes
|
|
1292
|
+
* @param {number} from_side
|
|
1293
|
+
* @param {number} to_side
|
|
1294
|
+
* @param {number} jog
|
|
1295
|
+
* @param {number} offset_from
|
|
1296
|
+
* @param {number} offset_to
|
|
1297
|
+
* @returns {Float64Array}
|
|
1298
|
+
*/
|
|
1299
|
+
export function plan_elbow_route(two_boxes, from_side, to_side, jog, offset_from, offset_to) {
|
|
1300
|
+
const ptr0 = passArrayF64ToWasm0(two_boxes, wasm.__wbindgen_malloc);
|
|
1301
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1302
|
+
const ret = wasm.plan_elbow_route(ptr0, len0, from_side, to_side, jog, offset_from, offset_to);
|
|
1303
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
1304
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1305
|
+
return v2;
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1308
|
+
/**
|
|
1309
|
+
* @param {Float64Array} b
|
|
1310
|
+
* @param {number} x
|
|
1311
|
+
* @param {number} y
|
|
1312
|
+
* @returns {number}
|
|
1313
|
+
*/
|
|
1314
|
+
export function point_to_box_distance(b, x, y) {
|
|
1315
|
+
const ptr0 = passArrayF64ToWasm0(b, wasm.__wbindgen_malloc);
|
|
1316
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1317
|
+
const ret = wasm.point_to_box_distance(ptr0, len0, x, y);
|
|
1318
|
+
return ret;
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1321
|
+
/**
|
|
1322
|
+
* @param {number} kind
|
|
1323
|
+
* @param {number} width
|
|
1324
|
+
* @param {number} height
|
|
1325
|
+
* @returns {Float64Array}
|
|
1326
|
+
*/
|
|
1327
|
+
export function polygon_shape_points(kind, width, height) {
|
|
1328
|
+
const ret = wasm.polygon_shape_points(kind, width, height);
|
|
1329
|
+
var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
1330
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1331
|
+
return v1;
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1334
|
+
/**
|
|
1335
|
+
* `mode` 0 free, 1 keeping the aspect ratio.
|
|
1336
|
+
* @param {Float64Array} r
|
|
1337
|
+
* @param {number} edge_x
|
|
1338
|
+
* @param {number} edge_y
|
|
1339
|
+
* @param {number} dx
|
|
1340
|
+
* @param {number} dy
|
|
1341
|
+
* @param {Float64Array} limits
|
|
1342
|
+
* @param {number} mode
|
|
1343
|
+
* @returns {Float64Array}
|
|
1344
|
+
*/
|
|
1345
|
+
export function resize_rect(r, edge_x, edge_y, dx, dy, limits, mode) {
|
|
1346
|
+
const ptr0 = passArrayF64ToWasm0(r, wasm.__wbindgen_malloc);
|
|
1347
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1348
|
+
const ptr1 = passArrayF64ToWasm0(limits, wasm.__wbindgen_malloc);
|
|
1349
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1350
|
+
const ret = wasm.resize_rect(ptr0, len0, edge_x, edge_y, dx, dy, ptr1, len1, mode);
|
|
1351
|
+
var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
1352
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1353
|
+
return v3;
|
|
1354
|
+
}
|
|
1355
|
+
|
|
1356
|
+
/**
|
|
1357
|
+
* @param {Float64Array} b
|
|
1358
|
+
* @param {number} degrees
|
|
1359
|
+
* @param {number} width
|
|
1360
|
+
* @param {number} height
|
|
1361
|
+
* @param {boolean} flip_x
|
|
1362
|
+
* @param {boolean} flip_y
|
|
1363
|
+
* @param {number} edge_x
|
|
1364
|
+
* @param {number} edge_y
|
|
1365
|
+
* @returns {Float64Array}
|
|
1366
|
+
*/
|
|
1367
|
+
export function resize_rotated_box(b, degrees, width, height, flip_x, flip_y, edge_x, edge_y) {
|
|
1368
|
+
const ptr0 = passArrayF64ToWasm0(b, wasm.__wbindgen_malloc);
|
|
1369
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1370
|
+
const ret = wasm.resize_rotated_box(ptr0, len0, degrees, width, height, flip_x, flip_y, edge_x, edge_y);
|
|
1371
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
1372
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1373
|
+
return v2;
|
|
1374
|
+
}
|
|
1375
|
+
|
|
1376
|
+
/**
|
|
1377
|
+
* @param {Float64Array} r
|
|
1378
|
+
* @param {number} rotation
|
|
1379
|
+
* @param {number} edge_x
|
|
1380
|
+
* @param {number} edge_y
|
|
1381
|
+
* @param {number} dx
|
|
1382
|
+
* @param {number} dy
|
|
1383
|
+
* @param {Float64Array} limits
|
|
1384
|
+
* @param {boolean} keep_aspect
|
|
1385
|
+
* @returns {Float64Array}
|
|
1386
|
+
*/
|
|
1387
|
+
export function resize_rotated_rect(r, rotation, edge_x, edge_y, dx, dy, limits, keep_aspect) {
|
|
1388
|
+
const ptr0 = passArrayF64ToWasm0(r, wasm.__wbindgen_malloc);
|
|
1389
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1390
|
+
const ptr1 = passArrayF64ToWasm0(limits, wasm.__wbindgen_malloc);
|
|
1391
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1392
|
+
const ret = wasm.resize_rotated_rect(ptr0, len0, rotation, edge_x, edge_y, dx, dy, ptr1, len1, keep_aspect);
|
|
1393
|
+
var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
1394
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1395
|
+
return v3;
|
|
1396
|
+
}
|
|
1397
|
+
|
|
1398
|
+
/**
|
|
1399
|
+
* The new top-left of a box turned around `(cx, cy)`.
|
|
1400
|
+
* @param {Float64Array} b
|
|
1401
|
+
* @param {number} cx
|
|
1402
|
+
* @param {number} cy
|
|
1403
|
+
* @param {number} degrees
|
|
1404
|
+
* @returns {Float64Array}
|
|
1405
|
+
*/
|
|
1406
|
+
export function rotate_box_around_of(b, cx, cy, degrees) {
|
|
1407
|
+
const ptr0 = passArrayF64ToWasm0(b, wasm.__wbindgen_malloc);
|
|
1408
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1409
|
+
const ret = wasm.rotate_box_around_of(ptr0, len0, cx, cy, degrees);
|
|
1410
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
1411
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1412
|
+
return v2;
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1415
|
+
/**
|
|
1416
|
+
* @param {number} px
|
|
1417
|
+
* @param {number} py
|
|
1418
|
+
* @param {number} cx
|
|
1419
|
+
* @param {number} cy
|
|
1420
|
+
* @param {number} degrees
|
|
1421
|
+
* @returns {Float64Array}
|
|
1422
|
+
*/
|
|
1423
|
+
export function rotate_point_around(px, py, cx, cy, degrees) {
|
|
1424
|
+
const ret = wasm.rotate_point_around(px, py, cx, cy, degrees);
|
|
1425
|
+
var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
1426
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1427
|
+
return v1;
|
|
1428
|
+
}
|
|
1429
|
+
|
|
1430
|
+
/**
|
|
1431
|
+
* @param {number} x
|
|
1432
|
+
* @param {number} y
|
|
1433
|
+
* @param {number} cx
|
|
1434
|
+
* @param {number} cy
|
|
1435
|
+
* @param {number} degrees
|
|
1436
|
+
* @returns {Float64Array}
|
|
1437
|
+
*/
|
|
1438
|
+
export function rotate_point_around_xy(x, y, cx, cy, degrees) {
|
|
1439
|
+
const ret = wasm.rotate_point_around_xy(x, y, cx, cy, degrees);
|
|
1440
|
+
var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
1441
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1442
|
+
return v1;
|
|
1443
|
+
}
|
|
1444
|
+
|
|
1445
|
+
/**
|
|
1446
|
+
* @param {number} x
|
|
1447
|
+
* @param {number} y
|
|
1448
|
+
* @param {number} w
|
|
1449
|
+
* @param {number} h
|
|
1450
|
+
* @param {number} degrees
|
|
1451
|
+
* @returns {Float64Array}
|
|
1452
|
+
*/
|
|
1453
|
+
export function rotated_bounding_box(x, y, w, h, degrees) {
|
|
1454
|
+
const ret = wasm.rotated_bounding_box(x, y, w, h, degrees);
|
|
1455
|
+
var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
1456
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1457
|
+
return v1;
|
|
1458
|
+
}
|
|
1459
|
+
|
|
1460
|
+
/**
|
|
1461
|
+
* @param {Float64Array} b
|
|
1462
|
+
* @param {number} degrees
|
|
1463
|
+
* @returns {Float64Array}
|
|
1464
|
+
*/
|
|
1465
|
+
export function rotated_bounding_box_of(b, degrees) {
|
|
1466
|
+
const ptr0 = passArrayF64ToWasm0(b, wasm.__wbindgen_malloc);
|
|
1467
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1468
|
+
const ret = wasm.rotated_bounding_box_of(ptr0, len0, degrees);
|
|
1469
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
1470
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1471
|
+
return v2;
|
|
1472
|
+
}
|
|
1473
|
+
|
|
1474
|
+
/**
|
|
1475
|
+
* @param {Float64Array} b
|
|
1476
|
+
* @param {number} degrees
|
|
1477
|
+
* @param {Float64Array} other
|
|
1478
|
+
* @returns {boolean}
|
|
1479
|
+
*/
|
|
1480
|
+
export function rotated_boxes_overlap(b, degrees, other) {
|
|
1481
|
+
const ptr0 = passArrayF64ToWasm0(b, wasm.__wbindgen_malloc);
|
|
1482
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1483
|
+
const ptr1 = passArrayF64ToWasm0(other, wasm.__wbindgen_malloc);
|
|
1484
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1485
|
+
const ret = wasm.rotated_boxes_overlap(ptr0, len0, degrees, ptr1, len1);
|
|
1486
|
+
return ret !== 0;
|
|
1487
|
+
}
|
|
1488
|
+
|
|
1489
|
+
/**
|
|
1490
|
+
* @param {Float64Array} b
|
|
1491
|
+
* @param {number} degrees
|
|
1492
|
+
* @param {Float64Array} other
|
|
1493
|
+
* @returns {boolean}
|
|
1494
|
+
*/
|
|
1495
|
+
export function rotated_boxes_overlap_of(b, degrees, other) {
|
|
1496
|
+
const ptr0 = passArrayF64ToWasm0(b, wasm.__wbindgen_malloc);
|
|
1497
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1498
|
+
const ptr1 = passArrayF64ToWasm0(other, wasm.__wbindgen_malloc);
|
|
1499
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1500
|
+
const ret = wasm.rotated_boxes_overlap_of(ptr0, len0, degrees, ptr1, len1);
|
|
1501
|
+
return ret !== 0;
|
|
1502
|
+
}
|
|
1503
|
+
|
|
1504
|
+
/**
|
|
1505
|
+
* @param {number} radius
|
|
1506
|
+
* @param {number} half_span
|
|
1507
|
+
* @param {number} offset
|
|
1508
|
+
* @returns {number}
|
|
1509
|
+
*/
|
|
1510
|
+
export function rounded_corner_inset(radius, half_span, offset) {
|
|
1511
|
+
const ret = wasm.rounded_corner_inset(radius, half_span, offset);
|
|
1512
|
+
return ret;
|
|
1513
|
+
}
|
|
1514
|
+
|
|
1515
|
+
/**
|
|
1516
|
+
* @param {number} kind
|
|
1517
|
+
* @param {number} width
|
|
1518
|
+
* @param {number} height
|
|
1519
|
+
* @param {boolean} rounded
|
|
1520
|
+
* @returns {string}
|
|
1521
|
+
*/
|
|
1522
|
+
export function rounded_polygon_path_data(kind, width, height, rounded) {
|
|
1523
|
+
let deferred1_0;
|
|
1524
|
+
let deferred1_1;
|
|
1525
|
+
try {
|
|
1526
|
+
const ret = wasm.rounded_polygon_path_data(kind, width, height, rounded);
|
|
1527
|
+
deferred1_0 = ret[0];
|
|
1528
|
+
deferred1_1 = ret[1];
|
|
1529
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1530
|
+
} finally {
|
|
1531
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1532
|
+
}
|
|
1533
|
+
}
|
|
1534
|
+
|
|
1535
|
+
/**
|
|
1536
|
+
* Each corner as 8 numbers: corner, a, mid, b.
|
|
1537
|
+
* @param {Float64Array} pts
|
|
1538
|
+
* @param {boolean} attached_from
|
|
1539
|
+
* @param {boolean} attached_to
|
|
1540
|
+
* @returns {Float64Array}
|
|
1541
|
+
*/
|
|
1542
|
+
export function rounded_route_corners(pts, attached_from, attached_to) {
|
|
1543
|
+
const ptr0 = passArrayF64ToWasm0(pts, wasm.__wbindgen_malloc);
|
|
1544
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1545
|
+
const ret = wasm.rounded_route_corners(ptr0, len0, attached_from, attached_to);
|
|
1546
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
1547
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1548
|
+
return v2;
|
|
1549
|
+
}
|
|
1550
|
+
|
|
1551
|
+
/**
|
|
1552
|
+
* @param {Float64Array} pts
|
|
1553
|
+
* @param {boolean} attached_from
|
|
1554
|
+
* @param {boolean} attached_to
|
|
1555
|
+
* @returns {string}
|
|
1556
|
+
*/
|
|
1557
|
+
export function rounded_route_path(pts, attached_from, attached_to) {
|
|
1558
|
+
let deferred2_0;
|
|
1559
|
+
let deferred2_1;
|
|
1560
|
+
try {
|
|
1561
|
+
const ptr0 = passArrayF64ToWasm0(pts, wasm.__wbindgen_malloc);
|
|
1562
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1563
|
+
const ret = wasm.rounded_route_path(ptr0, len0, attached_from, attached_to);
|
|
1564
|
+
deferred2_0 = ret[0];
|
|
1565
|
+
deferred2_1 = ret[1];
|
|
1566
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1567
|
+
} finally {
|
|
1568
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
1569
|
+
}
|
|
1570
|
+
}
|
|
1571
|
+
|
|
1572
|
+
/**
|
|
1573
|
+
* Empty when there is no leg, else a.x, a.y, b.x, b.y, len, level.
|
|
1574
|
+
* @param {Float64Array} pts
|
|
1575
|
+
* @returns {Float64Array}
|
|
1576
|
+
*/
|
|
1577
|
+
export function route_label_segment(pts) {
|
|
1578
|
+
const ptr0 = passArrayF64ToWasm0(pts, wasm.__wbindgen_malloc);
|
|
1579
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1580
|
+
const ret = wasm.route_label_segment(ptr0, len0);
|
|
1581
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
1582
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1583
|
+
return v2;
|
|
1584
|
+
}
|
|
1585
|
+
|
|
1586
|
+
/**
|
|
1587
|
+
* Each leg as 9 numbers: a.x, a.y, b.x, b.y, dx, dy, len, dir.x, dir.y.
|
|
1588
|
+
* @param {Float64Array} pts
|
|
1589
|
+
* @returns {Float64Array}
|
|
1590
|
+
*/
|
|
1591
|
+
export function route_segments(pts) {
|
|
1592
|
+
const ptr0 = passArrayF64ToWasm0(pts, wasm.__wbindgen_malloc);
|
|
1593
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1594
|
+
const ret = wasm.route_segments(ptr0, len0);
|
|
1595
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
1596
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1597
|
+
return v2;
|
|
1598
|
+
}
|
|
1599
|
+
|
|
1600
|
+
/**
|
|
1601
|
+
* @param {Uint16Array} seed
|
|
1602
|
+
* @returns {number}
|
|
1603
|
+
*/
|
|
1604
|
+
export function seeded_random_state(seed) {
|
|
1605
|
+
const ptr0 = passArray16ToWasm0(seed, wasm.__wbindgen_malloc);
|
|
1606
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1607
|
+
const ret = wasm.seeded_random_state(ptr0, len0);
|
|
1608
|
+
return ret >>> 0;
|
|
1609
|
+
}
|
|
1610
|
+
|
|
1611
|
+
/**
|
|
1612
|
+
* The `draw`-th value (0-based) of a generator seeded with `state`.
|
|
1613
|
+
* @param {number} state
|
|
1614
|
+
* @param {number} draw
|
|
1615
|
+
* @returns {number}
|
|
1616
|
+
*/
|
|
1617
|
+
export function seeded_random_value(state, draw) {
|
|
1618
|
+
const ret = wasm.seeded_random_value(state, draw);
|
|
1619
|
+
return ret;
|
|
1620
|
+
}
|
|
1621
|
+
|
|
1622
|
+
/**
|
|
1623
|
+
* @param {number} x1
|
|
1624
|
+
* @param {number} y1
|
|
1625
|
+
* @param {number} x2
|
|
1626
|
+
* @param {number} y2
|
|
1627
|
+
* @param {Float64Array} b
|
|
1628
|
+
* @returns {boolean}
|
|
1629
|
+
*/
|
|
1630
|
+
export function segment_intersects_box(x1, y1, x2, y2, b) {
|
|
1631
|
+
const ptr0 = passArrayF64ToWasm0(b, wasm.__wbindgen_malloc);
|
|
1632
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1633
|
+
const ret = wasm.segment_intersects_box(x1, y1, x2, y2, ptr0, len0);
|
|
1634
|
+
return ret !== 0;
|
|
1635
|
+
}
|
|
1636
|
+
|
|
1637
|
+
/**
|
|
1638
|
+
* @param {number} kind
|
|
1639
|
+
* @param {number} width
|
|
1640
|
+
* @param {number} height
|
|
1641
|
+
* @param {number} side_code
|
|
1642
|
+
* @param {number} offset
|
|
1643
|
+
* @param {number} fallback
|
|
1644
|
+
* @returns {number}
|
|
1645
|
+
*/
|
|
1646
|
+
export function shape_edge_inset(kind, width, height, side_code, offset, fallback) {
|
|
1647
|
+
const ret = wasm.shape_edge_inset(kind, width, height, side_code, offset, fallback);
|
|
1648
|
+
return ret;
|
|
1649
|
+
}
|
|
1650
|
+
|
|
1651
|
+
/**
|
|
1652
|
+
* @param {Float64Array} cmds
|
|
1653
|
+
* @param {number} width
|
|
1654
|
+
* @param {number} height
|
|
1655
|
+
* @param {number} side_code
|
|
1656
|
+
* @param {number} line_offset
|
|
1657
|
+
* @returns {number}
|
|
1658
|
+
*/
|
|
1659
|
+
export function shape_edge_inset_at_line(cmds, width, height, side_code, line_offset) {
|
|
1660
|
+
const ptr0 = passArrayF64ToWasm0(cmds, wasm.__wbindgen_malloc);
|
|
1661
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1662
|
+
const ret = wasm.shape_edge_inset_at_line(ptr0, len0, width, height, side_code, line_offset);
|
|
1663
|
+
return ret;
|
|
1664
|
+
}
|
|
1665
|
+
|
|
1666
|
+
/**
|
|
1667
|
+
* @param {number} kind
|
|
1668
|
+
* @param {number} width
|
|
1669
|
+
* @param {number} height
|
|
1670
|
+
* @returns {Float64Array}
|
|
1671
|
+
*/
|
|
1672
|
+
export function shape_outline_commands(kind, width, height) {
|
|
1673
|
+
const ret = wasm.shape_outline_commands(kind, width, height);
|
|
1674
|
+
var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
1675
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1676
|
+
return v1;
|
|
1677
|
+
}
|
|
1678
|
+
|
|
1679
|
+
/**
|
|
1680
|
+
* `shape`: `[x, y, w, h]`.
|
|
1681
|
+
* @param {number} kind
|
|
1682
|
+
* @param {Float64Array} shape
|
|
1683
|
+
* @param {number} x
|
|
1684
|
+
* @param {number} y
|
|
1685
|
+
* @returns {number}
|
|
1686
|
+
*/
|
|
1687
|
+
export function shape_outline_depth(kind, shape, x, y) {
|
|
1688
|
+
const ptr0 = passArrayF64ToWasm0(shape, wasm.__wbindgen_malloc);
|
|
1689
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1690
|
+
const ret = wasm.shape_outline_depth(kind, ptr0, len0, x, y);
|
|
1691
|
+
return ret;
|
|
1692
|
+
}
|
|
1693
|
+
|
|
1694
|
+
/**
|
|
1695
|
+
* @param {number} kind
|
|
1696
|
+
* @param {number} width
|
|
1697
|
+
* @param {number} height
|
|
1698
|
+
* @returns {string}
|
|
1699
|
+
*/
|
|
1700
|
+
export function shape_path_data(kind, width, height) {
|
|
1701
|
+
let deferred1_0;
|
|
1702
|
+
let deferred1_1;
|
|
1703
|
+
try {
|
|
1704
|
+
const ret = wasm.shape_path_data(kind, width, height);
|
|
1705
|
+
deferred1_0 = ret[0];
|
|
1706
|
+
deferred1_1 = ret[1];
|
|
1707
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1708
|
+
} finally {
|
|
1709
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1710
|
+
}
|
|
1711
|
+
}
|
|
1712
|
+
|
|
1713
|
+
/**
|
|
1714
|
+
* Outline parts: 0 database, 1 queue, 2 document, 3 cloud, 4 person, 5 person head, 6 person body.
|
|
1715
|
+
* @param {number} part
|
|
1716
|
+
* @param {number} width
|
|
1717
|
+
* @param {number} height
|
|
1718
|
+
* @returns {Float64Array}
|
|
1719
|
+
*/
|
|
1720
|
+
export function shape_path_part(part, width, height) {
|
|
1721
|
+
const ret = wasm.shape_path_part(part, width, height);
|
|
1722
|
+
var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
1723
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1724
|
+
return v1;
|
|
1725
|
+
}
|
|
1726
|
+
|
|
1727
|
+
/**
|
|
1728
|
+
* @param {number} kind
|
|
1729
|
+
* @param {number} width
|
|
1730
|
+
* @param {number} height
|
|
1731
|
+
* @returns {Float64Array}
|
|
1732
|
+
*/
|
|
1733
|
+
export function shape_text_insets(kind, width, height) {
|
|
1734
|
+
const ret = wasm.shape_text_insets(kind, width, height);
|
|
1735
|
+
var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
1736
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1737
|
+
return v1;
|
|
1738
|
+
}
|
|
1739
|
+
|
|
1740
|
+
/**
|
|
1741
|
+
* @param {Float64Array} b
|
|
1742
|
+
* @param {number} x
|
|
1743
|
+
* @param {number} y
|
|
1744
|
+
* @returns {number}
|
|
1745
|
+
*/
|
|
1746
|
+
export function side_facing_point(b, x, y) {
|
|
1747
|
+
const ptr0 = passArrayF64ToWasm0(b, wasm.__wbindgen_malloc);
|
|
1748
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1749
|
+
const ret = wasm.side_facing_point(ptr0, len0, x, y);
|
|
1750
|
+
return ret;
|
|
1751
|
+
}
|
|
1752
|
+
|
|
1753
|
+
/**
|
|
1754
|
+
* `from * 4 + to`.
|
|
1755
|
+
* @param {Float64Array} two_boxes
|
|
1756
|
+
* @param {number} first_axis
|
|
1757
|
+
* @param {Float64Array} bends
|
|
1758
|
+
* @returns {number}
|
|
1759
|
+
*/
|
|
1760
|
+
export function sides_for_bends(two_boxes, first_axis, bends) {
|
|
1761
|
+
const ptr0 = passArrayF64ToWasm0(two_boxes, wasm.__wbindgen_malloc);
|
|
1762
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1763
|
+
const ptr1 = passArrayF64ToWasm0(bends, wasm.__wbindgen_malloc);
|
|
1764
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1765
|
+
const ret = wasm.sides_for_bends(ptr0, len0, first_axis, ptr1, len1);
|
|
1766
|
+
return ret;
|
|
1767
|
+
}
|
|
1768
|
+
|
|
1769
|
+
/**
|
|
1770
|
+
* @param {Float64Array} r
|
|
1771
|
+
* @param {Float64Array} g
|
|
1772
|
+
* @param {number} threshold
|
|
1773
|
+
* @param {boolean} snap_x
|
|
1774
|
+
* @param {boolean} snap_y
|
|
1775
|
+
* @returns {Float64Array}
|
|
1776
|
+
*/
|
|
1777
|
+
export function snap_rect_to_guides(r, g, threshold, snap_x, snap_y) {
|
|
1778
|
+
const ptr0 = passArrayF64ToWasm0(r, wasm.__wbindgen_malloc);
|
|
1779
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1780
|
+
const ptr1 = passArrayF64ToWasm0(g, wasm.__wbindgen_malloc);
|
|
1781
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1782
|
+
const ret = wasm.snap_rect_to_guides(ptr0, len0, ptr1, len1, threshold, snap_x, snap_y);
|
|
1783
|
+
var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
1784
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1785
|
+
return v3;
|
|
1786
|
+
}
|
|
1787
|
+
|
|
1788
|
+
/**
|
|
1789
|
+
* `held` 0 x, 1 y, 2 none.
|
|
1790
|
+
* @param {Float64Array} r
|
|
1791
|
+
* @param {Float64Array} g
|
|
1792
|
+
* @param {number} threshold
|
|
1793
|
+
* @param {number} held
|
|
1794
|
+
* @returns {Float64Array}
|
|
1795
|
+
*/
|
|
1796
|
+
export function snap_rect_to_guides_straight(r, g, threshold, held) {
|
|
1797
|
+
const ptr0 = passArrayF64ToWasm0(r, wasm.__wbindgen_malloc);
|
|
1798
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1799
|
+
const ptr1 = passArrayF64ToWasm0(g, wasm.__wbindgen_malloc);
|
|
1800
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1801
|
+
const ret = wasm.snap_rect_to_guides_straight(ptr0, len0, ptr1, len1, threshold, held);
|
|
1802
|
+
var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
1803
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1804
|
+
return v3;
|
|
1805
|
+
}
|
|
1806
|
+
|
|
1807
|
+
/**
|
|
1808
|
+
* @param {Float64Array} r
|
|
1809
|
+
* @param {number} edge_x
|
|
1810
|
+
* @param {number} edge_y
|
|
1811
|
+
* @param {number} dx
|
|
1812
|
+
* @param {number} dy
|
|
1813
|
+
* @param {Float64Array} g
|
|
1814
|
+
* @param {number} threshold
|
|
1815
|
+
* @returns {Float64Array}
|
|
1816
|
+
*/
|
|
1817
|
+
export function snap_resize_edges_to_guides(r, edge_x, edge_y, dx, dy, g, threshold) {
|
|
1818
|
+
const ptr0 = passArrayF64ToWasm0(r, wasm.__wbindgen_malloc);
|
|
1819
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1820
|
+
const ptr1 = passArrayF64ToWasm0(g, wasm.__wbindgen_malloc);
|
|
1821
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1822
|
+
const ret = wasm.snap_resize_edges_to_guides(ptr0, len0, edge_x, edge_y, dx, dy, ptr1, len1, threshold);
|
|
1823
|
+
var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
1824
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1825
|
+
return v3;
|
|
1826
|
+
}
|
|
1827
|
+
|
|
1828
|
+
/**
|
|
1829
|
+
* @param {number} degrees
|
|
1830
|
+
* @param {boolean} coarse
|
|
1831
|
+
* @returns {number}
|
|
1832
|
+
*/
|
|
1833
|
+
export function snap_rotation_degrees(degrees, coarse) {
|
|
1834
|
+
const ret = wasm.snap_rotation_degrees(degrees, coarse);
|
|
1835
|
+
return ret;
|
|
1836
|
+
}
|
|
1837
|
+
|
|
1838
|
+
/**
|
|
1839
|
+
* @param {number} x
|
|
1840
|
+
* @param {number} y
|
|
1841
|
+
* @param {Float64Array} pts
|
|
1842
|
+
* @param {number} width
|
|
1843
|
+
* @returns {Float64Array}
|
|
1844
|
+
*/
|
|
1845
|
+
export function stroke_bounds(x, y, pts, width) {
|
|
1846
|
+
const ptr0 = passArrayF64ToWasm0(pts, wasm.__wbindgen_malloc);
|
|
1847
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1848
|
+
const ret = wasm.stroke_bounds(x, y, ptr0, len0, width);
|
|
1849
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
1850
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1851
|
+
return v2;
|
|
1852
|
+
}
|
|
1853
|
+
|
|
1854
|
+
/**
|
|
1855
|
+
* `line`: `[x1, y1, x2, y2]`; `elbow` empty for a straight line (with
|
|
1856
|
+
* `has_elbow` false); `texts`: `[x, y, w, h, fromMayHold, toMayHold]` each.
|
|
1857
|
+
* @param {Float64Array} line
|
|
1858
|
+
* @param {boolean} has_elbow
|
|
1859
|
+
* @param {Float64Array} elbow
|
|
1860
|
+
* @param {Float64Array} polyline
|
|
1861
|
+
* @param {Float64Array} texts
|
|
1862
|
+
* @returns {Uint32Array}
|
|
1863
|
+
*/
|
|
1864
|
+
export function text_boxes_crossed_by_arrow(line, has_elbow, elbow, polyline, texts) {
|
|
1865
|
+
const ptr0 = passArrayF64ToWasm0(line, wasm.__wbindgen_malloc);
|
|
1866
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1867
|
+
const ptr1 = passArrayF64ToWasm0(elbow, wasm.__wbindgen_malloc);
|
|
1868
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1869
|
+
const ptr2 = passArrayF64ToWasm0(polyline, wasm.__wbindgen_malloc);
|
|
1870
|
+
const len2 = WASM_VECTOR_LEN;
|
|
1871
|
+
const ptr3 = passArrayF64ToWasm0(texts, wasm.__wbindgen_malloc);
|
|
1872
|
+
const len3 = WASM_VECTOR_LEN;
|
|
1873
|
+
const ret = wasm.text_boxes_crossed_by_arrow(ptr0, len0, has_elbow, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
1874
|
+
var v5 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
|
|
1875
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
1876
|
+
return v5;
|
|
1877
|
+
}
|
|
1878
|
+
|
|
1879
|
+
/**
|
|
1880
|
+
* The index of the topmost element under the point, or -1.
|
|
1881
|
+
* @param {Float64Array} recs
|
|
1882
|
+
* @param {number} x
|
|
1883
|
+
* @param {number} y
|
|
1884
|
+
* @param {number} tolerance
|
|
1885
|
+
* @returns {number}
|
|
1886
|
+
*/
|
|
1887
|
+
export function top_element_at(recs, x, y, tolerance) {
|
|
1888
|
+
const ptr0 = passArrayF64ToWasm0(recs, wasm.__wbindgen_malloc);
|
|
1889
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1890
|
+
const ret = wasm.top_element_at(ptr0, len0, x, y, tolerance);
|
|
1891
|
+
return ret;
|
|
1892
|
+
}
|
|
1893
|
+
|
|
1894
|
+
/**
|
|
1895
|
+
* `[x, y, w, h]`, or `[]` for no boxes.
|
|
1896
|
+
* @param {Float64Array} boxes
|
|
1897
|
+
* @returns {Float64Array}
|
|
1898
|
+
*/
|
|
1899
|
+
export function union_bounds(boxes) {
|
|
1900
|
+
const ptr0 = passArrayF64ToWasm0(boxes, wasm.__wbindgen_malloc);
|
|
1901
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1902
|
+
const ret = wasm.union_bounds(ptr0, len0);
|
|
1903
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
1904
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1905
|
+
return v2;
|
|
1906
|
+
}
|
|
1907
|
+
|
|
1908
|
+
/**
|
|
1909
|
+
* Segments as `[x1, y1, x2, y2, …]`.
|
|
1910
|
+
* @param {Float64Array} cmds
|
|
1911
|
+
* @returns {Float64Array}
|
|
1912
|
+
*/
|
|
1913
|
+
export function walk_path_segments(cmds) {
|
|
1914
|
+
const ptr0 = passArrayF64ToWasm0(cmds, wasm.__wbindgen_malloc);
|
|
1915
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1916
|
+
const ret = wasm.walk_path_segments(ptr0, len0);
|
|
1917
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
1918
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1919
|
+
return v2;
|
|
1920
|
+
}
|
|
1921
|
+
|
|
1922
|
+
/**
|
|
1923
|
+
* Lines as `(start, end, w)`.
|
|
1924
|
+
* @param {number} word_count
|
|
1925
|
+
* @param {Float64Array} widths
|
|
1926
|
+
* @param {number} space
|
|
1927
|
+
* @param {number} max_width
|
|
1928
|
+
* @returns {Float64Array}
|
|
1929
|
+
*/
|
|
1930
|
+
export function wrap_label_words(word_count, widths, space, max_width) {
|
|
1931
|
+
const ptr0 = passArrayF64ToWasm0(widths, wasm.__wbindgen_malloc);
|
|
1932
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1933
|
+
const ret = wasm.wrap_label_words(word_count, ptr0, len0, space, max_width);
|
|
1934
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
1935
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1936
|
+
return v2;
|
|
1937
|
+
}
|
|
1938
|
+
|
|
1939
|
+
/**
|
|
1940
|
+
* `[x, y, zoom]`, or `[]` when the zoom stays.
|
|
1941
|
+
* @param {Float64Array} cam
|
|
1942
|
+
* @param {number} screen_x
|
|
1943
|
+
* @param {number} screen_y
|
|
1944
|
+
* @param {number} factor
|
|
1945
|
+
* @returns {Float64Array}
|
|
1946
|
+
*/
|
|
1947
|
+
export function zoom_camera_at(cam, screen_x, screen_y, factor) {
|
|
1948
|
+
const ptr0 = passArrayF64ToWasm0(cam, wasm.__wbindgen_malloc);
|
|
1949
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1950
|
+
const ret = wasm.zoom_camera_at(ptr0, len0, screen_x, screen_y, factor);
|
|
1951
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
1952
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1953
|
+
return v2;
|
|
1954
|
+
}
|
|
1955
|
+
|
|
1956
|
+
function __wbg_get_imports() {
|
|
1957
|
+
const import0 = {
|
|
1958
|
+
__proto__: null,
|
|
1959
|
+
__wbg___wbindgen_throw_81fc77679af83bc6: function(arg0, arg1) {
|
|
1960
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
1961
|
+
},
|
|
1962
|
+
__wbindgen_init_externref_table: function() {
|
|
1963
|
+
const table = wasm.__wbindgen_externrefs;
|
|
1964
|
+
const offset = table.grow(4);
|
|
1965
|
+
table.set(0, undefined);
|
|
1966
|
+
table.set(offset + 0, undefined);
|
|
1967
|
+
table.set(offset + 1, null);
|
|
1968
|
+
table.set(offset + 2, true);
|
|
1969
|
+
table.set(offset + 3, false);
|
|
1970
|
+
},
|
|
1971
|
+
};
|
|
1972
|
+
return {
|
|
1973
|
+
__proto__: null,
|
|
1974
|
+
"./open_artifact_wb_geom_bg.js": import0,
|
|
1975
|
+
};
|
|
1976
|
+
}
|
|
1977
|
+
|
|
1978
|
+
const GeomBoardFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1979
|
+
? { register: () => {}, unregister: () => {} }
|
|
1980
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_geomboard_free(ptr >>> 0, 1));
|
|
1981
|
+
const OccupancyGridFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1982
|
+
? { register: () => {}, unregister: () => {} }
|
|
1983
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_occupancygrid_free(ptr >>> 0, 1));
|
|
1984
|
+
|
|
1985
|
+
function _assertClass(instance, klass) {
|
|
1986
|
+
if (!(instance instanceof klass)) {
|
|
1987
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
1988
|
+
}
|
|
1989
|
+
}
|
|
1990
|
+
|
|
1991
|
+
function getArrayF64FromWasm0(ptr, len) {
|
|
1992
|
+
ptr = ptr >>> 0;
|
|
1993
|
+
return getFloat64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
|
|
1994
|
+
}
|
|
1995
|
+
|
|
1996
|
+
function getArrayU32FromWasm0(ptr, len) {
|
|
1997
|
+
ptr = ptr >>> 0;
|
|
1998
|
+
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
1999
|
+
}
|
|
2000
|
+
|
|
2001
|
+
let cachedFloat64ArrayMemory0 = null;
|
|
2002
|
+
function getFloat64ArrayMemory0() {
|
|
2003
|
+
if (cachedFloat64ArrayMemory0 === null || cachedFloat64ArrayMemory0.byteLength === 0) {
|
|
2004
|
+
cachedFloat64ArrayMemory0 = new Float64Array(wasm.memory.buffer);
|
|
2005
|
+
}
|
|
2006
|
+
return cachedFloat64ArrayMemory0;
|
|
2007
|
+
}
|
|
2008
|
+
|
|
2009
|
+
function getStringFromWasm0(ptr, len) {
|
|
2010
|
+
ptr = ptr >>> 0;
|
|
2011
|
+
return decodeText(ptr, len);
|
|
2012
|
+
}
|
|
2013
|
+
|
|
2014
|
+
let cachedUint16ArrayMemory0 = null;
|
|
2015
|
+
function getUint16ArrayMemory0() {
|
|
2016
|
+
if (cachedUint16ArrayMemory0 === null || cachedUint16ArrayMemory0.byteLength === 0) {
|
|
2017
|
+
cachedUint16ArrayMemory0 = new Uint16Array(wasm.memory.buffer);
|
|
2018
|
+
}
|
|
2019
|
+
return cachedUint16ArrayMemory0;
|
|
2020
|
+
}
|
|
2021
|
+
|
|
2022
|
+
let cachedUint32ArrayMemory0 = null;
|
|
2023
|
+
function getUint32ArrayMemory0() {
|
|
2024
|
+
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
2025
|
+
cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
|
|
2026
|
+
}
|
|
2027
|
+
return cachedUint32ArrayMemory0;
|
|
2028
|
+
}
|
|
2029
|
+
|
|
2030
|
+
let cachedUint8ArrayMemory0 = null;
|
|
2031
|
+
function getUint8ArrayMemory0() {
|
|
2032
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
2033
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
2034
|
+
}
|
|
2035
|
+
return cachedUint8ArrayMemory0;
|
|
2036
|
+
}
|
|
2037
|
+
|
|
2038
|
+
function passArray16ToWasm0(arg, malloc) {
|
|
2039
|
+
const ptr = malloc(arg.length * 2, 2) >>> 0;
|
|
2040
|
+
getUint16ArrayMemory0().set(arg, ptr / 2);
|
|
2041
|
+
WASM_VECTOR_LEN = arg.length;
|
|
2042
|
+
return ptr;
|
|
2043
|
+
}
|
|
2044
|
+
|
|
2045
|
+
function passArray32ToWasm0(arg, malloc) {
|
|
2046
|
+
const ptr = malloc(arg.length * 4, 4) >>> 0;
|
|
2047
|
+
getUint32ArrayMemory0().set(arg, ptr / 4);
|
|
2048
|
+
WASM_VECTOR_LEN = arg.length;
|
|
2049
|
+
return ptr;
|
|
2050
|
+
}
|
|
2051
|
+
|
|
2052
|
+
function passArrayF64ToWasm0(arg, malloc) {
|
|
2053
|
+
const ptr = malloc(arg.length * 8, 8) >>> 0;
|
|
2054
|
+
getFloat64ArrayMemory0().set(arg, ptr / 8);
|
|
2055
|
+
WASM_VECTOR_LEN = arg.length;
|
|
2056
|
+
return ptr;
|
|
2057
|
+
}
|
|
2058
|
+
|
|
2059
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
2060
|
+
cachedTextDecoder.decode();
|
|
2061
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
2062
|
+
let numBytesDecoded = 0;
|
|
2063
|
+
function decodeText(ptr, len) {
|
|
2064
|
+
numBytesDecoded += len;
|
|
2065
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
2066
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
2067
|
+
cachedTextDecoder.decode();
|
|
2068
|
+
numBytesDecoded = len;
|
|
2069
|
+
}
|
|
2070
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
2071
|
+
}
|
|
2072
|
+
|
|
2073
|
+
let WASM_VECTOR_LEN = 0;
|
|
2074
|
+
|
|
2075
|
+
let wasmModule, wasm;
|
|
2076
|
+
function __wbg_finalize_init(instance, module) {
|
|
2077
|
+
wasm = instance.exports;
|
|
2078
|
+
wasmModule = module;
|
|
2079
|
+
cachedFloat64ArrayMemory0 = null;
|
|
2080
|
+
cachedUint16ArrayMemory0 = null;
|
|
2081
|
+
cachedUint32ArrayMemory0 = null;
|
|
2082
|
+
cachedUint8ArrayMemory0 = null;
|
|
2083
|
+
wasm.__wbindgen_start();
|
|
2084
|
+
return wasm;
|
|
2085
|
+
}
|
|
2086
|
+
|
|
2087
|
+
async function __wbg_load(module, imports) {
|
|
2088
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
2089
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
2090
|
+
try {
|
|
2091
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
2092
|
+
} catch (e) {
|
|
2093
|
+
const validResponse = module.ok && expectedResponseType(module.type);
|
|
2094
|
+
|
|
2095
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
2096
|
+
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
|
2097
|
+
|
|
2098
|
+
} else { throw e; }
|
|
2099
|
+
}
|
|
2100
|
+
}
|
|
2101
|
+
|
|
2102
|
+
const bytes = await module.arrayBuffer();
|
|
2103
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
2104
|
+
} else {
|
|
2105
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
2106
|
+
|
|
2107
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
2108
|
+
return { instance, module };
|
|
2109
|
+
} else {
|
|
2110
|
+
return instance;
|
|
2111
|
+
}
|
|
2112
|
+
}
|
|
2113
|
+
|
|
2114
|
+
function expectedResponseType(type) {
|
|
2115
|
+
switch (type) {
|
|
2116
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
2117
|
+
}
|
|
2118
|
+
return false;
|
|
2119
|
+
}
|
|
2120
|
+
}
|
|
2121
|
+
|
|
2122
|
+
function initSync(module) {
|
|
2123
|
+
if (wasm !== undefined) return wasm;
|
|
2124
|
+
|
|
2125
|
+
|
|
2126
|
+
if (module !== undefined) {
|
|
2127
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
2128
|
+
({module} = module)
|
|
2129
|
+
} else {
|
|
2130
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
2131
|
+
}
|
|
2132
|
+
}
|
|
2133
|
+
|
|
2134
|
+
const imports = __wbg_get_imports();
|
|
2135
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
2136
|
+
module = new WebAssembly.Module(module);
|
|
2137
|
+
}
|
|
2138
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
2139
|
+
return __wbg_finalize_init(instance, module);
|
|
2140
|
+
}
|
|
2141
|
+
|
|
2142
|
+
async function __wbg_init(module_or_path) {
|
|
2143
|
+
if (wasm !== undefined) return wasm;
|
|
2144
|
+
|
|
2145
|
+
|
|
2146
|
+
if (module_or_path !== undefined) {
|
|
2147
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
2148
|
+
({module_or_path} = module_or_path)
|
|
2149
|
+
} else {
|
|
2150
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
2151
|
+
}
|
|
2152
|
+
}
|
|
2153
|
+
|
|
2154
|
+
|
|
2155
|
+
const imports = __wbg_get_imports();
|
|
2156
|
+
|
|
2157
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
2158
|
+
module_or_path = fetch(module_or_path);
|
|
2159
|
+
}
|
|
2160
|
+
|
|
2161
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
2162
|
+
|
|
2163
|
+
return __wbg_finalize_init(instance, module);
|
|
2164
|
+
}
|
|
2165
|
+
|
|
2166
|
+
export { initSync, __wbg_init as default };
|