@threepipe/plugin-svg-renderer 0.2.0 → 0.2.2
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/dist/BasicSVGRendererPlugin.d.ts +2 -2
- package/dist/BasicSVGRendererPlugin.d.ts.map +1 -1
- package/dist/ThreeSVGRendererPlugin.d.ts +2 -2
- package/dist/ThreeSVGRendererPlugin.d.ts.map +1 -1
- package/dist/basic/BasicSVGRenderer.d.ts.map +1 -1
- package/dist/dependencies.txt +5 -13
- package/dist/index.js +540 -875
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +551 -886
- package/dist/index.mjs.map +1 -1
- package/dist/three-mesh-halfedge/core/Vertex.d.ts +1 -1
- package/dist/three-mesh-halfedge/operations/addEdge.d.ts +3 -3
- package/dist/three-mesh-halfedge/operations/addFace.d.ts +3 -3
- package/dist/three-mesh-halfedge/operations/addVertex.d.ts +2 -2
- package/dist/three-mesh-halfedge/operations/cutFace.d.ts +4 -4
- package/dist/three-mesh-halfedge/operations/removeEdge.d.ts +2 -2
- package/dist/three-mesh-halfedge/operations/removeFace.d.ts +2 -2
- package/dist/three-mesh-halfedge/operations/removeVertex.d.ts +2 -2
- package/dist/three-mesh-halfedge/operations/setFromGeometry.d.ts +1 -1
- package/dist/three-mesh-halfedge/operations/splitEdge.d.ts +3 -3
- package/dist/three-svg-renderer/SVGRenderer.d.ts +0 -1
- package/dist/three-svg-renderer/SVGRenderer.d.ts.map +1 -1
- package/dist/three-svg-renderer/core/SVGMesh.d.ts +10 -3
- package/dist/three-svg-renderer/core/SVGMesh.d.ts.map +1 -1
- package/dist/three-svg-renderer/core/index.d.ts +3 -3
- package/dist/three-svg-renderer/core/svg/passes/ChainPass.d.ts +0 -1
- package/dist/three-svg-renderer/core/svg/passes/ChainPass.d.ts.map +1 -1
- package/dist/three-svg-renderer/core/svg/passes/DrawPass.d.ts +0 -1
- package/dist/three-svg-renderer/core/svg/passes/DrawPass.d.ts.map +1 -1
- package/dist/three-svg-renderer/core/svg/passes/FillPass.d.ts +0 -1
- package/dist/three-svg-renderer/core/svg/passes/FillPass.d.ts.map +1 -1
- package/dist/three-svg-renderer/core/svg/passes/SingularityPointPass.d.ts +0 -1
- package/dist/three-svg-renderer/core/svg/passes/SingularityPointPass.d.ts.map +1 -1
- package/dist/three-svg-renderer/core/svg/passes/index.d.ts +4 -4
- package/dist/three-svg-renderer/core/svg/svgutils.d.ts +0 -1
- package/dist/three-svg-renderer/core/svg/svgutils.d.ts.map +1 -1
- package/dist/three-svg-renderer/core/viewmap/Chain.d.ts +1 -1
- package/dist/three-svg-renderer/core/viewmap/ViewVertex.d.ts +2 -2
- package/dist/three-svg-renderer/core/viewmap/Viewmap.d.ts +1 -1
- package/dist/three-svg-renderer/core/viewmap/Viewmap.d.ts.map +1 -1
- package/dist/three-svg-renderer/core/viewmap/operations/assignPolygons.d.ts +1 -1
- package/dist/three-svg-renderer/core/viewmap/operations/computeChainsVisibility.d.ts +2 -2
- package/dist/three-svg-renderer/core/viewmap/operations/computeMeshIntersections.d.ts +2 -2
- package/dist/three-svg-renderer/core/viewmap/operations/computePolygons.d.ts +1 -1
- package/dist/three-svg-renderer/core/viewmap/operations/createChains.d.ts +4 -4
- package/dist/three-svg-renderer/core/viewmap/operations/createViewVertex.d.ts +2 -2
- package/dist/three-svg-renderer/core/viewmap/operations/find2dSingularities.d.ts +1 -1
- package/dist/three-svg-renderer/core/viewmap/operations/find3dSingularities.d.ts +4 -4
- package/dist/three-svg-renderer/core/viewmap/operations/meshIntersectionCb.d.ts +2 -2
- package/dist/three-svg-renderer/core/viewmap/operations/setupEdges.d.ts +3 -3
- package/dist/three-svg-renderer/core/viewmap/operations/splitEdge.d.ts +3 -3
- package/dist/three-svg-renderer/index.d.ts +1 -1
- package/dist/three-svg-renderer/utils/buffergeometry.d.ts +1 -1
- package/dist/three-svg-renderer/utils/buffergeometry.d.ts.map +1 -1
- package/package.json +14 -3
- package/src/BasicSVGRendererPlugin.ts +1 -1
- package/src/ThreeSVGRendererPlugin.ts +4 -4
- package/src/basic/BasicSVGRenderer.ts +4 -4
- package/src/three-svg-renderer/core/SVGMesh.ts +17 -1
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* @threepipe/plugin-svg-renderer v0.2.
|
|
4
|
-
* Copyright 2022-
|
|
3
|
+
* @threepipe/plugin-svg-renderer v0.2.2
|
|
4
|
+
* Copyright 2022-2025 repalash <palash@shaders.app>
|
|
5
5
|
* GPLV3 License
|
|
6
6
|
* See ./dependencies.txt for any bundled third-party dependencies and licenses.
|
|
7
7
|
*/
|
|
8
|
-
import { Vector3, Color as Color$1, Vector2, Vector4, Box3, Matrix4, Frustum, Matrix3, DoubleSide, Box2,
|
|
8
|
+
import { Vector3, Color as Color$1, Vector2, Vector4, Box3, Matrix4, Frustum, Matrix3, DoubleSide, Box2, Camera, uiToggle as uiToggle$1, uiConfig as uiConfig$1, uiButton, uiFolderContainer as uiFolderContainer$1, AViewerPluginSync, computeMorphedAttributes, Triangle, BufferAttribute, Plane, Line3 as Line3$1, Sphere, BackSide, FrontSide, Mesh, Ray, onChange, uiVector, timeout } from "threepipe";
|
|
9
9
|
import { Vector3 as Vector3$1, Matrix4 as Matrix4$1, Vector2 as Vector2$1, Color as Color$2, Raycaster, DoubleSide as DoubleSide$1, Line3, PerspectiveCamera, Box2 as Box2$1, Triangle as Triangle$1, Mesh as Mesh$1 } from "threepipe";
|
|
10
10
|
class RenderableObject {
|
|
11
11
|
constructor() {
|
|
@@ -111,8 +111,7 @@ class Projector {
|
|
|
111
111
|
uvs.push(x2, y2);
|
|
112
112
|
}
|
|
113
113
|
function checkTriangleVisibility(v1, v2, v3) {
|
|
114
|
-
if (v1.visible === true || v2.visible === true || v3.visible === true)
|
|
115
|
-
return true;
|
|
114
|
+
if (v1.visible === true || v2.visible === true || v3.visible === true) return true;
|
|
116
115
|
_points3[0] = v1.positionScreen;
|
|
117
116
|
_points3[1] = v2.positionScreen;
|
|
118
117
|
_points3[2] = v3.positionScreen;
|
|
@@ -147,8 +146,7 @@ class Projector {
|
|
|
147
146
|
const v1 = _vertexPool[a];
|
|
148
147
|
const v2 = _vertexPool[b];
|
|
149
148
|
const v3 = _vertexPool[c];
|
|
150
|
-
if (checkTriangleVisibility(v1, v2, v3) === false)
|
|
151
|
-
return;
|
|
149
|
+
if (checkTriangleVisibility(v1, v2, v3) === false) return;
|
|
152
150
|
if (material.side === DoubleSide || checkBackfaceCulling(v1, v2, v3) === true) {
|
|
153
151
|
_face = getNextFaceInPool();
|
|
154
152
|
_face.id = object.id;
|
|
@@ -192,21 +190,16 @@ class Projector {
|
|
|
192
190
|
}
|
|
193
191
|
const renderList = new RenderList();
|
|
194
192
|
function projectObject(object) {
|
|
195
|
-
if (object.visible === false)
|
|
196
|
-
return;
|
|
193
|
+
if (object.visible === false) return;
|
|
197
194
|
if (object.isLight) {
|
|
198
195
|
_renderData.lights.push(object);
|
|
199
196
|
} else if (object.isMesh || object.isLine || object.isPoints) {
|
|
200
|
-
if (object.material.visible === false)
|
|
201
|
-
|
|
202
|
-
if (object.frustumCulled === true && _frustum.intersectsObject(object) === false)
|
|
203
|
-
return;
|
|
197
|
+
if (object.material.visible === false) return;
|
|
198
|
+
if (object.frustumCulled === true && _frustum.intersectsObject(object) === false) return;
|
|
204
199
|
addObject(object);
|
|
205
200
|
} else if (object.isSprite) {
|
|
206
|
-
if (object.material.visible === false)
|
|
207
|
-
|
|
208
|
-
if (object.frustumCulled === true && _frustum.intersectsSprite(object) === false)
|
|
209
|
-
return;
|
|
201
|
+
if (object.material.visible === false) return;
|
|
202
|
+
if (object.frustumCulled === true && _frustum.intersectsSprite(object) === false) return;
|
|
210
203
|
addObject(object);
|
|
211
204
|
}
|
|
212
205
|
const children = object.children;
|
|
@@ -229,10 +222,8 @@ class Projector {
|
|
|
229
222
|
_lineCount = 0;
|
|
230
223
|
_spriteCount = 0;
|
|
231
224
|
_renderData.elements.length = 0;
|
|
232
|
-
if (scene.matrixWorldAutoUpdate === true)
|
|
233
|
-
|
|
234
|
-
if (camera.parent === null && camera.matrixWorldAutoUpdate === true)
|
|
235
|
-
camera.updateMatrixWorld();
|
|
225
|
+
if (scene.matrixWorldAutoUpdate === true) scene.updateMatrixWorld();
|
|
226
|
+
if (camera.parent === null && camera.matrixWorldAutoUpdate === true) camera.updateMatrixWorld();
|
|
236
227
|
_viewMatrix.copy(camera.matrixWorldInverse);
|
|
237
228
|
_viewProjectionMatrix.multiplyMatrices(camera.projectionMatrix, _viewMatrix);
|
|
238
229
|
_frustum.setFromProjectionMatrix(_viewProjectionMatrix);
|
|
@@ -255,8 +246,7 @@ class Projector {
|
|
|
255
246
|
const isMultiMaterial = Array.isArray(material);
|
|
256
247
|
const attributes = geometry.attributes;
|
|
257
248
|
const groups = geometry.groups;
|
|
258
|
-
if (attributes.position === void 0)
|
|
259
|
-
continue;
|
|
249
|
+
if (attributes.position === void 0) continue;
|
|
260
250
|
const positions = attributes.position.array;
|
|
261
251
|
for (let i = 0, l = positions.length; i < l; i += 3) {
|
|
262
252
|
let x2 = positions[i];
|
|
@@ -268,8 +258,7 @@ class Projector {
|
|
|
268
258
|
const morphInfluences = object.morphTargetInfluences;
|
|
269
259
|
for (let t = 0, tl = morphTargets.length; t < tl; t++) {
|
|
270
260
|
const influence = morphInfluences[t];
|
|
271
|
-
if (influence === 0)
|
|
272
|
-
continue;
|
|
261
|
+
if (influence === 0) continue;
|
|
273
262
|
const target = morphTargets[t];
|
|
274
263
|
if (morphTargetsRelative) {
|
|
275
264
|
x2 += target.getX(i / 3) * influence;
|
|
@@ -308,8 +297,7 @@ class Projector {
|
|
|
308
297
|
for (let g = 0; g < groups.length; g++) {
|
|
309
298
|
const group = groups[g];
|
|
310
299
|
material = isMultiMaterial === true ? object.material[group.materialIndex] : object.material;
|
|
311
|
-
if (material === void 0)
|
|
312
|
-
continue;
|
|
300
|
+
if (material === void 0) continue;
|
|
313
301
|
for (let i = group.start, l = group.start + group.count; i < l; i += 3) {
|
|
314
302
|
renderList.pushTriangle(indices[i], indices[i + 1], indices[i + 2], material);
|
|
315
303
|
}
|
|
@@ -324,8 +312,7 @@ class Projector {
|
|
|
324
312
|
for (let g = 0; g < groups.length; g++) {
|
|
325
313
|
const group = groups[g];
|
|
326
314
|
material = isMultiMaterial === true ? object.material[group.materialIndex] : object.material;
|
|
327
|
-
if (material === void 0)
|
|
328
|
-
continue;
|
|
315
|
+
if (material === void 0) continue;
|
|
329
316
|
for (let i = group.start, l = group.start + group.count; i < l; i += 3) {
|
|
330
317
|
renderList.pushTriangle(i, i + 1, i + 2, material);
|
|
331
318
|
}
|
|
@@ -502,7 +489,6 @@ let SVGRenderer$1 = class SVGRenderer {
|
|
|
502
489
|
this.sortObjects = true;
|
|
503
490
|
this.sortElements = true;
|
|
504
491
|
this.overdraw = 0.5;
|
|
505
|
-
this.outputColorSpace = SRGBColorSpace;
|
|
506
492
|
this.info = {
|
|
507
493
|
render: {
|
|
508
494
|
vertices: 0,
|
|
@@ -555,7 +541,7 @@ let SVGRenderer$1 = class SVGRenderer {
|
|
|
555
541
|
}
|
|
556
542
|
this.clear = function() {
|
|
557
543
|
removeChildNodes();
|
|
558
|
-
_svg.style.backgroundColor = _clearColor.getStyle(
|
|
544
|
+
_svg.style.backgroundColor = _clearColor.getStyle();
|
|
559
545
|
};
|
|
560
546
|
this.render = function(scene, camera) {
|
|
561
547
|
if (camera instanceof Camera === false) {
|
|
@@ -565,7 +551,7 @@ let SVGRenderer$1 = class SVGRenderer {
|
|
|
565
551
|
const background = scene.background;
|
|
566
552
|
if (background && background.isColor) {
|
|
567
553
|
removeChildNodes();
|
|
568
|
-
_svg.style.backgroundColor = background.getStyle(
|
|
554
|
+
_svg.style.backgroundColor = background.getStyle();
|
|
569
555
|
} else if (this.autoClear === true) {
|
|
570
556
|
this.clear();
|
|
571
557
|
}
|
|
@@ -583,8 +569,7 @@ let SVGRenderer$1 = class SVGRenderer {
|
|
|
583
569
|
for (let e = 0, el = _elements.length; e < el; e++) {
|
|
584
570
|
const element = _elements[e];
|
|
585
571
|
const material = element.material;
|
|
586
|
-
if (material === void 0 || material.opacity === 0)
|
|
587
|
-
continue;
|
|
572
|
+
if (material === void 0 || material.opacity === 0) continue;
|
|
588
573
|
_elemBox.makeEmpty();
|
|
589
574
|
if (element instanceof RenderableSprite) {
|
|
590
575
|
_v1 = element;
|
|
@@ -606,12 +591,9 @@ let SVGRenderer$1 = class SVGRenderer {
|
|
|
606
591
|
_v1 = element.v1;
|
|
607
592
|
_v22 = element.v2;
|
|
608
593
|
_v3 = element.v3;
|
|
609
|
-
if (_v1.positionScreen.z < -1 || _v1.positionScreen.z > 1)
|
|
610
|
-
|
|
611
|
-
if (
|
|
612
|
-
continue;
|
|
613
|
-
if (_v3.positionScreen.z < -1 || _v3.positionScreen.z > 1)
|
|
614
|
-
continue;
|
|
594
|
+
if (_v1.positionScreen.z < -1 || _v1.positionScreen.z > 1) continue;
|
|
595
|
+
if (_v22.positionScreen.z < -1 || _v22.positionScreen.z > 1) continue;
|
|
596
|
+
if (_v3.positionScreen.z < -1 || _v3.positionScreen.z > 1) continue;
|
|
615
597
|
_v1.positionScreen.x *= _svgWidthHalf;
|
|
616
598
|
_v1.positionScreen.y *= -_svgHeightHalf;
|
|
617
599
|
_v22.positionScreen.x *= _svgWidthHalf;
|
|
@@ -638,8 +620,7 @@ let SVGRenderer$1 = class SVGRenderer {
|
|
|
638
620
|
if (object.isSVGObject) {
|
|
639
621
|
_vector3.setFromMatrixPosition(object.matrixWorld);
|
|
640
622
|
_vector3.applyMatrix4(_viewProjectionMatrix);
|
|
641
|
-
if (_vector3.z < -1 || _vector3.z > 1)
|
|
642
|
-
return;
|
|
623
|
+
if (_vector3.z < -1 || _vector3.z > 1) return;
|
|
643
624
|
const x2 = _vector3.x * _svgWidthHalf;
|
|
644
625
|
const y2 = -_vector3.y * _svgHeightHalf;
|
|
645
626
|
const node = object.node;
|
|
@@ -675,10 +656,9 @@ let SVGRenderer$1 = class SVGRenderer {
|
|
|
675
656
|
const light = lights[l];
|
|
676
657
|
const lightColor = light.color;
|
|
677
658
|
if (light.isDirectionalLight) {
|
|
678
|
-
const lightPosition = _vector3.setFromMatrixPosition(light.matrixWorld).normalize();
|
|
659
|
+
const lightPosition = _vector3.setFromMatrixPosition(light.matrixWorld).sub(_normal2.setFromMatrixPosition(light.target.matrixWorld)).normalize();
|
|
679
660
|
let amount = normal.dot(lightPosition);
|
|
680
|
-
if (amount <= 0)
|
|
681
|
-
continue;
|
|
661
|
+
if (amount <= 0) continue;
|
|
682
662
|
amount *= light.intensity;
|
|
683
663
|
color.r += lightColor.r * amount;
|
|
684
664
|
color.g += lightColor.g * amount;
|
|
@@ -686,11 +666,9 @@ let SVGRenderer$1 = class SVGRenderer {
|
|
|
686
666
|
} else if (light.isPointLight) {
|
|
687
667
|
const lightPosition = _vector3.setFromMatrixPosition(light.matrixWorld);
|
|
688
668
|
let amount = normal.dot(_vector3.subVectors(lightPosition, position2).normalize());
|
|
689
|
-
if (amount <= 0)
|
|
690
|
-
continue;
|
|
669
|
+
if (amount <= 0) continue;
|
|
691
670
|
amount *= light.distance == 0 ? 1 : 1 - Math.min(position2.distanceTo(lightPosition) / light.distance, 1);
|
|
692
|
-
if (amount == 0)
|
|
693
|
-
continue;
|
|
671
|
+
if (amount == 0) continue;
|
|
694
672
|
amount *= light.intensity;
|
|
695
673
|
color.r += lightColor.r * amount;
|
|
696
674
|
color.g += lightColor.g * amount;
|
|
@@ -708,14 +686,14 @@ let SVGRenderer$1 = class SVGRenderer {
|
|
|
708
686
|
const path = "M" + convert(v1.x - scaleX * 0.5) + "," + convert(v1.y - scaleY * 0.5) + "h" + convert(scaleX) + "v" + convert(scaleY) + "h" + convert(-scaleX) + "z";
|
|
709
687
|
let style = "";
|
|
710
688
|
if (material.isSpriteMaterial || material.isPointsMaterial) {
|
|
711
|
-
style = "fill:" + material.color.getStyle(
|
|
689
|
+
style = "fill:" + material.color.getStyle() + ";fill-opacity:" + material.opacity;
|
|
712
690
|
}
|
|
713
691
|
addPath(style, path);
|
|
714
692
|
}
|
|
715
693
|
function renderLine(v1, v2, material) {
|
|
716
694
|
const path = "M" + convert(v1.positionScreen.x) + "," + convert(v1.positionScreen.y) + "L" + convert(v2.positionScreen.x) + "," + convert(v2.positionScreen.y);
|
|
717
695
|
if (material.isLineBasicMaterial) {
|
|
718
|
-
let style = "fill:none;stroke:" + material.color.getStyle(
|
|
696
|
+
let style = "fill:none;stroke:" + material.color.getStyle() + ";stroke-opacity:" + material.opacity + ";stroke-width:" + material.linewidth + ";stroke-linecap:" + material.linecap;
|
|
719
697
|
if (material.isLineDashedMaterial) {
|
|
720
698
|
style = style + ";stroke-dasharray:" + material.dashSize + "," + material.gapSize;
|
|
721
699
|
}
|
|
@@ -746,17 +724,16 @@ let SVGRenderer$1 = class SVGRenderer {
|
|
|
746
724
|
_color2.setRGB(_normal2.x, _normal2.y, _normal2.z).multiplyScalar(0.5).addScalar(0.5);
|
|
747
725
|
}
|
|
748
726
|
if (material.wireframe) {
|
|
749
|
-
style = "fill:none;stroke:" + _color2.getStyle(
|
|
727
|
+
style = "fill:none;stroke:" + _color2.getStyle() + ";stroke-opacity:" + material.opacity + ";stroke-width:" + material.wireframeLinewidth + ";stroke-linecap:" + material.wireframeLinecap + ";stroke-linejoin:" + material.wireframeLinejoin;
|
|
750
728
|
} else {
|
|
751
|
-
style = "fill:" + _color2.getStyle(
|
|
729
|
+
style = "fill:" + _color2.getStyle() + ";fill-opacity:" + material.opacity;
|
|
752
730
|
}
|
|
753
731
|
addPath(style, path);
|
|
754
732
|
}
|
|
755
733
|
function expand(v1, v2, pixels) {
|
|
756
734
|
let x2 = v2.x - v1.x, y2 = v2.y - v1.y;
|
|
757
735
|
const det = x2 * x2 + y2 * y2;
|
|
758
|
-
if (det === 0)
|
|
759
|
-
return;
|
|
736
|
+
if (det === 0) return;
|
|
760
737
|
const idet = pixels / Math.sqrt(det);
|
|
761
738
|
x2 *= idet;
|
|
762
739
|
y2 *= idet;
|
|
@@ -798,22 +775,18 @@ let SVGRenderer$1 = class SVGRenderer {
|
|
|
798
775
|
};
|
|
799
776
|
/**
|
|
800
777
|
* @license
|
|
801
|
-
* uiconfig.js v0.
|
|
802
|
-
* Copyright 2022-
|
|
778
|
+
* uiconfig.js v0.1.3
|
|
779
|
+
* Copyright 2022-2025 repalash <palash@shaders.app>
|
|
803
780
|
* MIT License
|
|
804
781
|
*/
|
|
805
|
-
function
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
const
|
|
812
|
-
|
|
813
|
-
data2[6] = data2[6] & 15 | 64;
|
|
814
|
-
data2[8] = data2[8] & 63 | 128;
|
|
815
|
-
const view = new DataView(data2.buffer);
|
|
816
|
-
return `${ho(view.getUint32(0), 8)}-${ho(view.getUint16(4), 4)}-${ho(view.getUint16(6), 4)}-${ho(view.getUint16(8), 4)}-${ho(view.getUint32(10), 8)}${ho(view.getUint16(14), 4)}`;
|
|
782
|
+
function Ee(n, ...e) {
|
|
783
|
+
return typeof n == "function" && (n = n(...e)), n;
|
|
784
|
+
}
|
|
785
|
+
function it() {
|
|
786
|
+
const n = (i, r) => i.toString(16).padStart(r, "0"), e = crypto.getRandomValues(new Uint8Array(16));
|
|
787
|
+
e[6] = e[6] & 15 | 64, e[8] = e[8] & 63 | 128;
|
|
788
|
+
const t = new DataView(e.buffer);
|
|
789
|
+
return `${n(t.getUint32(0), 8)}-${n(t.getUint16(4), 4)}-${n(t.getUint16(6), 4)}-${n(t.getUint16(8), 4)}-${n(t.getUint32(10), 8)}${n(t.getUint16(14), 4)}`;
|
|
817
790
|
}
|
|
818
791
|
class UiConfigTypeMap {
|
|
819
792
|
}
|
|
@@ -827,7 +800,7 @@ function generateValueConfig(obj, key, label, val) {
|
|
|
827
800
|
} else {
|
|
828
801
|
const uiType = valueToUiType(val);
|
|
829
802
|
if (uiType === "folder") {
|
|
830
|
-
result = generateUiFolder(key + "", val);
|
|
803
|
+
result = generateUiFolder(key + "", val, {}, "folder", true);
|
|
831
804
|
} else if (uiType)
|
|
832
805
|
result = {
|
|
833
806
|
type: uiType,
|
|
@@ -852,15 +825,14 @@ function generateUiConfig(obj) {
|
|
|
852
825
|
types.push(type);
|
|
853
826
|
type = Object.getPrototypeOf(type);
|
|
854
827
|
}
|
|
855
|
-
if (!types.length) {
|
|
828
|
+
if (!types.length || Array.isArray(obj)) {
|
|
856
829
|
const keys2 = typeof obj === "object" ? Object.keys(obj) : Array.isArray(obj) ? obj.map((_, i) => i) : [];
|
|
857
830
|
for (const key of keys2) {
|
|
858
831
|
const val = obj[key];
|
|
859
832
|
if (val === void 0 || val === null)
|
|
860
833
|
continue;
|
|
861
834
|
const c = () => generateValueConfig(obj, key, key + "", val);
|
|
862
|
-
|
|
863
|
-
result.push(c);
|
|
835
|
+
result.push(c);
|
|
864
836
|
}
|
|
865
837
|
}
|
|
866
838
|
types.reverse().forEach((t) => {
|
|
@@ -893,8 +865,8 @@ function generateUiConfig(obj) {
|
|
|
893
865
|
});
|
|
894
866
|
return result;
|
|
895
867
|
}
|
|
896
|
-
function generateUiFolder(label, obj, params = {}, type = "folder") {
|
|
897
|
-
return Object.assign({ type, label, children: generateUiConfig(obj), uuid:
|
|
868
|
+
function generateUiFolder(label, obj, params = {}, type = "folder", dynamic = false) {
|
|
869
|
+
return Object.assign({ type, label, children: !dynamic ? generateUiConfig(obj) : () => generateUiConfig(obj), uuid: it() }, params);
|
|
898
870
|
}
|
|
899
871
|
function valueToUiType(val) {
|
|
900
872
|
if (val === null || val === void 0)
|
|
@@ -948,7 +920,7 @@ function uiContainer(label, params, type = "panel") {
|
|
|
948
920
|
return class extends constructor {
|
|
949
921
|
constructor() {
|
|
950
922
|
super(...arguments);
|
|
951
|
-
this.uiConfig = generateUiFolder(
|
|
923
|
+
this.uiConfig = generateUiFolder(Ee(label, this) || "", this, {}, type);
|
|
952
924
|
}
|
|
953
925
|
};
|
|
954
926
|
};
|
|
@@ -967,62 +939,66 @@ function uiToggle(label, params) {
|
|
|
967
939
|
function uiFolderContainer(label, params) {
|
|
968
940
|
return uiContainer(label, params, "folder");
|
|
969
941
|
}
|
|
942
|
+
typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
|
|
943
|
+
var e = new Error(message);
|
|
944
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
945
|
+
};
|
|
970
946
|
/**
|
|
971
947
|
* @license
|
|
972
|
-
* ts-browser-helpers v0.
|
|
973
|
-
* Copyright 2022-
|
|
948
|
+
* ts-browser-helpers v0.16.2
|
|
949
|
+
* Copyright 2022-2025 repalash <palash@shaders.app>
|
|
974
950
|
* MIT License
|
|
951
|
+
* See ./dependencies.txt for bundled third-party dependencies and licenses.
|
|
975
952
|
*/
|
|
976
|
-
function
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
953
|
+
function v(n, e) {
|
|
954
|
+
return Object.hasOwn ? Object.hasOwn(n, e) : n.hasOwnProperty(e);
|
|
955
|
+
}
|
|
956
|
+
const m = class m2 {
|
|
957
|
+
static callFunction(e, t, i = []) {
|
|
958
|
+
if (!t) return e(...i);
|
|
959
|
+
if (e.name && t[e.name] === e) return e.call(t, ...i);
|
|
960
|
+
m2.methodMap.has(t) || m2.methodMap.set(t, /* @__PURE__ */ new WeakMap());
|
|
961
|
+
const r = m2.methodMap.get(t);
|
|
962
|
+
if (!r.has(e)) {
|
|
963
|
+
let s = t;
|
|
964
|
+
for (; s; ) {
|
|
965
|
+
const o = Object.values(Object.getOwnPropertyDescriptors(s));
|
|
966
|
+
for (let c of o)
|
|
967
|
+
if (c.value === e)
|
|
968
|
+
return r.set(e, true), e.call(t, ...i);
|
|
969
|
+
s = Object.getPrototypeOf(s);
|
|
970
|
+
}
|
|
971
|
+
r.set(e, false);
|
|
972
|
+
}
|
|
973
|
+
return r.get(e) ? e.call(t, ...i) : e(...i);
|
|
974
|
+
}
|
|
975
|
+
};
|
|
976
|
+
m.methodMap = /* @__PURE__ */ new WeakMap();
|
|
977
|
+
let E = m;
|
|
978
|
+
function x$4(n, e = "param") {
|
|
979
|
+
if (!n) throw new Error("onChange: fnKey is undefined, make sure the function exists or provide a string");
|
|
980
|
+
return (t, i, r) => {
|
|
981
|
+
const s = {
|
|
981
982
|
get() {
|
|
982
|
-
return this[`_oc_${
|
|
983
|
+
return this[`_oc_${i}`];
|
|
983
984
|
},
|
|
984
|
-
set(
|
|
985
|
-
var
|
|
986
|
-
const
|
|
987
|
-
if (
|
|
988
|
-
|
|
989
|
-
this[
|
|
990
|
-
|
|
991
|
-
if (typeof fnKey === "string")
|
|
992
|
-
(_a = this[fnKey]) === null || _a === void 0 ? void 0 : _a.call(this, ...params);
|
|
993
|
-
else if (typeof fnKey === "function") {
|
|
994
|
-
let called = false;
|
|
995
|
-
if (fnKey.name) {
|
|
996
|
-
let p = this;
|
|
997
|
-
while (p) {
|
|
998
|
-
const fn = p[fnKey.name];
|
|
999
|
-
if (fn === fnKey) {
|
|
1000
|
-
fnKey.call(this, ...params);
|
|
1001
|
-
called = true;
|
|
1002
|
-
break;
|
|
1003
|
-
} else if (fn && fn.name && fn.name.endsWith(`bound ${fnKey.name}`)) {
|
|
1004
|
-
fn(...params);
|
|
1005
|
-
called = true;
|
|
1006
|
-
break;
|
|
1007
|
-
}
|
|
1008
|
-
p = Object.getPrototypeOf(p);
|
|
1009
|
-
}
|
|
1010
|
-
}
|
|
1011
|
-
if (!called) {
|
|
1012
|
-
if (fnKey.name && this[fnKey.name].name.endsWith(`bound ${fnKey.name}`))
|
|
1013
|
-
this[fnKey.name](...params);
|
|
1014
|
-
else
|
|
1015
|
-
fnKey(...params);
|
|
1016
|
-
}
|
|
1017
|
-
}
|
|
985
|
+
set(o) {
|
|
986
|
+
var u;
|
|
987
|
+
const c = this[`_oc_${i}`];
|
|
988
|
+
if (c === o) return;
|
|
989
|
+
this[`_oc_${i}`] = o;
|
|
990
|
+
const a = e === "param" ? [i, o, c, this] : e === "object" ? [{ key: i, value: o, oldValue: c, target: this }] : [];
|
|
991
|
+
typeof n == "string" ? (u = this[n]) == null || u.call(this, ...a) : typeof n == "function" && E.callFunction(n, this, a);
|
|
1018
992
|
}
|
|
1019
|
-
}
|
|
993
|
+
};
|
|
994
|
+
if (r)
|
|
995
|
+
return v(r, "value") && delete r.value, v(r, "writable") && delete r.writable, v(r, "initializer") && delete r.initializer, Object.assign(r, s);
|
|
996
|
+
Object.defineProperty(t, i, s);
|
|
1020
997
|
};
|
|
1021
998
|
}
|
|
1022
|
-
function
|
|
1023
|
-
if (!fnKey)
|
|
1024
|
-
|
|
1025
|
-
return onChange(fnKey, paramType);
|
|
999
|
+
function ze(n, e = "void") {
|
|
1000
|
+
if (!n) throw new Error("onChange: fnKey is undefined, make sure the function exists or provide a string");
|
|
1001
|
+
return x$4(n, e);
|
|
1026
1002
|
}
|
|
1027
1003
|
var __defProp$2 = Object.defineProperty;
|
|
1028
1004
|
var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
|
|
@@ -1031,8 +1007,7 @@ var __decorateClass$2 = (decorators, target, key, kind) => {
|
|
|
1031
1007
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1032
1008
|
if (decorator = decorators[i])
|
|
1033
1009
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1034
|
-
if (kind && result)
|
|
1035
|
-
__defProp$2(target, key, result);
|
|
1010
|
+
if (kind && result) __defProp$2(target, key, result);
|
|
1036
1011
|
return result;
|
|
1037
1012
|
};
|
|
1038
1013
|
let BasicSVGRenderer = class extends SVGRenderer$1 {
|
|
@@ -1058,7 +1033,7 @@ __decorateClass$2([
|
|
|
1058
1033
|
], BasicSVGRenderer.prototype, "overdraw", 2);
|
|
1059
1034
|
__decorateClass$2([
|
|
1060
1035
|
uiDropdown(void 0, ["low", "high"]),
|
|
1061
|
-
|
|
1036
|
+
ze(BasicSVGRenderer.prototype._refresh)
|
|
1062
1037
|
], BasicSVGRenderer.prototype, "quality", 2);
|
|
1063
1038
|
BasicSVGRenderer = __decorateClass$2([
|
|
1064
1039
|
uiFolderContainer("Basic SVG Renderer")
|
|
@@ -1070,8 +1045,7 @@ var __decorateClass$1 = (decorators, target, key, kind) => {
|
|
|
1070
1045
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1071
1046
|
if (decorator = decorators[i])
|
|
1072
1047
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1073
|
-
if (kind && result)
|
|
1074
|
-
__defProp$1(target, key, result);
|
|
1048
|
+
if (kind && result) __defProp$1(target, key, result);
|
|
1075
1049
|
return result;
|
|
1076
1050
|
};
|
|
1077
1051
|
let BasicSVGRendererPlugin = class extends AViewerPluginSync {
|
|
@@ -1088,8 +1062,7 @@ let BasicSVGRendererPlugin = class extends AViewerPluginSync {
|
|
|
1088
1062
|
this.autoRender = true;
|
|
1089
1063
|
this._viewerListeners = {
|
|
1090
1064
|
postRender: (_) => {
|
|
1091
|
-
if (this.autoRender)
|
|
1092
|
-
this.render();
|
|
1065
|
+
if (this.autoRender) this.render();
|
|
1093
1066
|
}
|
|
1094
1067
|
};
|
|
1095
1068
|
this._onResize = this._onResize.bind(this);
|
|
@@ -1133,10 +1106,8 @@ let BasicSVGRendererPlugin = class extends AViewerPluginSync {
|
|
|
1133
1106
|
this.renderer.domElement.style.display = "none";
|
|
1134
1107
|
}
|
|
1135
1108
|
render() {
|
|
1136
|
-
if (!this._viewer)
|
|
1137
|
-
|
|
1138
|
-
if (this.isDisabled())
|
|
1139
|
-
return;
|
|
1109
|
+
if (!this._viewer) return;
|
|
1110
|
+
if (this.isDisabled()) return;
|
|
1140
1111
|
this.renderer.render(this._viewer.scene, this._viewer.scene.mainCamera);
|
|
1141
1112
|
}
|
|
1142
1113
|
download() {
|
|
@@ -1149,13 +1120,11 @@ let BasicSVGRendererPlugin = class extends AViewerPluginSync {
|
|
|
1149
1120
|
return this.renderer.domElement;
|
|
1150
1121
|
}
|
|
1151
1122
|
_refreshParams() {
|
|
1152
|
-
if (this.isDisabled())
|
|
1153
|
-
return;
|
|
1123
|
+
if (this.isDisabled()) return;
|
|
1154
1124
|
this.renderer.setQuality("medium");
|
|
1155
1125
|
}
|
|
1156
1126
|
_onResize() {
|
|
1157
|
-
if (!this._viewer)
|
|
1158
|
-
return;
|
|
1127
|
+
if (!this._viewer) return;
|
|
1159
1128
|
this.renderer.setSize(this._viewer.canvas.clientWidth, this._viewer.canvas.clientHeight);
|
|
1160
1129
|
}
|
|
1161
1130
|
};
|
|
@@ -1215,7 +1184,7 @@ class ViewEdge {
|
|
|
1215
1184
|
}
|
|
1216
1185
|
toJSON() {
|
|
1217
1186
|
return {
|
|
1218
|
-
id: [...this.a.vertices].map((
|
|
1187
|
+
id: [...this.a.vertices].map((v2) => v2.id).join(",") + "-" + [...this.b.vertices].map((v2) => v2.id).join(",")
|
|
1219
1188
|
};
|
|
1220
1189
|
}
|
|
1221
1190
|
clone() {
|
|
@@ -1881,8 +1850,7 @@ var Arrangement2D = (() => {
|
|
|
1881
1850
|
}
|
|
1882
1851
|
var read_, readAsync, readBinary;
|
|
1883
1852
|
function logExceptionOnExit(e) {
|
|
1884
|
-
if (e instanceof ExitStatus)
|
|
1885
|
-
return;
|
|
1853
|
+
if (e instanceof ExitStatus) return;
|
|
1886
1854
|
let toLog = e;
|
|
1887
1855
|
if (e && typeof e == "object" && e.stack) {
|
|
1888
1856
|
toLog = [e, e.stack];
|
|
@@ -1893,8 +1861,7 @@ var Arrangement2D = (() => {
|
|
|
1893
1861
|
var nodePath;
|
|
1894
1862
|
var requireNodeFS;
|
|
1895
1863
|
if (ENVIRONMENT_IS_NODE) {
|
|
1896
|
-
if (!(typeof process == "object" && typeof require == "function"))
|
|
1897
|
-
throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");
|
|
1864
|
+
if (!(typeof process == "object" && typeof require == "function")) throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");
|
|
1898
1865
|
if (ENVIRONMENT_IS_WORKER) {
|
|
1899
1866
|
scriptDirectory = require("path").dirname(scriptDirectory) + "/";
|
|
1900
1867
|
} else {
|
|
@@ -1931,10 +1898,8 @@ var Arrangement2D = (() => {
|
|
|
1931
1898
|
requireNodeFS();
|
|
1932
1899
|
filename = nodePath["normalize"](filename);
|
|
1933
1900
|
fs.readFile(filename, function(err2, data2) {
|
|
1934
|
-
if (err2)
|
|
1935
|
-
|
|
1936
|
-
else
|
|
1937
|
-
onload(data2.buffer);
|
|
1901
|
+
if (err2) onerror(err2);
|
|
1902
|
+
else onload(data2.buffer);
|
|
1938
1903
|
});
|
|
1939
1904
|
};
|
|
1940
1905
|
if (process["argv"].length > 1) {
|
|
@@ -1950,19 +1915,16 @@ var Arrangement2D = (() => {
|
|
|
1950
1915
|
throw reason;
|
|
1951
1916
|
});
|
|
1952
1917
|
quit_ = (status, toThrow) => {
|
|
1953
|
-
|
|
1918
|
+
{
|
|
1954
1919
|
process["exitCode"] = status;
|
|
1955
1920
|
throw toThrow;
|
|
1956
1921
|
}
|
|
1957
|
-
logExceptionOnExit(toThrow);
|
|
1958
|
-
process["exit"](status);
|
|
1959
1922
|
};
|
|
1960
1923
|
Module["inspect"] = function() {
|
|
1961
1924
|
return "[Emscripten Module object]";
|
|
1962
1925
|
};
|
|
1963
1926
|
} else if (ENVIRONMENT_IS_SHELL) {
|
|
1964
|
-
if (typeof process == "object" && typeof require === "function" || typeof window == "object" || typeof importScripts == "function")
|
|
1965
|
-
throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");
|
|
1927
|
+
if (typeof process == "object" && typeof require === "function" || typeof window == "object" || typeof importScripts == "function") throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");
|
|
1966
1928
|
if (typeof read != "undefined") {
|
|
1967
1929
|
read_ = function shell_read(f) {
|
|
1968
1930
|
const data2 = tryParseAsDataURI(f);
|
|
@@ -1998,8 +1960,7 @@ var Arrangement2D = (() => {
|
|
|
1998
1960
|
};
|
|
1999
1961
|
}
|
|
2000
1962
|
if (typeof print != "undefined") {
|
|
2001
|
-
if (typeof console == "undefined")
|
|
2002
|
-
console = {};
|
|
1963
|
+
if (typeof console == "undefined") console = {};
|
|
2003
1964
|
console.log = print;
|
|
2004
1965
|
console.warn = console.error = typeof printErr != "undefined" ? printErr : print;
|
|
2005
1966
|
}
|
|
@@ -2017,8 +1978,7 @@ var Arrangement2D = (() => {
|
|
|
2017
1978
|
} else {
|
|
2018
1979
|
scriptDirectory = "";
|
|
2019
1980
|
}
|
|
2020
|
-
if (!(typeof window == "object" || typeof importScripts == "function"))
|
|
2021
|
-
throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");
|
|
1981
|
+
if (!(typeof window == "object" || typeof importScripts == "function")) throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");
|
|
2022
1982
|
{
|
|
2023
1983
|
read_ = (url) => {
|
|
2024
1984
|
try {
|
|
@@ -2079,14 +2039,11 @@ var Arrangement2D = (() => {
|
|
|
2079
2039
|
Object.assign(Module, moduleOverrides);
|
|
2080
2040
|
moduleOverrides = null;
|
|
2081
2041
|
checkIncomingModuleAPI();
|
|
2082
|
-
if (Module["arguments"])
|
|
2083
|
-
Module["arguments"];
|
|
2042
|
+
if (Module["arguments"]) Module["arguments"];
|
|
2084
2043
|
legacyModuleProp("arguments", "arguments_");
|
|
2085
|
-
if (Module["thisProgram"])
|
|
2086
|
-
thisProgram = Module["thisProgram"];
|
|
2044
|
+
if (Module["thisProgram"]) thisProgram = Module["thisProgram"];
|
|
2087
2045
|
legacyModuleProp("thisProgram", "thisProgram");
|
|
2088
|
-
if (Module["quit"])
|
|
2089
|
-
quit_ = Module["quit"];
|
|
2046
|
+
if (Module["quit"]) quit_ = Module["quit"];
|
|
2090
2047
|
legacyModuleProp("quit", "quit_");
|
|
2091
2048
|
assert(typeof Module["memoryInitializerPrefixURL"] == "undefined", "Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead");
|
|
2092
2049
|
assert(typeof Module["pthreadMainPrefixURL"] == "undefined", "Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead");
|
|
@@ -2103,8 +2060,7 @@ var Arrangement2D = (() => {
|
|
|
2103
2060
|
legacyModuleProp("setWindowTitle", "setWindowTitle");
|
|
2104
2061
|
assert(!ENVIRONMENT_IS_SHELL, "shell environment detected but not enabled at build time. Add 'shell' to `-sENVIRONMENT` to enable.");
|
|
2105
2062
|
function warnOnce(text) {
|
|
2106
|
-
if (!warnOnce.shown)
|
|
2107
|
-
warnOnce.shown = {};
|
|
2063
|
+
if (!warnOnce.shown) warnOnce.shown = {};
|
|
2108
2064
|
if (!warnOnce.shown[text]) {
|
|
2109
2065
|
warnOnce.shown[text] = 1;
|
|
2110
2066
|
err(text);
|
|
@@ -2142,8 +2098,7 @@ var Arrangement2D = (() => {
|
|
|
2142
2098
|
}
|
|
2143
2099
|
}
|
|
2144
2100
|
var wasmBinary;
|
|
2145
|
-
if (Module["wasmBinary"])
|
|
2146
|
-
wasmBinary = Module["wasmBinary"];
|
|
2101
|
+
if (Module["wasmBinary"]) wasmBinary = Module["wasmBinary"];
|
|
2147
2102
|
legacyModuleProp("wasmBinary", "wasmBinary");
|
|
2148
2103
|
var noExitRuntime = Module["noExitRuntime"] || true;
|
|
2149
2104
|
legacyModuleProp("noExitRuntime", "noExitRuntime");
|
|
@@ -2161,8 +2116,7 @@ var Arrangement2D = (() => {
|
|
|
2161
2116
|
function UTF8ArrayToString(heapOrArray, idx, maxBytesToRead) {
|
|
2162
2117
|
var endIdx = idx + maxBytesToRead;
|
|
2163
2118
|
var endPtr = idx;
|
|
2164
|
-
while (heapOrArray[endPtr] && !(endPtr >= endIdx))
|
|
2165
|
-
++endPtr;
|
|
2119
|
+
while (heapOrArray[endPtr] && !(endPtr >= endIdx)) ++endPtr;
|
|
2166
2120
|
if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) {
|
|
2167
2121
|
return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr));
|
|
2168
2122
|
} else {
|
|
@@ -2182,8 +2136,7 @@ var Arrangement2D = (() => {
|
|
|
2182
2136
|
if ((u0 & 240) == 224) {
|
|
2183
2137
|
u0 = (u0 & 15) << 12 | u1 << 6 | u2;
|
|
2184
2138
|
} else {
|
|
2185
|
-
if ((u0 & 248) != 240)
|
|
2186
|
-
warnOnce("Invalid UTF-8 leading byte 0x" + u0.toString(16) + " encountered when deserializing a UTF-8 string in wasm memory to a JS string!");
|
|
2139
|
+
if ((u0 & 248) != 240) warnOnce("Invalid UTF-8 leading byte 0x" + u0.toString(16) + " encountered when deserializing a UTF-8 string in wasm memory to a JS string!");
|
|
2187
2140
|
u0 = (u0 & 7) << 18 | u1 << 12 | u2 << 6 | heapOrArray[idx++] & 63;
|
|
2188
2141
|
}
|
|
2189
2142
|
if (u0 < 65536) {
|
|
@@ -2200,8 +2153,7 @@ var Arrangement2D = (() => {
|
|
|
2200
2153
|
return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : "";
|
|
2201
2154
|
}
|
|
2202
2155
|
function stringToUTF8Array(str, heap, outIdx, maxBytesToWrite) {
|
|
2203
|
-
if (!(maxBytesToWrite > 0))
|
|
2204
|
-
return 0;
|
|
2156
|
+
if (!(maxBytesToWrite > 0)) return 0;
|
|
2205
2157
|
var startIdx = outIdx;
|
|
2206
2158
|
var endIdx = outIdx + maxBytesToWrite - 1;
|
|
2207
2159
|
for (var i = 0; i < str.length; ++i) {
|
|
@@ -2211,25 +2163,20 @@ var Arrangement2D = (() => {
|
|
|
2211
2163
|
u = 65536 + ((u & 1023) << 10) | u1 & 1023;
|
|
2212
2164
|
}
|
|
2213
2165
|
if (u <= 127) {
|
|
2214
|
-
if (outIdx >= endIdx)
|
|
2215
|
-
break;
|
|
2166
|
+
if (outIdx >= endIdx) break;
|
|
2216
2167
|
heap[outIdx++] = u;
|
|
2217
2168
|
} else if (u <= 2047) {
|
|
2218
|
-
if (outIdx + 1 >= endIdx)
|
|
2219
|
-
break;
|
|
2169
|
+
if (outIdx + 1 >= endIdx) break;
|
|
2220
2170
|
heap[outIdx++] = 192 | u >> 6;
|
|
2221
2171
|
heap[outIdx++] = 128 | u & 63;
|
|
2222
2172
|
} else if (u <= 65535) {
|
|
2223
|
-
if (outIdx + 2 >= endIdx)
|
|
2224
|
-
break;
|
|
2173
|
+
if (outIdx + 2 >= endIdx) break;
|
|
2225
2174
|
heap[outIdx++] = 224 | u >> 12;
|
|
2226
2175
|
heap[outIdx++] = 128 | u >> 6 & 63;
|
|
2227
2176
|
heap[outIdx++] = 128 | u & 63;
|
|
2228
2177
|
} else {
|
|
2229
|
-
if (outIdx + 3 >= endIdx)
|
|
2230
|
-
|
|
2231
|
-
if (u > 1114111)
|
|
2232
|
-
warnOnce("Invalid Unicode code point 0x" + u.toString(16) + " encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF).");
|
|
2178
|
+
if (outIdx + 3 >= endIdx) break;
|
|
2179
|
+
if (u > 1114111) warnOnce("Invalid Unicode code point 0x" + u.toString(16) + " encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF).");
|
|
2233
2180
|
heap[outIdx++] = 240 | u >> 18;
|
|
2234
2181
|
heap[outIdx++] = 128 | u >> 12 & 63;
|
|
2235
2182
|
heap[outIdx++] = 128 | u >> 6 & 63;
|
|
@@ -2243,16 +2190,11 @@ var Arrangement2D = (() => {
|
|
|
2243
2190
|
var len = 0;
|
|
2244
2191
|
for (var i = 0; i < str.length; ++i) {
|
|
2245
2192
|
var u = str.charCodeAt(i);
|
|
2246
|
-
if (u >= 55296 && u <= 57343)
|
|
2247
|
-
|
|
2248
|
-
if (u <=
|
|
2249
|
-
|
|
2250
|
-
else
|
|
2251
|
-
len += 2;
|
|
2252
|
-
else if (u <= 65535)
|
|
2253
|
-
len += 3;
|
|
2254
|
-
else
|
|
2255
|
-
len += 4;
|
|
2193
|
+
if (u >= 55296 && u <= 57343) u = 65536 + ((u & 1023) << 10) | str.charCodeAt(++i) & 1023;
|
|
2194
|
+
if (u <= 127) ++len;
|
|
2195
|
+
else if (u <= 2047) len += 2;
|
|
2196
|
+
else if (u <= 65535) len += 3;
|
|
2197
|
+
else len += 4;
|
|
2256
2198
|
}
|
|
2257
2199
|
return len;
|
|
2258
2200
|
}
|
|
@@ -2266,8 +2208,7 @@ var Arrangement2D = (() => {
|
|
|
2266
2208
|
assert(str.charCodeAt(i) === (str.charCodeAt(i) & 255));
|
|
2267
2209
|
HEAP8[buffer2++ >> 0] = str.charCodeAt(i);
|
|
2268
2210
|
}
|
|
2269
|
-
|
|
2270
|
-
HEAP8[buffer2 >> 0] = 0;
|
|
2211
|
+
HEAP8[buffer2 >> 0] = 0;
|
|
2271
2212
|
}
|
|
2272
2213
|
var buffer, HEAP8, HEAPU8, HEAP32, HEAPU32;
|
|
2273
2214
|
function updateGlobalBufferAndViews(buf) {
|
|
@@ -2282,8 +2223,7 @@ var Arrangement2D = (() => {
|
|
|
2282
2223
|
Module["HEAPF64"] = new Float64Array(buf);
|
|
2283
2224
|
}
|
|
2284
2225
|
var TOTAL_STACK = 5242880;
|
|
2285
|
-
if (Module["TOTAL_STACK"])
|
|
2286
|
-
assert(TOTAL_STACK === Module["TOTAL_STACK"], "the stack size can no longer be determined at runtime");
|
|
2226
|
+
if (Module["TOTAL_STACK"]) assert(TOTAL_STACK === Module["TOTAL_STACK"], "the stack size can no longer be determined at runtime");
|
|
2287
2227
|
var INITIAL_MEMORY = Module["INITIAL_MEMORY"] || 16777216;
|
|
2288
2228
|
legacyModuleProp("INITIAL_MEMORY", "INITIAL_MEMORY");
|
|
2289
2229
|
assert(INITIAL_MEMORY >= TOTAL_STACK, "INITIAL_MEMORY should be larger than TOTAL_STACK, was " + INITIAL_MEMORY + "! (TOTAL_STACK=" + TOTAL_STACK + ")");
|
|
@@ -2299,23 +2239,20 @@ var Arrangement2D = (() => {
|
|
|
2299
2239
|
HEAPU32[0] = 1668509029;
|
|
2300
2240
|
}
|
|
2301
2241
|
function checkStackCookie() {
|
|
2302
|
-
if (ABORT)
|
|
2303
|
-
return;
|
|
2242
|
+
if (ABORT) return;
|
|
2304
2243
|
var max2 = _emscripten_stack_get_end();
|
|
2305
2244
|
var cookie1 = HEAPU32[max2 >> 2];
|
|
2306
2245
|
var cookie2 = HEAPU32[max2 + 4 >> 2];
|
|
2307
2246
|
if (cookie1 != 34821223 || cookie2 != 2310721022) {
|
|
2308
2247
|
abort("Stack overflow! Stack cookie has been overwritten, expected hex dwords 0x89BACDFE and 0x2135467, but received 0x" + cookie2.toString(16) + " 0x" + cookie1.toString(16));
|
|
2309
2248
|
}
|
|
2310
|
-
if (HEAPU32[0] !== 1668509029)
|
|
2311
|
-
abort("Runtime error: The application has corrupted its heap memory area (address zero)!");
|
|
2249
|
+
if (HEAPU32[0] !== 1668509029) abort("Runtime error: The application has corrupted its heap memory area (address zero)!");
|
|
2312
2250
|
}
|
|
2313
2251
|
(function() {
|
|
2314
2252
|
var h16 = new Int16Array(1);
|
|
2315
2253
|
var h8 = new Int8Array(h16.buffer);
|
|
2316
2254
|
h16[0] = 25459;
|
|
2317
|
-
if (h8[0] !== 115 || h8[1] !== 99)
|
|
2318
|
-
throw "Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)";
|
|
2255
|
+
if (h8[0] !== 115 || h8[1] !== 99) throw "Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)";
|
|
2319
2256
|
})();
|
|
2320
2257
|
var __ATPRERUN__ = [];
|
|
2321
2258
|
var __ATINIT__ = [];
|
|
@@ -2326,8 +2263,7 @@ var Arrangement2D = (() => {
|
|
|
2326
2263
|
}
|
|
2327
2264
|
function preRun() {
|
|
2328
2265
|
if (Module["preRun"]) {
|
|
2329
|
-
if (typeof Module["preRun"] == "function")
|
|
2330
|
-
Module["preRun"] = [Module["preRun"]];
|
|
2266
|
+
if (typeof Module["preRun"] == "function") Module["preRun"] = [Module["preRun"]];
|
|
2331
2267
|
while (Module["preRun"].length) {
|
|
2332
2268
|
addOnPreRun(Module["preRun"].shift());
|
|
2333
2269
|
}
|
|
@@ -2343,8 +2279,7 @@ var Arrangement2D = (() => {
|
|
|
2343
2279
|
function postRun() {
|
|
2344
2280
|
checkStackCookie();
|
|
2345
2281
|
if (Module["postRun"]) {
|
|
2346
|
-
if (typeof Module["postRun"] == "function")
|
|
2347
|
-
Module["postRun"] = [Module["postRun"]];
|
|
2282
|
+
if (typeof Module["postRun"] == "function") Module["postRun"] = [Module["postRun"]];
|
|
2348
2283
|
while (Module["postRun"].length) {
|
|
2349
2284
|
addOnPostRun(Module["postRun"].shift());
|
|
2350
2285
|
}
|
|
@@ -2373,7 +2308,7 @@ var Arrangement2D = (() => {
|
|
|
2373
2308
|
if (Module["monitorRunDependencies"]) {
|
|
2374
2309
|
Module["monitorRunDependencies"](runDependencies);
|
|
2375
2310
|
}
|
|
2376
|
-
|
|
2311
|
+
{
|
|
2377
2312
|
assert(!runDependencyTracking[id]);
|
|
2378
2313
|
runDependencyTracking[id] = 1;
|
|
2379
2314
|
if (runDependencyWatcher === null && typeof setInterval != "undefined") {
|
|
@@ -2396,8 +2331,6 @@ var Arrangement2D = (() => {
|
|
|
2396
2331
|
}
|
|
2397
2332
|
}, 1e4);
|
|
2398
2333
|
}
|
|
2399
|
-
} else {
|
|
2400
|
-
err("warning: run dependency added without ID");
|
|
2401
2334
|
}
|
|
2402
2335
|
}
|
|
2403
2336
|
function removeRunDependency(id) {
|
|
@@ -2405,11 +2338,9 @@ var Arrangement2D = (() => {
|
|
|
2405
2338
|
if (Module["monitorRunDependencies"]) {
|
|
2406
2339
|
Module["monitorRunDependencies"](runDependencies);
|
|
2407
2340
|
}
|
|
2408
|
-
|
|
2341
|
+
{
|
|
2409
2342
|
assert(runDependencyTracking[id]);
|
|
2410
2343
|
delete runDependencyTracking[id];
|
|
2411
|
-
} else {
|
|
2412
|
-
err("warning: run dependency removed without ID");
|
|
2413
2344
|
}
|
|
2414
2345
|
if (runDependencies == 0) {
|
|
2415
2346
|
if (runDependencyWatcher !== null) {
|
|
@@ -2472,7 +2403,7 @@ var Arrangement2D = (() => {
|
|
|
2472
2403
|
return function() {
|
|
2473
2404
|
var displayName = name;
|
|
2474
2405
|
var asm = fixedasm;
|
|
2475
|
-
|
|
2406
|
+
{
|
|
2476
2407
|
asm = Module["asm"];
|
|
2477
2408
|
}
|
|
2478
2409
|
assert(runtimeInitialized, "native function `" + displayName + "` called before runtime initialization");
|
|
@@ -2615,8 +2546,7 @@ var Arrangement2D = (() => {
|
|
|
2615
2546
|
function getWasmTableEntry(funcPtr) {
|
|
2616
2547
|
var func = wasmTableMirror[funcPtr];
|
|
2617
2548
|
if (!func) {
|
|
2618
|
-
if (funcPtr >= wasmTableMirror.length)
|
|
2619
|
-
wasmTableMirror.length = funcPtr + 1;
|
|
2549
|
+
if (funcPtr >= wasmTableMirror.length) wasmTableMirror.length = funcPtr + 1;
|
|
2620
2550
|
wasmTableMirror[funcPtr] = func = wasmTable.get(funcPtr);
|
|
2621
2551
|
}
|
|
2622
2552
|
assert(wasmTable.get(funcPtr) == func, "JavaScript-side Wasm function table mirror is out of date!");
|
|
@@ -2687,8 +2617,7 @@ var Arrangement2D = (() => {
|
|
|
2687
2617
|
return HEAPU32[this.excPtr >> 2];
|
|
2688
2618
|
}
|
|
2689
2619
|
var adjusted = this.get_adjusted_ptr();
|
|
2690
|
-
if (adjusted !== 0)
|
|
2691
|
-
return adjusted;
|
|
2620
|
+
if (adjusted !== 0) return adjusted;
|
|
2692
2621
|
return this.excPtr;
|
|
2693
2622
|
};
|
|
2694
2623
|
}
|
|
@@ -2746,10 +2675,8 @@ var Arrangement2D = (() => {
|
|
|
2746
2675
|
var lang = (typeof navigator == "object" && navigator.languages && navigator.languages[0] || "C").replace("-", "_") + ".UTF-8";
|
|
2747
2676
|
var env = { "USER": "web_user", "LOGNAME": "web_user", "PATH": "/", "PWD": "/", "HOME": "/home/web_user", "LANG": lang, "_": getExecutableName() };
|
|
2748
2677
|
for (var x2 in ENV) {
|
|
2749
|
-
if (ENV[x2] === void 0)
|
|
2750
|
-
|
|
2751
|
-
else
|
|
2752
|
-
env[x2] = ENV[x2];
|
|
2678
|
+
if (ENV[x2] === void 0) delete env[x2];
|
|
2679
|
+
else env[x2] = ENV[x2];
|
|
2753
2680
|
}
|
|
2754
2681
|
var strings = [];
|
|
2755
2682
|
for (var x2 in env) {
|
|
@@ -2804,10 +2731,8 @@ var Arrangement2D = (() => {
|
|
|
2804
2731
|
}
|
|
2805
2732
|
function flush_NO_FILESYSTEM() {
|
|
2806
2733
|
_fflush(0);
|
|
2807
|
-
if (printCharBuffers[1].length)
|
|
2808
|
-
|
|
2809
|
-
if (printCharBuffers[2].length)
|
|
2810
|
-
printChar(2, 10);
|
|
2734
|
+
if (printCharBuffers[1].length) printChar(1, 10);
|
|
2735
|
+
if (printCharBuffers[2].length) printChar(2, 10);
|
|
2811
2736
|
}
|
|
2812
2737
|
function _fd_write(fd, iov, iovcnt, pnum) {
|
|
2813
2738
|
var num = 0;
|
|
@@ -2947,10 +2872,8 @@ var Arrangement2D = (() => {
|
|
|
2947
2872
|
return leadingNulls(date2.tm_hour, 2);
|
|
2948
2873
|
}, "%I": function(date2) {
|
|
2949
2874
|
var twelveHour = date2.tm_hour;
|
|
2950
|
-
if (twelveHour == 0)
|
|
2951
|
-
|
|
2952
|
-
else if (twelveHour > 12)
|
|
2953
|
-
twelveHour -= 12;
|
|
2875
|
+
if (twelveHour == 0) twelveHour = 12;
|
|
2876
|
+
else if (twelveHour > 12) twelveHour -= 12;
|
|
2954
2877
|
return leadingNulls(twelveHour, 2);
|
|
2955
2878
|
}, "%j": function(date2) {
|
|
2956
2879
|
return leadingNulls(date2.tm_mday + __arraySum(__isLeapYear(date2.tm_year + 1900) ? __MONTH_DAYS_LEAP : __MONTH_DAYS_REGULAR, date2.tm_mon - 1), 3);
|
|
@@ -2988,8 +2911,7 @@ var Arrangement2D = (() => {
|
|
|
2988
2911
|
}
|
|
2989
2912
|
} else if (val == 53) {
|
|
2990
2913
|
var jan1 = (date2.tm_wday + 371 - date2.tm_yday) % 7;
|
|
2991
|
-
if (jan1 != 4 && (jan1 != 3 || !__isLeapYear(date2.tm_year)))
|
|
2992
|
-
val = 1;
|
|
2914
|
+
if (jan1 != 4 && (jan1 != 3 || !__isLeapYear(date2.tm_year))) val = 1;
|
|
2993
2915
|
}
|
|
2994
2916
|
return leadingNulls(val, 2);
|
|
2995
2917
|
}, "%w": function(date2) {
|
|
@@ -3019,7 +2941,7 @@ var Arrangement2D = (() => {
|
|
|
3019
2941
|
}
|
|
3020
2942
|
}
|
|
3021
2943
|
pattern = pattern.replace(/\0\0/g, "%");
|
|
3022
|
-
var bytes = intArrayFromString(pattern
|
|
2944
|
+
var bytes = intArrayFromString(pattern);
|
|
3023
2945
|
if (bytes.length > maxsize) {
|
|
3024
2946
|
return 0;
|
|
3025
2947
|
}
|
|
@@ -3030,11 +2952,9 @@ var Arrangement2D = (() => {
|
|
|
3030
2952
|
return _strftime(s, maxsize, format, tm);
|
|
3031
2953
|
}
|
|
3032
2954
|
function intArrayFromString(stringy, dontAddNull, length2) {
|
|
3033
|
-
var len =
|
|
2955
|
+
var len = lengthBytesUTF8(stringy) + 1;
|
|
3034
2956
|
var u8array = new Array(len);
|
|
3035
|
-
|
|
3036
|
-
if (dontAddNull)
|
|
3037
|
-
u8array.length = numBytesWritten;
|
|
2957
|
+
stringToUTF8Array(stringy, u8array, 0, u8array.length);
|
|
3038
2958
|
return u8array;
|
|
3039
2959
|
}
|
|
3040
2960
|
function intArrayToString(array2) {
|
|
@@ -3404,10 +3324,8 @@ var Arrangement2D = (() => {
|
|
|
3404
3324
|
this.status = status;
|
|
3405
3325
|
}
|
|
3406
3326
|
dependenciesFulfilled = function runCaller() {
|
|
3407
|
-
if (!calledRun)
|
|
3408
|
-
|
|
3409
|
-
if (!calledRun)
|
|
3410
|
-
dependenciesFulfilled = runCaller;
|
|
3327
|
+
if (!calledRun) run();
|
|
3328
|
+
if (!calledRun) dependenciesFulfilled = runCaller;
|
|
3411
3329
|
};
|
|
3412
3330
|
function stackCheckInit() {
|
|
3413
3331
|
_emscripten_stack_init();
|
|
@@ -3423,16 +3341,13 @@ var Arrangement2D = (() => {
|
|
|
3423
3341
|
return;
|
|
3424
3342
|
}
|
|
3425
3343
|
function doRun() {
|
|
3426
|
-
if (calledRun)
|
|
3427
|
-
return;
|
|
3344
|
+
if (calledRun) return;
|
|
3428
3345
|
calledRun = true;
|
|
3429
3346
|
Module["calledRun"] = true;
|
|
3430
|
-
if (ABORT)
|
|
3431
|
-
return;
|
|
3347
|
+
if (ABORT) return;
|
|
3432
3348
|
initRuntime();
|
|
3433
3349
|
readyPromiseResolve(Module);
|
|
3434
|
-
if (Module["onRuntimeInitialized"])
|
|
3435
|
-
Module["onRuntimeInitialized"]();
|
|
3350
|
+
if (Module["onRuntimeInitialized"]) Module["onRuntimeInitialized"]();
|
|
3436
3351
|
assert(!Module["_main"], 'compiled without a main, but one is present. if you added it from JS, use Module["onRuntimeInitialized"]');
|
|
3437
3352
|
postRun();
|
|
3438
3353
|
}
|
|
@@ -3470,7 +3385,7 @@ var Arrangement2D = (() => {
|
|
|
3470
3385
|
}
|
|
3471
3386
|
function exit(status, implicit) {
|
|
3472
3387
|
checkUnflushedContent();
|
|
3473
|
-
|
|
3388
|
+
{
|
|
3474
3389
|
var msg = "program exited (with status: " + status + "), but EXIT_RUNTIME is not set, so halting execution but not exiting the runtime or preventing further async execution (build with EXIT_RUNTIME=1, if you want a true shutdown)";
|
|
3475
3390
|
readyPromiseReject(msg);
|
|
3476
3391
|
err(msg);
|
|
@@ -3479,15 +3394,13 @@ var Arrangement2D = (() => {
|
|
|
3479
3394
|
}
|
|
3480
3395
|
function procExit(code) {
|
|
3481
3396
|
if (!keepRuntimeAlive()) {
|
|
3482
|
-
if (Module["onExit"])
|
|
3483
|
-
Module["onExit"](code);
|
|
3397
|
+
if (Module["onExit"]) Module["onExit"](code);
|
|
3484
3398
|
ABORT = true;
|
|
3485
3399
|
}
|
|
3486
3400
|
quit_(code, new ExitStatus(code));
|
|
3487
3401
|
}
|
|
3488
3402
|
if (Module["preInit"]) {
|
|
3489
|
-
if (typeof Module["preInit"] == "function")
|
|
3490
|
-
Module["preInit"] = [Module["preInit"]];
|
|
3403
|
+
if (typeof Module["preInit"] == "function") Module["preInit"] = [Module["preInit"]];
|
|
3491
3404
|
while (Module["preInit"].length > 0) {
|
|
3492
3405
|
Module["preInit"].pop()();
|
|
3493
3406
|
}
|
|
@@ -3507,8 +3420,7 @@ var Arrangement2D = (() => {
|
|
|
3507
3420
|
function wrapPointer(ptr, __class__) {
|
|
3508
3421
|
var cache = getCache(__class__);
|
|
3509
3422
|
var ret = cache[ptr];
|
|
3510
|
-
if (ret)
|
|
3511
|
-
return ret;
|
|
3423
|
+
if (ret) return ret;
|
|
3512
3424
|
ret = Object.create((__class__ || WrapperObject).prototype);
|
|
3513
3425
|
ret.ptr = ptr;
|
|
3514
3426
|
return cache[ptr] = ret;
|
|
@@ -3520,8 +3432,7 @@ var Arrangement2D = (() => {
|
|
|
3520
3432
|
Module["castObject"] = castObject;
|
|
3521
3433
|
Module["NULL"] = wrapPointer(0);
|
|
3522
3434
|
function destroy(obj) {
|
|
3523
|
-
if (!obj["__destroy__"])
|
|
3524
|
-
throw "Error: Cannot destroy object. (Did you create it yourself?)";
|
|
3435
|
+
if (!obj["__destroy__"]) throw "Error: Cannot destroy object. (Did you create it yourself?)";
|
|
3525
3436
|
obj["__destroy__"]();
|
|
3526
3437
|
delete getCache(obj.__class__)[obj.ptr];
|
|
3527
3438
|
}
|
|
@@ -3561,8 +3472,7 @@ var Arrangement2D = (() => {
|
|
|
3561
3472
|
Module["ArrangementBuilder"] = ArrangementBuilder;
|
|
3562
3473
|
ArrangementBuilder.prototype["getPolygons"] = ArrangementBuilder.prototype.getPolygons = function(points) {
|
|
3563
3474
|
var self2 = this.ptr;
|
|
3564
|
-
if (points && typeof points === "object")
|
|
3565
|
-
points = points.ptr;
|
|
3475
|
+
if (points && typeof points === "object") points = points.ptr;
|
|
3566
3476
|
return wrapPointer(_emscripten_bind_ArrangementBuilder_getPolygons_1(self2, points), PolygonList);
|
|
3567
3477
|
};
|
|
3568
3478
|
ArrangementBuilder.prototype["__destroy__"] = ArrangementBuilder.prototype.__destroy__ = function() {
|
|
@@ -3570,10 +3480,8 @@ var Arrangement2D = (() => {
|
|
|
3570
3480
|
_emscripten_bind_ArrangementBuilder___destroy___0(self2);
|
|
3571
3481
|
};
|
|
3572
3482
|
function Point2(x2, y2) {
|
|
3573
|
-
if (x2 && typeof x2 === "object")
|
|
3574
|
-
|
|
3575
|
-
if (y2 && typeof y2 === "object")
|
|
3576
|
-
y2 = y2.ptr;
|
|
3483
|
+
if (x2 && typeof x2 === "object") x2 = x2.ptr;
|
|
3484
|
+
if (y2 && typeof y2 === "object") y2 = y2.ptr;
|
|
3577
3485
|
if (x2 === void 0) {
|
|
3578
3486
|
this.ptr = _emscripten_bind_Point_Point_0();
|
|
3579
3487
|
getCache(Point2)[this.ptr] = this;
|
|
@@ -3598,8 +3506,7 @@ var Arrangement2D = (() => {
|
|
|
3598
3506
|
};
|
|
3599
3507
|
Point2.prototype["set_x"] = Point2.prototype.set_x = function(arg0) {
|
|
3600
3508
|
var self2 = this.ptr;
|
|
3601
|
-
if (arg0 && typeof arg0 === "object")
|
|
3602
|
-
arg0 = arg0.ptr;
|
|
3509
|
+
if (arg0 && typeof arg0 === "object") arg0 = arg0.ptr;
|
|
3603
3510
|
_emscripten_bind_Point_set_x_1(self2, arg0);
|
|
3604
3511
|
};
|
|
3605
3512
|
Object.defineProperty(Point2.prototype, "x", { get: Point2.prototype.get_x, set: Point2.prototype.set_x });
|
|
@@ -3609,8 +3516,7 @@ var Arrangement2D = (() => {
|
|
|
3609
3516
|
};
|
|
3610
3517
|
Point2.prototype["set_y"] = Point2.prototype.set_y = function(arg0) {
|
|
3611
3518
|
var self2 = this.ptr;
|
|
3612
|
-
if (arg0 && typeof arg0 === "object")
|
|
3613
|
-
arg0 = arg0.ptr;
|
|
3519
|
+
if (arg0 && typeof arg0 === "object") arg0 = arg0.ptr;
|
|
3614
3520
|
_emscripten_bind_Point_set_y_1(self2, arg0);
|
|
3615
3521
|
};
|
|
3616
3522
|
Object.defineProperty(Point2.prototype, "y", { get: Point2.prototype.get_y, set: Point2.prototype.set_y });
|
|
@@ -3619,10 +3525,8 @@ var Arrangement2D = (() => {
|
|
|
3619
3525
|
_emscripten_bind_Point___destroy___0(self2);
|
|
3620
3526
|
};
|
|
3621
3527
|
function Polygon3(contour, holes) {
|
|
3622
|
-
if (contour && typeof contour === "object")
|
|
3623
|
-
|
|
3624
|
-
if (holes && typeof holes === "object")
|
|
3625
|
-
holes = holes.ptr;
|
|
3528
|
+
if (contour && typeof contour === "object") contour = contour.ptr;
|
|
3529
|
+
if (holes && typeof holes === "object") holes = holes.ptr;
|
|
3626
3530
|
this.ptr = _emscripten_bind_Polygon_Polygon_2(contour, holes);
|
|
3627
3531
|
getCache(Polygon3)[this.ptr] = this;
|
|
3628
3532
|
}
|
|
@@ -3633,8 +3537,7 @@ var Arrangement2D = (() => {
|
|
|
3633
3537
|
Module["Polygon"] = Polygon3;
|
|
3634
3538
|
Polygon3.prototype["getInsidePoint"] = Polygon3.prototype.getInsidePoint = function(point2) {
|
|
3635
3539
|
var self2 = this.ptr;
|
|
3636
|
-
if (point2 && typeof point2 === "object")
|
|
3637
|
-
point2 = point2.ptr;
|
|
3540
|
+
if (point2 && typeof point2 === "object") point2 = point2.ptr;
|
|
3638
3541
|
return !!_emscripten_bind_Polygon_getInsidePoint_1(self2, point2);
|
|
3639
3542
|
};
|
|
3640
3543
|
Polygon3.prototype["getPolyTristripArea"] = Polygon3.prototype.getPolyTristripArea = function() {
|
|
@@ -3647,8 +3550,7 @@ var Arrangement2D = (() => {
|
|
|
3647
3550
|
};
|
|
3648
3551
|
Polygon3.prototype["set_contour"] = Polygon3.prototype.set_contour = function(arg0) {
|
|
3649
3552
|
var self2 = this.ptr;
|
|
3650
|
-
if (arg0 && typeof arg0 === "object")
|
|
3651
|
-
arg0 = arg0.ptr;
|
|
3553
|
+
if (arg0 && typeof arg0 === "object") arg0 = arg0.ptr;
|
|
3652
3554
|
_emscripten_bind_Polygon_set_contour_1(self2, arg0);
|
|
3653
3555
|
};
|
|
3654
3556
|
Object.defineProperty(Polygon3.prototype, "contour", { get: Polygon3.prototype.get_contour, set: Polygon3.prototype.set_contour });
|
|
@@ -3658,8 +3560,7 @@ var Arrangement2D = (() => {
|
|
|
3658
3560
|
};
|
|
3659
3561
|
Polygon3.prototype["set_holes"] = Polygon3.prototype.set_holes = function(arg0) {
|
|
3660
3562
|
var self2 = this.ptr;
|
|
3661
|
-
if (arg0 && typeof arg0 === "object")
|
|
3662
|
-
arg0 = arg0.ptr;
|
|
3563
|
+
if (arg0 && typeof arg0 === "object") arg0 = arg0.ptr;
|
|
3663
3564
|
_emscripten_bind_Polygon_set_holes_1(self2, arg0);
|
|
3664
3565
|
};
|
|
3665
3566
|
Object.defineProperty(Polygon3.prototype, "holes", { get: Polygon3.prototype.get_holes, set: Polygon3.prototype.set_holes });
|
|
@@ -3678,8 +3579,7 @@ var Arrangement2D = (() => {
|
|
|
3678
3579
|
Module["PointList"] = PointList;
|
|
3679
3580
|
PointList.prototype["push_back"] = PointList.prototype.push_back = function(s) {
|
|
3680
3581
|
var self2 = this.ptr;
|
|
3681
|
-
if (s && typeof s === "object")
|
|
3682
|
-
s = s.ptr;
|
|
3582
|
+
if (s && typeof s === "object") s = s.ptr;
|
|
3683
3583
|
_emscripten_bind_PointList_push_back_1(self2, s);
|
|
3684
3584
|
};
|
|
3685
3585
|
PointList.prototype["size"] = PointList.prototype.size = function() {
|
|
@@ -3688,8 +3588,7 @@ var Arrangement2D = (() => {
|
|
|
3688
3588
|
};
|
|
3689
3589
|
PointList.prototype["at"] = PointList.prototype.at = function(i) {
|
|
3690
3590
|
var self2 = this.ptr;
|
|
3691
|
-
if (i && typeof i === "object")
|
|
3692
|
-
i = i.ptr;
|
|
3591
|
+
if (i && typeof i === "object") i = i.ptr;
|
|
3693
3592
|
return wrapPointer(_emscripten_bind_PointList_at_1(self2, i), Point2);
|
|
3694
3593
|
};
|
|
3695
3594
|
PointList.prototype["clear"] = PointList.prototype.clear = function() {
|
|
@@ -3711,8 +3610,7 @@ var Arrangement2D = (() => {
|
|
|
3711
3610
|
Module["PolygonList"] = PolygonList;
|
|
3712
3611
|
PolygonList.prototype["push_back"] = PolygonList.prototype.push_back = function(s) {
|
|
3713
3612
|
var self2 = this.ptr;
|
|
3714
|
-
if (s && typeof s === "object")
|
|
3715
|
-
s = s.ptr;
|
|
3613
|
+
if (s && typeof s === "object") s = s.ptr;
|
|
3716
3614
|
_emscripten_bind_PolygonList_push_back_1(self2, s);
|
|
3717
3615
|
};
|
|
3718
3616
|
PolygonList.prototype["size"] = PolygonList.prototype.size = function() {
|
|
@@ -3721,8 +3619,7 @@ var Arrangement2D = (() => {
|
|
|
3721
3619
|
};
|
|
3722
3620
|
PolygonList.prototype["at"] = PolygonList.prototype.at = function(i) {
|
|
3723
3621
|
var self2 = this.ptr;
|
|
3724
|
-
if (i && typeof i === "object")
|
|
3725
|
-
i = i.ptr;
|
|
3622
|
+
if (i && typeof i === "object") i = i.ptr;
|
|
3726
3623
|
return wrapPointer(_emscripten_bind_PolygonList_at_1(self2, i), Polygon3);
|
|
3727
3624
|
};
|
|
3728
3625
|
PolygonList.prototype["clear"] = PolygonList.prototype.clear = function() {
|
|
@@ -3744,8 +3641,7 @@ var Arrangement2D = (() => {
|
|
|
3744
3641
|
Module["Contour"] = Contour;
|
|
3745
3642
|
Contour.prototype["push_back"] = Contour.prototype.push_back = function(s) {
|
|
3746
3643
|
var self2 = this.ptr;
|
|
3747
|
-
if (s && typeof s === "object")
|
|
3748
|
-
s = s.ptr;
|
|
3644
|
+
if (s && typeof s === "object") s = s.ptr;
|
|
3749
3645
|
_emscripten_bind_Contour_push_back_1(self2, s);
|
|
3750
3646
|
};
|
|
3751
3647
|
Contour.prototype["size"] = Contour.prototype.size = function() {
|
|
@@ -3754,8 +3650,7 @@ var Arrangement2D = (() => {
|
|
|
3754
3650
|
};
|
|
3755
3651
|
Contour.prototype["at"] = Contour.prototype.at = function(i) {
|
|
3756
3652
|
var self2 = this.ptr;
|
|
3757
|
-
if (i && typeof i === "object")
|
|
3758
|
-
i = i.ptr;
|
|
3653
|
+
if (i && typeof i === "object") i = i.ptr;
|
|
3759
3654
|
return wrapPointer(_emscripten_bind_Contour_at_1(self2, i), Point2);
|
|
3760
3655
|
};
|
|
3761
3656
|
Contour.prototype["clear"] = Contour.prototype.clear = function() {
|
|
@@ -3777,8 +3672,7 @@ var Arrangement2D = (() => {
|
|
|
3777
3672
|
Module["ContourList"] = ContourList;
|
|
3778
3673
|
ContourList.prototype["push_back"] = ContourList.prototype.push_back = function(s) {
|
|
3779
3674
|
var self2 = this.ptr;
|
|
3780
|
-
if (s && typeof s === "object")
|
|
3781
|
-
s = s.ptr;
|
|
3675
|
+
if (s && typeof s === "object") s = s.ptr;
|
|
3782
3676
|
_emscripten_bind_ContourList_push_back_1(self2, s);
|
|
3783
3677
|
};
|
|
3784
3678
|
ContourList.prototype["size"] = ContourList.prototype.size = function() {
|
|
@@ -3787,8 +3681,7 @@ var Arrangement2D = (() => {
|
|
|
3787
3681
|
};
|
|
3788
3682
|
ContourList.prototype["at"] = ContourList.prototype.at = function(i) {
|
|
3789
3683
|
var self2 = this.ptr;
|
|
3790
|
-
if (i && typeof i === "object")
|
|
3791
|
-
i = i.ptr;
|
|
3684
|
+
if (i && typeof i === "object") i = i.ptr;
|
|
3792
3685
|
return wrapPointer(_emscripten_bind_ContourList_at_1(self2, i), Contour);
|
|
3793
3686
|
};
|
|
3794
3687
|
ContourList.prototype["clear"] = ContourList.prototype.clear = function() {
|
|
@@ -4080,12 +3973,12 @@ function isTriDegenerated(tri) {
|
|
|
4080
3973
|
_tmp1.subVectors(tri.a, tri.b);
|
|
4081
3974
|
_tmp2.subVectors(tri.a, tri.c);
|
|
4082
3975
|
_tmp1.cross(_tmp2);
|
|
4083
|
-
return _tmp1.x > -
|
|
3976
|
+
return _tmp1.x > -1e-10 && _tmp1.x < EPSILON$1 && _tmp1.y > -1e-10 && _tmp1.y < EPSILON$1 && _tmp1.z > -1e-10 && _tmp1.z < EPSILON$1;
|
|
4084
3977
|
}
|
|
4085
3978
|
function orient3D$1(a, b, c, d) {
|
|
4086
3979
|
_matrix4.set(a.x, a.y, a.z, 1, b.x, b.y, b.z, 1, c.x, c.y, c.z, 1, d.x, d.y, d.z, 1);
|
|
4087
3980
|
const det = _matrix4.determinant();
|
|
4088
|
-
if (det < -
|
|
3981
|
+
if (det < -1e-10)
|
|
4089
3982
|
return -1;
|
|
4090
3983
|
else if (det > EPSILON$1)
|
|
4091
3984
|
return 1;
|
|
@@ -4095,7 +3988,7 @@ function orient3D$1(a, b, c, d) {
|
|
|
4095
3988
|
function orient2D(a, b, c) {
|
|
4096
3989
|
_matrix3.set(a.x, a.y, 1, b.x, b.y, 1, c.x, c.y, 1);
|
|
4097
3990
|
const det = _matrix3.determinant();
|
|
4098
|
-
if (det < -
|
|
3991
|
+
if (det < -1e-10)
|
|
4099
3992
|
return -1;
|
|
4100
3993
|
else if (det > EPSILON$1)
|
|
4101
3994
|
return 1;
|
|
@@ -4505,8 +4398,8 @@ function splitViewEdge3d(viewmap, edge, position2) {
|
|
|
4505
4398
|
_u$2.subVectors(position2, edge.a.pos3d);
|
|
4506
4399
|
_v$1.subVectors(edge.b.pos3d, edge.a.pos3d);
|
|
4507
4400
|
const cross = _u$2.cross(_v$1);
|
|
4508
|
-
const
|
|
4509
|
-
if (
|
|
4401
|
+
const v2 = cross.x + cross.y + cross.z;
|
|
4402
|
+
if (v2 > 1e-10 || v2 < -1e-10) {
|
|
4510
4403
|
return null;
|
|
4511
4404
|
}
|
|
4512
4405
|
if (_u$2.dot(_v$1) < -1e-10) {
|
|
@@ -4811,24 +4704,24 @@ function remove(i, t, comparator, tree) {
|
|
|
4811
4704
|
}
|
|
4812
4705
|
return t;
|
|
4813
4706
|
}
|
|
4814
|
-
function split(key,
|
|
4707
|
+
function split(key, v2, comparator) {
|
|
4815
4708
|
var left, right;
|
|
4816
|
-
if (
|
|
4709
|
+
if (v2 === null) {
|
|
4817
4710
|
left = right = null;
|
|
4818
4711
|
} else {
|
|
4819
|
-
|
|
4820
|
-
var cmp = comparator(
|
|
4712
|
+
v2 = splay(key, v2, comparator);
|
|
4713
|
+
var cmp = comparator(v2.key, key);
|
|
4821
4714
|
if (cmp === 0) {
|
|
4822
|
-
left =
|
|
4823
|
-
right =
|
|
4715
|
+
left = v2.left;
|
|
4716
|
+
right = v2.right;
|
|
4824
4717
|
} else if (cmp < 0) {
|
|
4825
|
-
right =
|
|
4826
|
-
|
|
4827
|
-
left =
|
|
4718
|
+
right = v2.right;
|
|
4719
|
+
v2.right = null;
|
|
4720
|
+
left = v2;
|
|
4828
4721
|
} else {
|
|
4829
|
-
left =
|
|
4830
|
-
|
|
4831
|
-
right =
|
|
4722
|
+
left = v2.left;
|
|
4723
|
+
v2.left = null;
|
|
4724
|
+
right = v2;
|
|
4832
4725
|
}
|
|
4833
4726
|
}
|
|
4834
4727
|
return { left, right };
|
|
@@ -4857,8 +4750,7 @@ function printRow(root2, prefix, isTail, out, printNode) {
|
|
|
4857
4750
|
}
|
|
4858
4751
|
}
|
|
4859
4752
|
var Tree = function Tree2(comparator) {
|
|
4860
|
-
if (comparator === void 0)
|
|
4861
|
-
comparator = DEFAULT_COMPARE;
|
|
4753
|
+
if (comparator === void 0) comparator = DEFAULT_COMPARE;
|
|
4862
4754
|
this._comparator = comparator;
|
|
4863
4755
|
this._root = null;
|
|
4864
4756
|
this._size = 0;
|
|
@@ -4997,8 +4889,7 @@ Tree.prototype.max = function max() {
|
|
|
4997
4889
|
return null;
|
|
4998
4890
|
};
|
|
4999
4891
|
Tree.prototype.minNode = function minNode(t) {
|
|
5000
|
-
if (t === void 0)
|
|
5001
|
-
t = this._root;
|
|
4892
|
+
if (t === void 0) t = this._root;
|
|
5002
4893
|
if (t) {
|
|
5003
4894
|
while (t.left) {
|
|
5004
4895
|
t = t.left;
|
|
@@ -5007,8 +4898,7 @@ Tree.prototype.minNode = function minNode(t) {
|
|
|
5007
4898
|
return t;
|
|
5008
4899
|
};
|
|
5009
4900
|
Tree.prototype.maxNode = function maxNode(t) {
|
|
5010
|
-
if (t === void 0)
|
|
5011
|
-
t = this._root;
|
|
4901
|
+
if (t === void 0) t = this._root;
|
|
5012
4902
|
if (t) {
|
|
5013
4903
|
while (t.right) {
|
|
5014
4904
|
t = t.right;
|
|
@@ -5095,12 +4985,9 @@ Tree.prototype.toList = function toList$1() {
|
|
|
5095
4985
|
return toList(this._root);
|
|
5096
4986
|
};
|
|
5097
4987
|
Tree.prototype.load = function load(keys2, values2, presort) {
|
|
5098
|
-
if (keys2 === void 0)
|
|
5099
|
-
|
|
5100
|
-
if (
|
|
5101
|
-
values2 = [];
|
|
5102
|
-
if (presort === void 0)
|
|
5103
|
-
presort = false;
|
|
4988
|
+
if (keys2 === void 0) keys2 = [];
|
|
4989
|
+
if (values2 === void 0) values2 = [];
|
|
4990
|
+
if (presort === void 0) presort = false;
|
|
5104
4991
|
var size2 = keys2.length;
|
|
5105
4992
|
var comparator = this._comparator;
|
|
5106
4993
|
if (presort) {
|
|
@@ -5123,13 +5010,12 @@ prototypeAccessors.size.get = function() {
|
|
|
5123
5010
|
return this._size;
|
|
5124
5011
|
};
|
|
5125
5012
|
Tree.prototype.toString = function toString(printNode) {
|
|
5126
|
-
if (printNode === void 0)
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
};
|
|
5013
|
+
if (printNode === void 0) printNode = function(n) {
|
|
5014
|
+
return n.key;
|
|
5015
|
+
};
|
|
5130
5016
|
var out = [];
|
|
5131
|
-
printRow(this._root, "", true, function(
|
|
5132
|
-
return out.push(
|
|
5017
|
+
printRow(this._root, "", true, function(v2) {
|
|
5018
|
+
return out.push(v2);
|
|
5133
5019
|
}, printNode);
|
|
5134
5020
|
return out.join("");
|
|
5135
5021
|
};
|
|
@@ -5207,10 +5093,9 @@ function sortedListToBST(list, start, end) {
|
|
|
5207
5093
|
return null;
|
|
5208
5094
|
}
|
|
5209
5095
|
function mergeLists(l1, l2, compare) {
|
|
5210
|
-
if (compare === void 0)
|
|
5211
|
-
|
|
5212
|
-
|
|
5213
|
-
};
|
|
5096
|
+
if (compare === void 0) compare = function(a, b) {
|
|
5097
|
+
return a - b;
|
|
5098
|
+
};
|
|
5214
5099
|
var head = {};
|
|
5215
5100
|
var p = head;
|
|
5216
5101
|
var p1 = l1;
|
|
@@ -5495,19 +5380,19 @@ function swap(values2, boxes, indices, i, j) {
|
|
|
5495
5380
|
values2[i] = values2[j];
|
|
5496
5381
|
values2[j] = temp5;
|
|
5497
5382
|
var k = 4 * i;
|
|
5498
|
-
var
|
|
5383
|
+
var m3 = 4 * j;
|
|
5499
5384
|
var a = boxes[k];
|
|
5500
5385
|
var b = boxes[k + 1];
|
|
5501
5386
|
var c = boxes[k + 2];
|
|
5502
5387
|
var d = boxes[k + 3];
|
|
5503
|
-
boxes[k] = boxes[
|
|
5504
|
-
boxes[k + 1] = boxes[
|
|
5505
|
-
boxes[k + 2] = boxes[
|
|
5506
|
-
boxes[k + 3] = boxes[
|
|
5507
|
-
boxes[
|
|
5508
|
-
boxes[
|
|
5509
|
-
boxes[
|
|
5510
|
-
boxes[
|
|
5388
|
+
boxes[k] = boxes[m3];
|
|
5389
|
+
boxes[k + 1] = boxes[m3 + 1];
|
|
5390
|
+
boxes[k + 2] = boxes[m3 + 2];
|
|
5391
|
+
boxes[k + 3] = boxes[m3 + 3];
|
|
5392
|
+
boxes[m3] = a;
|
|
5393
|
+
boxes[m3 + 1] = b;
|
|
5394
|
+
boxes[m3 + 2] = c;
|
|
5395
|
+
boxes[m3 + 3] = d;
|
|
5511
5396
|
var e = indices[i];
|
|
5512
5397
|
indices[i] = indices[j];
|
|
5513
5398
|
indices[j] = e;
|
|
@@ -5559,7 +5444,7 @@ function hilbert(x2, y2) {
|
|
|
5559
5444
|
}
|
|
5560
5445
|
function bush(lines, options) {
|
|
5561
5446
|
var results = [];
|
|
5562
|
-
var reportIntersection =
|
|
5447
|
+
var reportIntersection = defaultIntersectionReporter;
|
|
5563
5448
|
var asyncState;
|
|
5564
5449
|
var index = new Flatbush(lines.length);
|
|
5565
5450
|
lines.forEach(addToIndex);
|
|
@@ -5678,11 +5563,10 @@ function find2dSingularities(viewmap) {
|
|
|
5678
5563
|
}
|
|
5679
5564
|
}
|
|
5680
5565
|
}
|
|
5681
|
-
if (splitViewVertices.length === 0)
|
|
5682
|
-
;
|
|
5566
|
+
if (splitViewVertices.length === 0) ;
|
|
5683
5567
|
else if (splitViewVertices.length === 1) {
|
|
5684
|
-
const
|
|
5685
|
-
|
|
5568
|
+
const v2 = splitViewVertices[0];
|
|
5569
|
+
v2.singularity = ViewVertexSingularity.ImageIntersection;
|
|
5686
5570
|
} else {
|
|
5687
5571
|
const v1 = splitViewVertices[0];
|
|
5688
5572
|
const v2 = splitViewVertices[1];
|
|
@@ -5871,8 +5755,7 @@ class Viewmap {
|
|
|
5871
5755
|
const res = () => {
|
|
5872
5756
|
resolve(this.buildAsync(idx + 1, actions, info, progressCallback));
|
|
5873
5757
|
};
|
|
5874
|
-
if (this.skipActions)
|
|
5875
|
-
res();
|
|
5758
|
+
if (this.skipActions) res();
|
|
5876
5759
|
else {
|
|
5877
5760
|
actions[idx].process().catch((_) => {
|
|
5878
5761
|
}).then(res);
|
|
@@ -6017,10 +5900,10 @@ class Viewmap {
|
|
|
6017
5900
|
}
|
|
6018
5901
|
const methods$1 = {};
|
|
6019
5902
|
const names = [];
|
|
6020
|
-
function registerMethods(name,
|
|
5903
|
+
function registerMethods(name, m3) {
|
|
6021
5904
|
if (Array.isArray(name)) {
|
|
6022
5905
|
for (const _name of name) {
|
|
6023
|
-
registerMethods(_name,
|
|
5906
|
+
registerMethods(_name, m3);
|
|
6024
5907
|
}
|
|
6025
5908
|
return;
|
|
6026
5909
|
}
|
|
@@ -6030,8 +5913,8 @@ function registerMethods(name, m) {
|
|
|
6030
5913
|
}
|
|
6031
5914
|
return;
|
|
6032
5915
|
}
|
|
6033
|
-
addMethodNames(Object.getOwnPropertyNames(
|
|
6034
|
-
methods$1[name] = Object.assign(methods$1[name] || {},
|
|
5916
|
+
addMethodNames(Object.getOwnPropertyNames(m3));
|
|
5917
|
+
methods$1[name] = Object.assign(methods$1[name] || {}, m3);
|
|
6035
5918
|
}
|
|
6036
5919
|
function getMethodsFor(name) {
|
|
6037
5920
|
return methods$1[name] || {};
|
|
@@ -6066,12 +5949,12 @@ function radians(d) {
|
|
|
6066
5949
|
return d % 360 * Math.PI / 180;
|
|
6067
5950
|
}
|
|
6068
5951
|
function camelCase(s) {
|
|
6069
|
-
return s.toLowerCase().replace(/-(.)/g, function(
|
|
5952
|
+
return s.toLowerCase().replace(/-(.)/g, function(m3, g) {
|
|
6070
5953
|
return g.toUpperCase();
|
|
6071
5954
|
});
|
|
6072
5955
|
}
|
|
6073
5956
|
function unCamelCase(s) {
|
|
6074
|
-
return s.replace(/([A-Z])/g, function(
|
|
5957
|
+
return s.replace(/([A-Z])/g, function(m3, g) {
|
|
6075
5958
|
return "-" + g.toLowerCase();
|
|
6076
5959
|
});
|
|
6077
5960
|
}
|
|
@@ -6142,8 +6025,7 @@ function create(name, ns = svg) {
|
|
|
6142
6025
|
return globals.document.createElementNS(ns, name);
|
|
6143
6026
|
}
|
|
6144
6027
|
function makeInstance(element, isHTML = false) {
|
|
6145
|
-
if (element instanceof Base)
|
|
6146
|
-
return element;
|
|
6028
|
+
if (element instanceof Base) return element;
|
|
6147
6029
|
if (typeof element === "object") {
|
|
6148
6030
|
return adopter(element);
|
|
6149
6031
|
}
|
|
@@ -6163,10 +6045,8 @@ function nodeOrNew(name, node) {
|
|
|
6163
6045
|
return node && node.ownerDocument && node instanceof node.ownerDocument.defaultView.Node ? node : create(name);
|
|
6164
6046
|
}
|
|
6165
6047
|
function adopt(node) {
|
|
6166
|
-
if (!node)
|
|
6167
|
-
|
|
6168
|
-
if (node.instance instanceof Base)
|
|
6169
|
-
return node.instance;
|
|
6048
|
+
if (!node) return null;
|
|
6049
|
+
if (node.instance instanceof Base) return node.instance;
|
|
6170
6050
|
if (node.nodeName === "#document-fragment") {
|
|
6171
6051
|
return new elements.Fragment(node);
|
|
6172
6052
|
}
|
|
@@ -6181,8 +6061,7 @@ function adopt(node) {
|
|
|
6181
6061
|
let adopter = adopt;
|
|
6182
6062
|
function register(element, name = element.name, asRoot = false) {
|
|
6183
6063
|
elements[name] = element;
|
|
6184
|
-
if (asRoot)
|
|
6185
|
-
elements[root] = element;
|
|
6064
|
+
if (asRoot) elements[root] = element;
|
|
6186
6065
|
addMethodNames(Object.getOwnPropertyNames(element.prototype));
|
|
6187
6066
|
return element;
|
|
6188
6067
|
}
|
|
@@ -6388,7 +6267,7 @@ registerMethods("Dom", {
|
|
|
6388
6267
|
hide,
|
|
6389
6268
|
visible
|
|
6390
6269
|
});
|
|
6391
|
-
function data(a,
|
|
6270
|
+
function data(a, v2, r) {
|
|
6392
6271
|
if (a == null) {
|
|
6393
6272
|
return this.data(map(filter(this.node.attributes, (el) => el.nodeName.indexOf("data-") === 0), (el) => el.nodeName.slice(5)));
|
|
6394
6273
|
} else if (a instanceof Array) {
|
|
@@ -6398,8 +6277,8 @@ function data(a, v, r) {
|
|
|
6398
6277
|
}
|
|
6399
6278
|
return data2;
|
|
6400
6279
|
} else if (typeof a === "object") {
|
|
6401
|
-
for (
|
|
6402
|
-
this.data(
|
|
6280
|
+
for (v2 in a) {
|
|
6281
|
+
this.data(v2, a[v2]);
|
|
6403
6282
|
}
|
|
6404
6283
|
} else if (arguments.length < 2) {
|
|
6405
6284
|
try {
|
|
@@ -6408,14 +6287,14 @@ function data(a, v, r) {
|
|
|
6408
6287
|
return this.attr("data-" + a);
|
|
6409
6288
|
}
|
|
6410
6289
|
} else {
|
|
6411
|
-
this.attr("data-" + a,
|
|
6290
|
+
this.attr("data-" + a, v2 === null ? null : r === true || typeof v2 === "string" || typeof v2 === "number" ? v2 : JSON.stringify(v2));
|
|
6412
6291
|
}
|
|
6413
6292
|
return this;
|
|
6414
6293
|
}
|
|
6415
6294
|
registerMethods("Dom", {
|
|
6416
6295
|
data
|
|
6417
6296
|
});
|
|
6418
|
-
function remember(k,
|
|
6297
|
+
function remember(k, v2) {
|
|
6419
6298
|
if (typeof arguments[0] === "object") {
|
|
6420
6299
|
for (const key in k) {
|
|
6421
6300
|
this.remember(key, k[key]);
|
|
@@ -6423,7 +6302,7 @@ function remember(k, v) {
|
|
|
6423
6302
|
} else if (arguments.length === 1) {
|
|
6424
6303
|
return this.memory()[k];
|
|
6425
6304
|
} else {
|
|
6426
|
-
this.memory()[k] =
|
|
6305
|
+
this.memory()[k] = v2;
|
|
6427
6306
|
}
|
|
6428
6307
|
return this;
|
|
6429
6308
|
}
|
|
@@ -6516,16 +6395,11 @@ function cieSpace(space) {
|
|
|
6516
6395
|
}
|
|
6517
6396
|
}
|
|
6518
6397
|
function hueToRgb(p, q, t) {
|
|
6519
|
-
if (t < 0)
|
|
6520
|
-
|
|
6521
|
-
if (t
|
|
6522
|
-
|
|
6523
|
-
if (t <
|
|
6524
|
-
return p + (q - p) * 6 * t;
|
|
6525
|
-
if (t < 1 / 2)
|
|
6526
|
-
return q;
|
|
6527
|
-
if (t < 2 / 3)
|
|
6528
|
-
return p + (q - p) * (2 / 3 - t) * 6;
|
|
6398
|
+
if (t < 0) t += 1;
|
|
6399
|
+
if (t > 1) t -= 1;
|
|
6400
|
+
if (t < 1 / 6) return p + (q - p) * 6 * t;
|
|
6401
|
+
if (t < 1 / 2) return q;
|
|
6402
|
+
if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
|
|
6529
6403
|
return p;
|
|
6530
6404
|
}
|
|
6531
6405
|
class Color {
|
|
@@ -6605,15 +6479,15 @@ class Color {
|
|
|
6605
6479
|
_b,
|
|
6606
6480
|
_c
|
|
6607
6481
|
} = this.rgb();
|
|
6608
|
-
const [r, g, b] = [_a, _b, _c].map((
|
|
6482
|
+
const [r, g, b] = [_a, _b, _c].map((v2) => v2 / 255);
|
|
6609
6483
|
const k = Math.min(1 - r, 1 - g, 1 - b);
|
|
6610
6484
|
if (k === 1) {
|
|
6611
6485
|
return new Color(0, 0, 0, 1, "cmyk");
|
|
6612
6486
|
}
|
|
6613
6487
|
const c = (1 - r - k) / (1 - k);
|
|
6614
|
-
const
|
|
6488
|
+
const m3 = (1 - g - k) / (1 - k);
|
|
6615
6489
|
const y2 = (1 - b - k) / (1 - k);
|
|
6616
|
-
const color = new Color(c,
|
|
6490
|
+
const color = new Color(c, m3, y2, k, "cmyk");
|
|
6617
6491
|
return color;
|
|
6618
6492
|
}
|
|
6619
6493
|
hsl() {
|
|
@@ -6622,7 +6496,7 @@ class Color {
|
|
|
6622
6496
|
_b,
|
|
6623
6497
|
_c
|
|
6624
6498
|
} = this.rgb();
|
|
6625
|
-
const [r, g, b] = [_a, _b, _c].map((
|
|
6499
|
+
const [r, g, b] = [_a, _b, _c].map((v2) => v2 / 255);
|
|
6626
6500
|
const max2 = Math.max(r, g, b);
|
|
6627
6501
|
const min2 = Math.min(r, g, b);
|
|
6628
6502
|
const l = (max2 + min2) / 2;
|
|
@@ -6664,7 +6538,7 @@ class Color {
|
|
|
6664
6538
|
} else if (typeof a === "string") {
|
|
6665
6539
|
if (isRgb.test(a)) {
|
|
6666
6540
|
const noWhitespace = a.replace(whitespace, "");
|
|
6667
|
-
const [_a2, _b2, _c2] = rgb.exec(noWhitespace).slice(1, 4).map((
|
|
6541
|
+
const [_a2, _b2, _c2] = rgb.exec(noWhitespace).slice(1, 4).map((v2) => parseInt(v2));
|
|
6668
6542
|
Object.assign(this, {
|
|
6669
6543
|
_a: _a2,
|
|
6670
6544
|
_b: _b2,
|
|
@@ -6673,7 +6547,7 @@ class Color {
|
|
|
6673
6547
|
space: "rgb"
|
|
6674
6548
|
});
|
|
6675
6549
|
} else if (isHex.test(a)) {
|
|
6676
|
-
const hexParse = (
|
|
6550
|
+
const hexParse = (v2) => parseInt(v2, 16);
|
|
6677
6551
|
const [, _a2, _b2, _c2] = hex.exec(sixDigitHex(a)).map(hexParse);
|
|
6678
6552
|
Object.assign(this, {
|
|
6679
6553
|
_a: _a2,
|
|
@@ -6682,8 +6556,7 @@ class Color {
|
|
|
6682
6556
|
_d: 0,
|
|
6683
6557
|
space: "rgb"
|
|
6684
6558
|
});
|
|
6685
|
-
} else
|
|
6686
|
-
throw Error("Unsupported string format, can't construct Color");
|
|
6559
|
+
} else throw Error("Unsupported string format, can't construct Color");
|
|
6687
6560
|
}
|
|
6688
6561
|
const {
|
|
6689
6562
|
_a,
|
|
@@ -6817,12 +6690,12 @@ class Color {
|
|
|
6817
6690
|
} else if (this.space === "cmyk") {
|
|
6818
6691
|
const {
|
|
6819
6692
|
c,
|
|
6820
|
-
m,
|
|
6693
|
+
m: m3,
|
|
6821
6694
|
y: y2,
|
|
6822
6695
|
k
|
|
6823
6696
|
} = this;
|
|
6824
6697
|
const r = 255 * (1 - Math.min(1, c * (1 - k) + k));
|
|
6825
|
-
const g = 255 * (1 - Math.min(1,
|
|
6698
|
+
const g = 255 * (1 - Math.min(1, m3 * (1 - k) + k));
|
|
6826
6699
|
const b = 255 * (1 - Math.min(1, y2 * (1 - k) + k));
|
|
6827
6700
|
const color = new Color(r, g, b);
|
|
6828
6701
|
return color;
|
|
@@ -6858,7 +6731,7 @@ class Color {
|
|
|
6858
6731
|
_b: g255,
|
|
6859
6732
|
_c: b255
|
|
6860
6733
|
} = this.rgb();
|
|
6861
|
-
const [r, g, b] = [r255, g255, b255].map((
|
|
6734
|
+
const [r, g, b] = [r255, g255, b255].map((v2) => v2 / 255);
|
|
6862
6735
|
const rL = r > 0.04045 ? Math.pow((r + 0.055) / 1.055, 2.4) : r / 12.92;
|
|
6863
6736
|
const gL = g > 0.04045 ? Math.pow((g + 0.055) / 1.055, 2.4) : g / 12.92;
|
|
6864
6737
|
const bL = b > 0.04045 ? Math.pow((b + 0.055) / 1.055, 2.4) : b / 12.92;
|
|
@@ -6885,7 +6758,7 @@ class Color {
|
|
|
6885
6758
|
min: min2,
|
|
6886
6759
|
round: round2
|
|
6887
6760
|
} = Math;
|
|
6888
|
-
const format = (
|
|
6761
|
+
const format = (v2) => max2(0, min2(round2(v2), 255));
|
|
6889
6762
|
return [_a, _b, _c].map(format);
|
|
6890
6763
|
}
|
|
6891
6764
|
/*
|
|
@@ -6923,20 +6796,20 @@ class Point {
|
|
|
6923
6796
|
toArray() {
|
|
6924
6797
|
return [this.x, this.y];
|
|
6925
6798
|
}
|
|
6926
|
-
transform(
|
|
6927
|
-
return this.clone().transformO(
|
|
6799
|
+
transform(m3) {
|
|
6800
|
+
return this.clone().transformO(m3);
|
|
6928
6801
|
}
|
|
6929
6802
|
// Transform point with matrix
|
|
6930
|
-
transformO(
|
|
6931
|
-
if (!Matrix.isMatrixLike(
|
|
6932
|
-
|
|
6803
|
+
transformO(m3) {
|
|
6804
|
+
if (!Matrix.isMatrixLike(m3)) {
|
|
6805
|
+
m3 = new Matrix(m3);
|
|
6933
6806
|
}
|
|
6934
6807
|
const {
|
|
6935
6808
|
x: x2,
|
|
6936
6809
|
y: y2
|
|
6937
6810
|
} = this;
|
|
6938
|
-
this.x =
|
|
6939
|
-
this.y =
|
|
6811
|
+
this.x = m3.a * x2 + m3.c * y2 + m3.e;
|
|
6812
|
+
this.y = m3.b * x2 + m3.d * y2 + m3.f;
|
|
6940
6813
|
return this;
|
|
6941
6814
|
}
|
|
6942
6815
|
}
|
|
@@ -6944,7 +6817,7 @@ function point(x2, y2) {
|
|
|
6944
6817
|
return new Point(x2, y2).transformO(this.screenCTM().inverseO());
|
|
6945
6818
|
}
|
|
6946
6819
|
function closeEnough(a, b, threshold) {
|
|
6947
|
-
return Math.abs(b - a) <
|
|
6820
|
+
return Math.abs(b - a) < 1e-6;
|
|
6948
6821
|
}
|
|
6949
6822
|
class Matrix {
|
|
6950
6823
|
constructor(...args) {
|
|
@@ -7071,8 +6944,7 @@ class Matrix {
|
|
|
7071
6944
|
}
|
|
7072
6945
|
// Check if two matrices are equal
|
|
7073
6946
|
equals(other) {
|
|
7074
|
-
if (other === this)
|
|
7075
|
-
return true;
|
|
6947
|
+
if (other === this) return true;
|
|
7076
6948
|
const comp = new Matrix(other);
|
|
7077
6949
|
return closeEnough(this.a, comp.a) && closeEnough(this.b, comp.b) && closeEnough(this.c, comp.c) && closeEnough(this.d, comp.d) && closeEnough(this.e, comp.e) && closeEnough(this.f, comp.f);
|
|
7078
6950
|
}
|
|
@@ -7107,8 +6979,7 @@ class Matrix {
|
|
|
7107
6979
|
const e = this.e;
|
|
7108
6980
|
const f = this.f;
|
|
7109
6981
|
const det = a * d - b * c;
|
|
7110
|
-
if (!det)
|
|
7111
|
-
throw new Error("Cannot invert " + this);
|
|
6982
|
+
if (!det) throw new Error("Cannot invert " + this);
|
|
7112
6983
|
const na = d / det;
|
|
7113
6984
|
const nb = -b / det;
|
|
7114
6985
|
const nc = -c / det;
|
|
@@ -7301,9 +7172,9 @@ function ctm() {
|
|
|
7301
7172
|
function screenCTM() {
|
|
7302
7173
|
if (typeof this.isRoot === "function" && !this.isRoot()) {
|
|
7303
7174
|
const rect = this.rect(1, 1);
|
|
7304
|
-
const
|
|
7175
|
+
const m3 = rect.node.getScreenCTM();
|
|
7305
7176
|
rect.remove();
|
|
7306
|
-
return new Matrix(
|
|
7177
|
+
return new Matrix(m3);
|
|
7307
7178
|
}
|
|
7308
7179
|
return new Matrix(this.node.getScreenCTM());
|
|
7309
7180
|
}
|
|
@@ -7376,9 +7247,9 @@ class Box {
|
|
|
7376
7247
|
toString() {
|
|
7377
7248
|
return this.x + " " + this.y + " " + this.width + " " + this.height;
|
|
7378
7249
|
}
|
|
7379
|
-
transform(
|
|
7380
|
-
if (!(
|
|
7381
|
-
|
|
7250
|
+
transform(m3) {
|
|
7251
|
+
if (!(m3 instanceof Matrix)) {
|
|
7252
|
+
m3 = new Matrix(m3);
|
|
7382
7253
|
}
|
|
7383
7254
|
let xMin = Infinity;
|
|
7384
7255
|
let xMax = -Infinity;
|
|
@@ -7386,7 +7257,7 @@ class Box {
|
|
|
7386
7257
|
let yMax = -Infinity;
|
|
7387
7258
|
const pts = [new Point(this.x, this.y), new Point(this.x2, this.y), new Point(this.x, this.y2), new Point(this.x2, this.y2)];
|
|
7388
7259
|
pts.forEach(function(p) {
|
|
7389
|
-
p = p.transform(
|
|
7260
|
+
p = p.transform(m3);
|
|
7390
7261
|
xMin = Math.min(xMin, p.x);
|
|
7391
7262
|
xMax = Math.max(xMax, p.x);
|
|
7392
7263
|
yMin = Math.min(yMin, p.y);
|
|
@@ -7442,8 +7313,7 @@ function inside(x2, y2) {
|
|
|
7442
7313
|
registerMethods({
|
|
7443
7314
|
viewbox: {
|
|
7444
7315
|
viewbox(x2, y2, width2, height2) {
|
|
7445
|
-
if (x2 == null)
|
|
7446
|
-
return new Box(this.attr("viewBox"));
|
|
7316
|
+
if (x2 == null) return new Box(this.attr("viewBox"));
|
|
7447
7317
|
return this.attr("viewBox", new Box(x2, y2, width2, height2));
|
|
7448
7318
|
},
|
|
7449
7319
|
zoom(level, point2) {
|
|
@@ -7458,18 +7328,17 @@ registerMethods({
|
|
|
7458
7328
|
if (!width2 || !height2) {
|
|
7459
7329
|
throw new Error("Impossible to get absolute width and height. Please provide an absolute width and height attribute on the zooming element");
|
|
7460
7330
|
}
|
|
7461
|
-
const
|
|
7462
|
-
const zoomX = width2 /
|
|
7463
|
-
const zoomY = height2 /
|
|
7331
|
+
const v2 = this.viewbox();
|
|
7332
|
+
const zoomX = width2 / v2.width;
|
|
7333
|
+
const zoomY = height2 / v2.height;
|
|
7464
7334
|
const zoom = Math.min(zoomX, zoomY);
|
|
7465
7335
|
if (level == null) {
|
|
7466
7336
|
return zoom;
|
|
7467
7337
|
}
|
|
7468
7338
|
let zoomAmount = zoom / level;
|
|
7469
|
-
if (zoomAmount === Infinity)
|
|
7470
|
-
|
|
7471
|
-
|
|
7472
|
-
const box = new Box(v).transform(new Matrix({
|
|
7339
|
+
if (zoomAmount === Infinity) zoomAmount = Number.MAX_SAFE_INTEGER / 100;
|
|
7340
|
+
point2 = point2 || new Point(width2 / 2 / zoomX + v2.x, height2 / 2 / zoomY + v2.y);
|
|
7341
|
+
const box = new Box(v2).transform(new Matrix({
|
|
7473
7342
|
scale: zoomAmount,
|
|
7474
7343
|
origin: point2
|
|
7475
7344
|
}));
|
|
@@ -7481,8 +7350,7 @@ register(Box, "Box");
|
|
|
7481
7350
|
class List extends Array {
|
|
7482
7351
|
constructor(arr = [], ...args) {
|
|
7483
7352
|
super(arr, ...args);
|
|
7484
|
-
if (typeof arr === "number")
|
|
7485
|
-
return this;
|
|
7353
|
+
if (typeof arr === "number") return this;
|
|
7486
7354
|
this.length = 0;
|
|
7487
7355
|
this.push(...arr);
|
|
7488
7356
|
}
|
|
@@ -7506,10 +7374,8 @@ extend([List], {
|
|
|
7506
7374
|
const reserved = ["toArray", "constructor", "each"];
|
|
7507
7375
|
List.extend = function(methods2) {
|
|
7508
7376
|
methods2 = methods2.reduce((obj, name) => {
|
|
7509
|
-
if (reserved.includes(name))
|
|
7510
|
-
|
|
7511
|
-
if (name[0] === "_")
|
|
7512
|
-
return obj;
|
|
7377
|
+
if (reserved.includes(name)) return obj;
|
|
7378
|
+
if (name[0] === "_") return obj;
|
|
7513
7379
|
obj[name] = function(...attrs2) {
|
|
7514
7380
|
return this.each(name, ...attrs2);
|
|
7515
7381
|
};
|
|
@@ -7532,10 +7398,8 @@ let listenerId = 0;
|
|
|
7532
7398
|
const windowEvents = {};
|
|
7533
7399
|
function getEvents(instance) {
|
|
7534
7400
|
let n = instance.getEventHolder();
|
|
7535
|
-
if (n === globals.window)
|
|
7536
|
-
|
|
7537
|
-
if (!n.events)
|
|
7538
|
-
n.events = {};
|
|
7401
|
+
if (n === globals.window) n = windowEvents;
|
|
7402
|
+
if (!n.events) n.events = {};
|
|
7539
7403
|
return n.events;
|
|
7540
7404
|
}
|
|
7541
7405
|
function getEventTarget(instance) {
|
|
@@ -7543,10 +7407,8 @@ function getEventTarget(instance) {
|
|
|
7543
7407
|
}
|
|
7544
7408
|
function clearEvents(instance) {
|
|
7545
7409
|
let n = instance.getEventHolder();
|
|
7546
|
-
if (n === globals.window)
|
|
7547
|
-
|
|
7548
|
-
if (n.events)
|
|
7549
|
-
n.events = {};
|
|
7410
|
+
if (n === globals.window) n = windowEvents;
|
|
7411
|
+
if (n.events) n.events = {};
|
|
7550
7412
|
}
|
|
7551
7413
|
function on(node, events, listener, binding, options) {
|
|
7552
7414
|
const l = listener.bind(binding || node);
|
|
@@ -7572,8 +7434,7 @@ function off(node, events, listener, options) {
|
|
|
7572
7434
|
const n = getEventTarget(instance);
|
|
7573
7435
|
if (typeof listener === "function") {
|
|
7574
7436
|
listener = listener._svgjsListenerId;
|
|
7575
|
-
if (!listener)
|
|
7576
|
-
return;
|
|
7437
|
+
if (!listener) return;
|
|
7577
7438
|
}
|
|
7578
7439
|
events = Array.isArray(events) ? events : (events || "").split(delimiter);
|
|
7579
7440
|
events.forEach(function(event) {
|
|
@@ -7637,8 +7498,7 @@ class EventTarget extends Base {
|
|
|
7637
7498
|
}
|
|
7638
7499
|
dispatchEvent(event) {
|
|
7639
7500
|
const bag = this.getEventHolder().events;
|
|
7640
|
-
if (!bag)
|
|
7641
|
-
return true;
|
|
7501
|
+
if (!bag) return true;
|
|
7642
7502
|
const events = bag[event.type];
|
|
7643
7503
|
for (const i in events) {
|
|
7644
7504
|
for (const j in events[i]) {
|
|
@@ -7717,16 +7577,14 @@ class SVGArray extends Array {
|
|
|
7717
7577
|
return new this.constructor(this);
|
|
7718
7578
|
}
|
|
7719
7579
|
init(arr) {
|
|
7720
|
-
if (typeof arr === "number")
|
|
7721
|
-
return this;
|
|
7580
|
+
if (typeof arr === "number") return this;
|
|
7722
7581
|
this.length = 0;
|
|
7723
7582
|
this.push(...this.parse(arr));
|
|
7724
7583
|
return this;
|
|
7725
7584
|
}
|
|
7726
7585
|
// Parse whitespace separated string
|
|
7727
7586
|
parse(array2 = []) {
|
|
7728
|
-
if (array2 instanceof Array)
|
|
7729
|
-
return array2;
|
|
7587
|
+
if (array2 instanceof Array) return array2;
|
|
7730
7588
|
return array2.trim().split(delimiter).map(parseFloat);
|
|
7731
7589
|
}
|
|
7732
7590
|
toArray() {
|
|
@@ -7830,8 +7688,7 @@ function attr(attr2, val, ns) {
|
|
|
7830
7688
|
return last;
|
|
7831
7689
|
}, {});
|
|
7832
7690
|
} else if (typeof attr2 === "object" && attr2.constructor === Object) {
|
|
7833
|
-
for (val in attr2)
|
|
7834
|
-
this.attr(val, attr2[val]);
|
|
7691
|
+
for (val in attr2) this.attr(val, attr2[val]);
|
|
7835
7692
|
} else if (val === null) {
|
|
7836
7693
|
this.node.removeAttribute(attr2);
|
|
7837
7694
|
} else if (val == null) {
|
|
@@ -7969,14 +7826,11 @@ class Dom extends EventTarget {
|
|
|
7969
7826
|
// Returns the parent element instance
|
|
7970
7827
|
parent(type) {
|
|
7971
7828
|
let parent = this;
|
|
7972
|
-
if (!parent.node.parentNode)
|
|
7973
|
-
return null;
|
|
7829
|
+
if (!parent.node.parentNode) return null;
|
|
7974
7830
|
parent = adopt(parent.node.parentNode);
|
|
7975
|
-
if (!type)
|
|
7976
|
-
return parent;
|
|
7831
|
+
if (!type) return parent;
|
|
7977
7832
|
do {
|
|
7978
|
-
if (typeof type === "string" ? parent.matches(type) : parent instanceof type)
|
|
7979
|
-
return parent;
|
|
7833
|
+
if (typeof type === "string" ? parent.matches(type) : parent instanceof type) return parent;
|
|
7980
7834
|
} while (parent = adopt(parent.node.parentNode));
|
|
7981
7835
|
return parent;
|
|
7982
7836
|
}
|
|
@@ -8064,8 +7918,7 @@ class Dom extends EventTarget {
|
|
|
8064
7918
|
if (outerXML) {
|
|
8065
7919
|
const result = xmlOrFn(current);
|
|
8066
7920
|
current = result || current;
|
|
8067
|
-
if (result === false)
|
|
8068
|
-
return "";
|
|
7921
|
+
if (result === false) return "";
|
|
8069
7922
|
}
|
|
8070
7923
|
current.each(function() {
|
|
8071
7924
|
const result = xmlOrFn(this);
|
|
@@ -8170,10 +8023,9 @@ class Element extends Dom {
|
|
|
8170
8023
|
// Get referenced element form attribute value
|
|
8171
8024
|
reference(attr2) {
|
|
8172
8025
|
attr2 = this.attr(attr2);
|
|
8173
|
-
if (!attr2)
|
|
8174
|
-
|
|
8175
|
-
|
|
8176
|
-
return m ? makeInstance(m[1]) : null;
|
|
8026
|
+
if (!attr2) return null;
|
|
8027
|
+
const m3 = (attr2 + "").match(reference);
|
|
8028
|
+
return m3 ? makeInstance(m3[1]) : null;
|
|
8177
8029
|
}
|
|
8178
8030
|
// Get parent document
|
|
8179
8031
|
root() {
|
|
@@ -8227,19 +8079,19 @@ const sugar = {
|
|
|
8227
8079
|
return a === "color" ? t : t + "-" + a;
|
|
8228
8080
|
}
|
|
8229
8081
|
};
|
|
8230
|
-
["fill", "stroke"].forEach(function(
|
|
8082
|
+
["fill", "stroke"].forEach(function(m3) {
|
|
8231
8083
|
const extension = {};
|
|
8232
8084
|
let i;
|
|
8233
|
-
extension[
|
|
8085
|
+
extension[m3] = function(o) {
|
|
8234
8086
|
if (typeof o === "undefined") {
|
|
8235
|
-
return this.attr(
|
|
8087
|
+
return this.attr(m3);
|
|
8236
8088
|
}
|
|
8237
8089
|
if (typeof o === "string" || o instanceof Color || Color.isRgb(o) || o instanceof Element) {
|
|
8238
|
-
this.attr(
|
|
8090
|
+
this.attr(m3, o);
|
|
8239
8091
|
} else {
|
|
8240
|
-
for (i = sugar[
|
|
8241
|
-
if (o[sugar[
|
|
8242
|
-
this.attr(sugar.prefix(
|
|
8092
|
+
for (i = sugar[m3].length - 1; i >= 0; i--) {
|
|
8093
|
+
if (o[sugar[m3][i]] != null) {
|
|
8094
|
+
this.attr(sugar.prefix(m3, sugar[m3][i]), o[sugar[m3][i]]);
|
|
8243
8095
|
}
|
|
8244
8096
|
}
|
|
8245
8097
|
}
|
|
@@ -8341,13 +8193,12 @@ registerMethods("Path", {
|
|
|
8341
8193
|
});
|
|
8342
8194
|
registerMethods(["Element", "Runner"], {
|
|
8343
8195
|
// Set font
|
|
8344
|
-
font: function(a,
|
|
8196
|
+
font: function(a, v2) {
|
|
8345
8197
|
if (typeof a === "object") {
|
|
8346
|
-
for (
|
|
8347
|
-
this.font(v, a[v]);
|
|
8198
|
+
for (v2 in a) this.font(v2, a[v2]);
|
|
8348
8199
|
return this;
|
|
8349
8200
|
}
|
|
8350
|
-
return a === "leading" ? this.leading(
|
|
8201
|
+
return a === "leading" ? this.leading(v2) : a === "anchor" ? this.attr("text-anchor", v2) : a === "size" || a === "family" || a === "weight" || a === "stretch" || a === "variant" || a === "style" ? this.attr("font-" + a, v2) : this.attr(a, v2);
|
|
8351
8202
|
}
|
|
8352
8203
|
});
|
|
8353
8204
|
const methods = ["click", "dblclick", "mousedown", "mouseup", "mouseover", "mouseout", "mousemove", "mouseenter", "mouseleave", "touchstart", "touchmove", "touchleave", "touchend", "touchcancel"].reduce(function(last, event) {
|
|
@@ -8381,8 +8232,7 @@ function matrixify() {
|
|
|
8381
8232
|
return matrix;
|
|
8382
8233
|
}
|
|
8383
8234
|
function toParent(parent, i) {
|
|
8384
|
-
if (this === parent)
|
|
8385
|
-
return this;
|
|
8235
|
+
if (this === parent) return this;
|
|
8386
8236
|
const ctm2 = this.screenCTM();
|
|
8387
8237
|
const pCtm = parent.screenCTM().inverse();
|
|
8388
8238
|
this.addTo(parent, i).untransform().transform(pCtm.multiply(ctm2));
|
|
@@ -8547,8 +8397,7 @@ class Gradient extends Container {
|
|
|
8547
8397
|
}
|
|
8548
8398
|
// custom attr to handle transform
|
|
8549
8399
|
attr(a, b, c) {
|
|
8550
|
-
if (a === "transform")
|
|
8551
|
-
a = "gradientTransform";
|
|
8400
|
+
if (a === "transform") a = "gradientTransform";
|
|
8552
8401
|
return super.attr(a, b, c);
|
|
8553
8402
|
}
|
|
8554
8403
|
bbox() {
|
|
@@ -8597,8 +8446,7 @@ class Pattern extends Container {
|
|
|
8597
8446
|
}
|
|
8598
8447
|
// custom attr to handle transform
|
|
8599
8448
|
attr(a, b, c) {
|
|
8600
|
-
if (a === "transform")
|
|
8601
|
-
a = "patternTransform";
|
|
8449
|
+
if (a === "transform") a = "patternTransform";
|
|
8602
8450
|
return super.attr(a, b, c);
|
|
8603
8451
|
}
|
|
8604
8452
|
bbox() {
|
|
@@ -8650,8 +8498,7 @@ class Image extends Shape {
|
|
|
8650
8498
|
}
|
|
8651
8499
|
// (re)load image
|
|
8652
8500
|
load(url, callback) {
|
|
8653
|
-
if (!url)
|
|
8654
|
-
return this;
|
|
8501
|
+
if (!url) return this;
|
|
8655
8502
|
const img = new globals.window.Image();
|
|
8656
8503
|
on(img, "load", function(e) {
|
|
8657
8504
|
const p = this.parent(Pattern);
|
|
@@ -8730,8 +8577,7 @@ class PointArray extends SVGArray {
|
|
|
8730
8577
|
} else {
|
|
8731
8578
|
array2 = array2.trim().split(delimiter).map(parseFloat);
|
|
8732
8579
|
}
|
|
8733
|
-
if (array2.length % 2 !== 0)
|
|
8734
|
-
array2.pop();
|
|
8580
|
+
if (array2.length % 2 !== 0) array2.pop();
|
|
8735
8581
|
for (let i = 0, len = array2.length; i < len; i = i + 2) {
|
|
8736
8582
|
points.push([array2[i], array2[i + 1]]);
|
|
8737
8583
|
}
|
|
@@ -8742,10 +8588,8 @@ class PointArray extends SVGArray {
|
|
|
8742
8588
|
let i;
|
|
8743
8589
|
const box = this.bbox();
|
|
8744
8590
|
for (i = this.length - 1; i >= 0; i--) {
|
|
8745
|
-
if (box.width)
|
|
8746
|
-
|
|
8747
|
-
if (box.height)
|
|
8748
|
-
this[i][1] = (this[i][1] - box.y) * height2 / box.height + box.y;
|
|
8591
|
+
if (box.width) this[i][0] = (this[i][0] - box.x) * width2 / box.width + box.x;
|
|
8592
|
+
if (box.height) this[i][1] = (this[i][1] - box.y) * height2 / box.height + box.y;
|
|
8749
8593
|
}
|
|
8750
8594
|
return this;
|
|
8751
8595
|
}
|
|
@@ -8766,18 +8610,18 @@ class PointArray extends SVGArray {
|
|
|
8766
8610
|
}
|
|
8767
8611
|
return array2.join(" ");
|
|
8768
8612
|
}
|
|
8769
|
-
transform(
|
|
8770
|
-
return this.clone().transformO(
|
|
8613
|
+
transform(m3) {
|
|
8614
|
+
return this.clone().transformO(m3);
|
|
8771
8615
|
}
|
|
8772
8616
|
// transform points with matrix (similar to Point.transform)
|
|
8773
|
-
transformO(
|
|
8774
|
-
if (!Matrix.isMatrixLike(
|
|
8775
|
-
|
|
8617
|
+
transformO(m3) {
|
|
8618
|
+
if (!Matrix.isMatrixLike(m3)) {
|
|
8619
|
+
m3 = new Matrix(m3);
|
|
8776
8620
|
}
|
|
8777
8621
|
for (let i = this.length; i--; ) {
|
|
8778
8622
|
const [x2, y2] = this[i];
|
|
8779
|
-
this[i][0] =
|
|
8780
|
-
this[i][1] =
|
|
8623
|
+
this[i][0] = m3.a * x2 + m3.c * y2 + m3.e;
|
|
8624
|
+
this[i][1] = m3.b * x2 + m3.d * y2 + m3.f;
|
|
8781
8625
|
}
|
|
8782
8626
|
return this;
|
|
8783
8627
|
}
|
|
@@ -8899,8 +8743,7 @@ registerMethods({
|
|
|
8899
8743
|
// Create and attach markers
|
|
8900
8744
|
marker(marker, width2, height2, block) {
|
|
8901
8745
|
let attr2 = ["marker"];
|
|
8902
|
-
if (marker !== "all")
|
|
8903
|
-
attr2.push(marker);
|
|
8746
|
+
if (marker !== "all") attr2.push(marker);
|
|
8904
8747
|
attr2 = attr2.join("-");
|
|
8905
8748
|
marker = arguments[1] instanceof Marker ? arguments[1] : this.defs().marker(width2, height2, block);
|
|
8906
8749
|
return this.attr(attr2, marker);
|
|
@@ -8909,12 +8752,10 @@ registerMethods({
|
|
|
8909
8752
|
});
|
|
8910
8753
|
register(Marker, "Marker");
|
|
8911
8754
|
function makeSetterGetter(k, f) {
|
|
8912
|
-
return function(
|
|
8913
|
-
if (
|
|
8914
|
-
|
|
8915
|
-
|
|
8916
|
-
if (f)
|
|
8917
|
-
f.call(this);
|
|
8755
|
+
return function(v2) {
|
|
8756
|
+
if (v2 == null) return this[k];
|
|
8757
|
+
this[k] = v2;
|
|
8758
|
+
if (f) f.call(this);
|
|
8918
8759
|
return this;
|
|
8919
8760
|
};
|
|
8920
8761
|
}
|
|
@@ -9028,15 +8869,11 @@ class Spring extends Controller {
|
|
|
9028
8869
|
this.duration(duration).overshoot(overshoot);
|
|
9029
8870
|
}
|
|
9030
8871
|
step(current, target, dt, c) {
|
|
9031
|
-
if (typeof current === "string")
|
|
9032
|
-
return current;
|
|
8872
|
+
if (typeof current === "string") return current;
|
|
9033
8873
|
c.done = dt === Infinity;
|
|
9034
|
-
if (dt === Infinity)
|
|
9035
|
-
|
|
9036
|
-
if (dt
|
|
9037
|
-
return current;
|
|
9038
|
-
if (dt > 100)
|
|
9039
|
-
dt = 16;
|
|
8874
|
+
if (dt === Infinity) return target;
|
|
8875
|
+
if (dt === 0) return current;
|
|
8876
|
+
if (dt > 100) dt = 16;
|
|
9040
8877
|
dt /= 1e3;
|
|
9041
8878
|
const velocity = c.velocity || 0;
|
|
9042
8879
|
const acceleration = -this.d * velocity - this.k * (current - target);
|
|
@@ -9056,13 +8893,10 @@ class PID extends Controller {
|
|
|
9056
8893
|
this.p(p).i(i).d(d).windup(windup);
|
|
9057
8894
|
}
|
|
9058
8895
|
step(current, target, dt, c) {
|
|
9059
|
-
if (typeof current === "string")
|
|
9060
|
-
return current;
|
|
8896
|
+
if (typeof current === "string") return current;
|
|
9061
8897
|
c.done = dt === Infinity;
|
|
9062
|
-
if (dt === Infinity)
|
|
9063
|
-
|
|
9064
|
-
if (dt === 0)
|
|
9065
|
-
return current;
|
|
8898
|
+
if (dt === Infinity) return target;
|
|
8899
|
+
if (dt === 0) return current;
|
|
9066
8900
|
const p = target - current;
|
|
9067
8901
|
let i = (c.integral || 0) + p * dt;
|
|
9068
8902
|
const d = (p - (c.error || 0)) / dt;
|
|
@@ -9148,10 +8982,8 @@ const mlhvqtcsaz = "mlhvqtcsaz".split("");
|
|
|
9148
8982
|
for (let i = 0, il = mlhvqtcsaz.length; i < il; ++i) {
|
|
9149
8983
|
pathHandlers[mlhvqtcsaz[i]] = /* @__PURE__ */ function(i2) {
|
|
9150
8984
|
return function(c, p, p0) {
|
|
9151
|
-
if (i2 === "H")
|
|
9152
|
-
|
|
9153
|
-
else if (i2 === "V")
|
|
9154
|
-
c[0] = c[0] + p.y;
|
|
8985
|
+
if (i2 === "H") c[0] = c[0] + p.x;
|
|
8986
|
+
else if (i2 === "V") c[0] = c[0] + p.y;
|
|
9155
8987
|
else if (i2 === "A") {
|
|
9156
8988
|
c[5] = c[5] + p.x;
|
|
9157
8989
|
c[6] = c[6] + p.y;
|
|
@@ -9187,8 +9019,7 @@ function startNewSegment(parser2, token) {
|
|
|
9187
9019
|
return pathLetter;
|
|
9188
9020
|
}
|
|
9189
9021
|
function finalizeNumber(parser2, inNumber) {
|
|
9190
|
-
if (!parser2.inNumber)
|
|
9191
|
-
throw new Error("Parser Error");
|
|
9022
|
+
if (!parser2.inNumber) throw new Error("Parser Error");
|
|
9192
9023
|
parser2.number && parser2.segment.push(parseFloat(parser2.number));
|
|
9193
9024
|
parser2.inNumber = inNumber;
|
|
9194
9025
|
parser2.number = "";
|
|
@@ -9206,8 +9037,7 @@ function finalizeSegment(parser2) {
|
|
|
9206
9037
|
parser2.segments.push(parser2.segment);
|
|
9207
9038
|
}
|
|
9208
9039
|
function isArcFlag(parser2) {
|
|
9209
|
-
if (!parser2.segment.length)
|
|
9210
|
-
return false;
|
|
9040
|
+
if (!parser2.segment.length) return false;
|
|
9211
9041
|
const isArc = parser2.segment[0].toUpperCase() === "A";
|
|
9212
9042
|
const length2 = parser2.segment.length;
|
|
9213
9043
|
return isArc && (length2 === 4 || length2 === 5);
|
|
@@ -9462,8 +9292,7 @@ class Morphable {
|
|
|
9462
9292
|
return this;
|
|
9463
9293
|
}
|
|
9464
9294
|
stepper(stepper) {
|
|
9465
|
-
if (stepper == null)
|
|
9466
|
-
return this._stepper;
|
|
9295
|
+
if (stepper == null) return this._stepper;
|
|
9467
9296
|
this._stepper = stepper;
|
|
9468
9297
|
return this;
|
|
9469
9298
|
}
|
|
@@ -9538,8 +9367,8 @@ class TransformBag {
|
|
|
9538
9367
|
return this;
|
|
9539
9368
|
}
|
|
9540
9369
|
toArray() {
|
|
9541
|
-
const
|
|
9542
|
-
return [
|
|
9370
|
+
const v2 = this;
|
|
9371
|
+
return [v2.scaleX, v2.scaleY, v2.shear, v2.rotate, v2.translateX, v2.translateY, v2.originX, v2.originY];
|
|
9543
9372
|
}
|
|
9544
9373
|
}
|
|
9545
9374
|
TransformBag.defaults = {
|
|
@@ -9801,24 +9630,18 @@ class Queue {
|
|
|
9801
9630
|
}
|
|
9802
9631
|
// Removes the item that was returned from the push
|
|
9803
9632
|
remove(item) {
|
|
9804
|
-
if (item.prev)
|
|
9805
|
-
|
|
9806
|
-
if (item.
|
|
9807
|
-
|
|
9808
|
-
if (item === this._last)
|
|
9809
|
-
this._last = item.prev;
|
|
9810
|
-
if (item === this._first)
|
|
9811
|
-
this._first = item.next;
|
|
9633
|
+
if (item.prev) item.prev.next = item.next;
|
|
9634
|
+
if (item.next) item.next.prev = item.prev;
|
|
9635
|
+
if (item === this._last) this._last = item.prev;
|
|
9636
|
+
if (item === this._first) this._first = item.next;
|
|
9812
9637
|
item.prev = null;
|
|
9813
9638
|
item.next = null;
|
|
9814
9639
|
}
|
|
9815
9640
|
shift() {
|
|
9816
9641
|
const remove2 = this._first;
|
|
9817
|
-
if (!remove2)
|
|
9818
|
-
return null;
|
|
9642
|
+
if (!remove2) return null;
|
|
9819
9643
|
this._first = remove2.next;
|
|
9820
|
-
if (this._first)
|
|
9821
|
-
this._first.prev = null;
|
|
9644
|
+
if (this._first) this._first.prev = null;
|
|
9822
9645
|
this._last = this._first ? this._last : null;
|
|
9823
9646
|
return remove2.value;
|
|
9824
9647
|
}
|
|
@@ -9876,8 +9699,7 @@ const Animator = {
|
|
|
9876
9699
|
} else {
|
|
9877
9700
|
Animator.timeouts.push(nextTimeout);
|
|
9878
9701
|
}
|
|
9879
|
-
if (nextTimeout === lastTimeout)
|
|
9880
|
-
break;
|
|
9702
|
+
if (nextTimeout === lastTimeout) break;
|
|
9881
9703
|
}
|
|
9882
9704
|
let nextFrame = null;
|
|
9883
9705
|
const lastFrame = Animator.frames.last();
|
|
@@ -9954,8 +9776,7 @@ class Timeline extends EventTarget {
|
|
|
9954
9776
|
return this._continue();
|
|
9955
9777
|
}
|
|
9956
9778
|
persist(dtOrForever) {
|
|
9957
|
-
if (dtOrForever == null)
|
|
9958
|
-
return this._persist;
|
|
9779
|
+
if (dtOrForever == null) return this._persist;
|
|
9959
9780
|
this._persist = dtOrForever;
|
|
9960
9781
|
return this;
|
|
9961
9782
|
}
|
|
@@ -9965,8 +9786,7 @@ class Timeline extends EventTarget {
|
|
|
9965
9786
|
}
|
|
9966
9787
|
reverse(yes) {
|
|
9967
9788
|
const currentSpeed = this.speed();
|
|
9968
|
-
if (yes == null)
|
|
9969
|
-
return this.speed(-currentSpeed);
|
|
9789
|
+
if (yes == null) return this.speed(-currentSpeed);
|
|
9970
9790
|
const positive = Math.abs(currentSpeed);
|
|
9971
9791
|
return this.speed(yes ? -positive : positive);
|
|
9972
9792
|
}
|
|
@@ -10017,14 +9837,12 @@ class Timeline extends EventTarget {
|
|
|
10017
9837
|
return this.time(this._time + dt);
|
|
10018
9838
|
}
|
|
10019
9839
|
source(fn) {
|
|
10020
|
-
if (fn == null)
|
|
10021
|
-
return this._timeSource;
|
|
9840
|
+
if (fn == null) return this._timeSource;
|
|
10022
9841
|
this._timeSource = fn;
|
|
10023
9842
|
return this;
|
|
10024
9843
|
}
|
|
10025
9844
|
speed(speed) {
|
|
10026
|
-
if (speed == null)
|
|
10027
|
-
return this._speed;
|
|
9845
|
+
if (speed == null) return this._speed;
|
|
10028
9846
|
this._speed = speed;
|
|
10029
9847
|
return this;
|
|
10030
9848
|
}
|
|
@@ -10033,16 +9851,14 @@ class Timeline extends EventTarget {
|
|
|
10033
9851
|
return this.pause();
|
|
10034
9852
|
}
|
|
10035
9853
|
time(time) {
|
|
10036
|
-
if (time == null)
|
|
10037
|
-
return this._time;
|
|
9854
|
+
if (time == null) return this._time;
|
|
10038
9855
|
this._time = time;
|
|
10039
9856
|
return this._continue(true);
|
|
10040
9857
|
}
|
|
10041
9858
|
// Remove the runner from this timeline
|
|
10042
9859
|
unschedule(runner) {
|
|
10043
9860
|
const index = this._runnerIds.indexOf(runner.id);
|
|
10044
|
-
if (index < 0)
|
|
10045
|
-
return this;
|
|
9861
|
+
if (index < 0) return this;
|
|
10046
9862
|
this._runners.splice(index, 1);
|
|
10047
9863
|
this._runnerIds.splice(index, 1);
|
|
10048
9864
|
runner.timeline(null);
|
|
@@ -10059,18 +9875,15 @@ class Timeline extends EventTarget {
|
|
|
10059
9875
|
_continue(immediateStep = false) {
|
|
10060
9876
|
Animator.cancelFrame(this._nextFrame);
|
|
10061
9877
|
this._nextFrame = null;
|
|
10062
|
-
if (immediateStep)
|
|
10063
|
-
|
|
10064
|
-
if (this._paused)
|
|
10065
|
-
return this;
|
|
9878
|
+
if (immediateStep) return this._stepImmediate();
|
|
9879
|
+
if (this._paused) return this;
|
|
10066
9880
|
this._nextFrame = Animator.frame(this._step);
|
|
10067
9881
|
return this;
|
|
10068
9882
|
}
|
|
10069
9883
|
_stepFn(immediateStep = false) {
|
|
10070
9884
|
const time = this._timeSource();
|
|
10071
9885
|
let dtSource = time - this._lastSourceTime;
|
|
10072
|
-
if (immediateStep)
|
|
10073
|
-
dtSource = 0;
|
|
9886
|
+
if (immediateStep) dtSource = 0;
|
|
10074
9887
|
const dtTime = this._speed * dtSource + (this._time - this._lastStepTime);
|
|
10075
9888
|
this._lastSourceTime = time;
|
|
10076
9889
|
if (!immediateStep) {
|
|
@@ -10099,8 +9912,7 @@ class Timeline extends EventTarget {
|
|
|
10099
9912
|
} else if (dtToStart < dt) {
|
|
10100
9913
|
dt = dtToStart;
|
|
10101
9914
|
}
|
|
10102
|
-
if (!runner.active())
|
|
10103
|
-
continue;
|
|
9915
|
+
if (!runner.active()) continue;
|
|
10104
9916
|
const finished = runner.step(dt).done;
|
|
10105
9917
|
if (!finished) {
|
|
10106
9918
|
runnersLeft = true;
|
|
@@ -10189,8 +10001,7 @@ class Runner extends EventTarget {
|
|
|
10189
10001
|
};
|
|
10190
10002
|
}
|
|
10191
10003
|
active(enabled) {
|
|
10192
|
-
if (enabled == null)
|
|
10193
|
-
return this.enabled;
|
|
10004
|
+
if (enabled == null) return this.enabled;
|
|
10194
10005
|
this.enabled = enabled;
|
|
10195
10006
|
return this;
|
|
10196
10007
|
}
|
|
@@ -10209,10 +10020,8 @@ class Runner extends EventTarget {
|
|
|
10209
10020
|
animate(duration, delay, when) {
|
|
10210
10021
|
const o = Runner.sanitise(duration, delay, when);
|
|
10211
10022
|
const runner = new Runner(o.duration);
|
|
10212
|
-
if (this._timeline)
|
|
10213
|
-
|
|
10214
|
-
if (this._element)
|
|
10215
|
-
runner.element(this._element);
|
|
10023
|
+
if (this._timeline) runner.timeline(this._timeline);
|
|
10024
|
+
if (this._element) runner.element(this._element);
|
|
10216
10025
|
return runner.loop(o).schedule(o.delay, o.when);
|
|
10217
10026
|
}
|
|
10218
10027
|
clearTransform() {
|
|
@@ -10247,8 +10056,7 @@ class Runner extends EventTarget {
|
|
|
10247
10056
|
help us make new runners from the current runner
|
|
10248
10057
|
*/
|
|
10249
10058
|
element(element) {
|
|
10250
|
-
if (element == null)
|
|
10251
|
-
return this._element;
|
|
10059
|
+
if (element == null) return this._element;
|
|
10252
10060
|
this._element = element;
|
|
10253
10061
|
element._prepareRunner();
|
|
10254
10062
|
return this;
|
|
@@ -10284,8 +10092,7 @@ class Runner extends EventTarget {
|
|
|
10284
10092
|
return this.time(time);
|
|
10285
10093
|
}
|
|
10286
10094
|
persist(dtOrForever) {
|
|
10287
|
-
if (dtOrForever == null)
|
|
10288
|
-
return this._persist;
|
|
10095
|
+
if (dtOrForever == null) return this._persist;
|
|
10289
10096
|
this._persist = dtOrForever;
|
|
10290
10097
|
return this;
|
|
10291
10098
|
}
|
|
@@ -10340,8 +10147,7 @@ class Runner extends EventTarget {
|
|
|
10340
10147
|
return this;
|
|
10341
10148
|
}
|
|
10342
10149
|
reset() {
|
|
10343
|
-
if (this._reseted)
|
|
10344
|
-
return this;
|
|
10150
|
+
if (this._reseted) return this;
|
|
10345
10151
|
this.time(0);
|
|
10346
10152
|
this._reseted = true;
|
|
10347
10153
|
return this;
|
|
@@ -10363,8 +10169,7 @@ class Runner extends EventTarget {
|
|
|
10363
10169
|
return this;
|
|
10364
10170
|
}
|
|
10365
10171
|
step(dt) {
|
|
10366
|
-
if (!this.enabled)
|
|
10367
|
-
return this;
|
|
10172
|
+
if (!this.enabled) return this;
|
|
10368
10173
|
dt = dt == null ? 16 : dt;
|
|
10369
10174
|
this._time += dt;
|
|
10370
10175
|
const position2 = this.position();
|
|
@@ -10407,8 +10212,7 @@ class Runner extends EventTarget {
|
|
|
10407
10212
|
return this;
|
|
10408
10213
|
}
|
|
10409
10214
|
timeline(timeline2) {
|
|
10410
|
-
if (typeof timeline2 === "undefined")
|
|
10411
|
-
return this._timeline;
|
|
10215
|
+
if (typeof timeline2 === "undefined") return this._timeline;
|
|
10412
10216
|
this._timeline = timeline2;
|
|
10413
10217
|
return this;
|
|
10414
10218
|
}
|
|
@@ -10419,8 +10223,7 @@ class Runner extends EventTarget {
|
|
|
10419
10223
|
}
|
|
10420
10224
|
// Run each initialise function in the runner if required
|
|
10421
10225
|
_initialise(running) {
|
|
10422
|
-
if (!running && !this._isDeclarative)
|
|
10423
|
-
return;
|
|
10226
|
+
if (!running && !this._isDeclarative) return;
|
|
10424
10227
|
for (let i = 0, len = this._queue.length; i < len; ++i) {
|
|
10425
10228
|
const current = this._queue[i];
|
|
10426
10229
|
const needsIt = this._isDeclarative || !current.initialised && running;
|
|
@@ -10507,8 +10310,7 @@ class RunnerArray {
|
|
|
10507
10310
|
this.ids = [];
|
|
10508
10311
|
}
|
|
10509
10312
|
add(runner) {
|
|
10510
|
-
if (this.runners.includes(runner))
|
|
10511
|
-
return;
|
|
10313
|
+
if (this.runners.includes(runner)) return;
|
|
10512
10314
|
const id = runner.id + 1;
|
|
10513
10315
|
this.runners.push(runner);
|
|
10514
10316
|
this.ids.push(id);
|
|
@@ -10590,12 +10392,12 @@ registerMethods({
|
|
|
10590
10392
|
});
|
|
10591
10393
|
const difference = (a, b) => a.filter((x2) => !b.includes(x2));
|
|
10592
10394
|
extend(Runner, {
|
|
10593
|
-
attr(a,
|
|
10594
|
-
return this.styleAttr("attr", a,
|
|
10395
|
+
attr(a, v2) {
|
|
10396
|
+
return this.styleAttr("attr", a, v2);
|
|
10595
10397
|
},
|
|
10596
10398
|
// Add animatable styles
|
|
10597
|
-
css(s,
|
|
10598
|
-
return this.styleAttr("css", s,
|
|
10399
|
+
css(s, v2) {
|
|
10400
|
+
return this.styleAttr("css", s, v2);
|
|
10599
10401
|
},
|
|
10600
10402
|
styleAttr(type, nameOrAttrs, val) {
|
|
10601
10403
|
if (typeof nameOrAttrs === "string") {
|
|
@@ -10604,8 +10406,7 @@ extend(Runner, {
|
|
|
10604
10406
|
});
|
|
10605
10407
|
}
|
|
10606
10408
|
let attrs2 = nameOrAttrs;
|
|
10607
|
-
if (this._tryRetarget(type, attrs2))
|
|
10608
|
-
return this;
|
|
10409
|
+
if (this._tryRetarget(type, attrs2)) return this;
|
|
10609
10410
|
let morpher = new Morphable(this._stepper).to(attrs2);
|
|
10610
10411
|
let keys2 = Object.keys(attrs2);
|
|
10611
10412
|
this.queue(function() {
|
|
@@ -10632,8 +10433,7 @@ extend(Runner, {
|
|
|
10632
10433
|
return this;
|
|
10633
10434
|
},
|
|
10634
10435
|
zoom(level, point2) {
|
|
10635
|
-
if (this._tryRetarget("zoom", level, point2))
|
|
10636
|
-
return this;
|
|
10436
|
+
if (this._tryRetarget("zoom", level, point2)) return this;
|
|
10637
10437
|
let morpher = new Morphable(this._stepper).to(new SVGNumber(level));
|
|
10638
10438
|
this.queue(function() {
|
|
10639
10439
|
morpher = morpher.from(this.element().zoom());
|
|
@@ -10685,8 +10485,7 @@ extend(Runner, {
|
|
|
10685
10485
|
}
|
|
10686
10486
|
}
|
|
10687
10487
|
function run(pos) {
|
|
10688
|
-
if (!relative)
|
|
10689
|
-
this.clearTransform();
|
|
10488
|
+
if (!relative) this.clearTransform();
|
|
10690
10489
|
const {
|
|
10691
10490
|
x: x2,
|
|
10692
10491
|
y: y2
|
|
@@ -10756,8 +10555,7 @@ extend(Runner, {
|
|
|
10756
10555
|
},
|
|
10757
10556
|
_queueNumberDelta(method, to2) {
|
|
10758
10557
|
to2 = new SVGNumber(to2);
|
|
10759
|
-
if (this._tryRetarget(method, to2))
|
|
10760
|
-
return this;
|
|
10558
|
+
if (this._tryRetarget(method, to2)) return this;
|
|
10761
10559
|
const morpher = new Morphable(this._stepper).to(to2);
|
|
10762
10560
|
let from3 = null;
|
|
10763
10561
|
this.queue(function() {
|
|
@@ -10774,8 +10572,7 @@ extend(Runner, {
|
|
|
10774
10572
|
return this;
|
|
10775
10573
|
},
|
|
10776
10574
|
_queueObject(method, to2) {
|
|
10777
|
-
if (this._tryRetarget(method, to2))
|
|
10778
|
-
return this;
|
|
10575
|
+
if (this._tryRetarget(method, to2)) return this;
|
|
10779
10576
|
const morpher = new Morphable(this._stepper).to(to2);
|
|
10780
10577
|
this.queue(function() {
|
|
10781
10578
|
morpher.from(this.element()[method]());
|
|
@@ -10832,8 +10629,7 @@ extend(Runner, {
|
|
|
10832
10629
|
if (arguments.length === 4) {
|
|
10833
10630
|
return this.plot([a, b, c, d]);
|
|
10834
10631
|
}
|
|
10835
|
-
if (this._tryRetarget("plot", a))
|
|
10836
|
-
return this;
|
|
10632
|
+
if (this._tryRetarget("plot", a)) return this;
|
|
10837
10633
|
const morpher = new Morphable(this._stepper).type(this._element.MorphArray).to(a);
|
|
10838
10634
|
this.queue(function() {
|
|
10839
10635
|
morpher.from(this._element.array());
|
|
@@ -10860,12 +10656,9 @@ extend(Runner, {
|
|
|
10860
10656
|
opacity: arguments[2]
|
|
10861
10657
|
});
|
|
10862
10658
|
}
|
|
10863
|
-
if (o.opacity != null)
|
|
10864
|
-
|
|
10865
|
-
if (o.
|
|
10866
|
-
this.attr("stop-color", o.color);
|
|
10867
|
-
if (o.offset != null)
|
|
10868
|
-
this.attr("offset", o.offset);
|
|
10659
|
+
if (o.opacity != null) this.attr("stop-opacity", o.opacity);
|
|
10660
|
+
if (o.color != null) this.attr("stop-color", o.color);
|
|
10661
|
+
if (o.offset != null) this.attr("offset", o.offset);
|
|
10869
10662
|
return this;
|
|
10870
10663
|
}
|
|
10871
10664
|
});
|
|
@@ -10883,8 +10676,7 @@ class Svg extends Container {
|
|
|
10883
10676
|
}
|
|
10884
10677
|
// Creates and returns defs element
|
|
10885
10678
|
defs() {
|
|
10886
|
-
if (!this.isRoot())
|
|
10887
|
-
return this.root().defs();
|
|
10679
|
+
if (!this.isRoot()) return this.root().defs();
|
|
10888
10680
|
return adopt(this.node.querySelector("defs")) || this.put(new Defs());
|
|
10889
10681
|
}
|
|
10890
10682
|
isRoot() {
|
|
@@ -10892,8 +10684,7 @@ class Svg extends Container {
|
|
|
10892
10684
|
}
|
|
10893
10685
|
// Add namespaces
|
|
10894
10686
|
namespace() {
|
|
10895
|
-
if (!this.isRoot())
|
|
10896
|
-
return this.root().namespace();
|
|
10687
|
+
if (!this.isRoot()) return this.root().namespace();
|
|
10897
10688
|
return this.attr({
|
|
10898
10689
|
xmlns: svg,
|
|
10899
10690
|
version: "1.1"
|
|
@@ -10908,8 +10699,7 @@ class Svg extends Container {
|
|
|
10908
10699
|
// Check if this is a root svg
|
|
10909
10700
|
// If not, call root() from this element
|
|
10910
10701
|
root() {
|
|
10911
|
-
if (this.isRoot())
|
|
10912
|
-
return this;
|
|
10702
|
+
if (this.isRoot()) return this;
|
|
10913
10703
|
return super.root();
|
|
10914
10704
|
}
|
|
10915
10705
|
}
|
|
@@ -11060,8 +10850,7 @@ class Text extends Shape {
|
|
|
11060
10850
|
text = "";
|
|
11061
10851
|
for (let i = 0, len = children.length; i < len; ++i) {
|
|
11062
10852
|
if (children[i].nodeName === "textPath") {
|
|
11063
|
-
if (i === 0)
|
|
11064
|
-
firstLine = 1;
|
|
10853
|
+
if (i === 0) firstLine = 1;
|
|
11065
10854
|
continue;
|
|
11066
10855
|
}
|
|
11067
10856
|
if (i !== firstLine && children[i].nodeType !== 3 && adopt(children[i]).dom.newLined === true) {
|
|
@@ -11125,8 +10914,7 @@ class Tspan extends Shape {
|
|
|
11125
10914
|
}
|
|
11126
10915
|
// Set text content
|
|
11127
10916
|
text(text) {
|
|
11128
|
-
if (text == null)
|
|
11129
|
-
return this.node.textContent + (this.dom.newLined ? "\n" : "");
|
|
10917
|
+
if (text == null) return this.node.textContent + (this.dom.newLined ? "\n" : "");
|
|
11130
10918
|
if (typeof text === "function") {
|
|
11131
10919
|
this.clear().build(true);
|
|
11132
10920
|
text.call(this, this);
|
|
@@ -11250,8 +11038,8 @@ function dmove(dx2, dy2) {
|
|
|
11250
11038
|
} catch (e) {
|
|
11251
11039
|
return;
|
|
11252
11040
|
}
|
|
11253
|
-
const
|
|
11254
|
-
const matrix =
|
|
11041
|
+
const m3 = new Matrix(child);
|
|
11042
|
+
const matrix = m3.translate(dx2, dy2).transform(m3.inverse());
|
|
11255
11043
|
const p = new Point(bbox2.x, bbox2.y).transform(matrix);
|
|
11256
11044
|
child.move(p.x, p.y);
|
|
11257
11045
|
});
|
|
@@ -11264,8 +11052,7 @@ function dy(dy2) {
|
|
|
11264
11052
|
return this.dmove(0, dy2);
|
|
11265
11053
|
}
|
|
11266
11054
|
function height(height2, box = this.bbox()) {
|
|
11267
|
-
if (height2 == null)
|
|
11268
|
-
return box.height;
|
|
11055
|
+
if (height2 == null) return box.height;
|
|
11269
11056
|
return this.size(box.width, height2, box);
|
|
11270
11057
|
}
|
|
11271
11058
|
function move(x2 = 0, y2 = 0, box = this.bbox()) {
|
|
@@ -11284,18 +11071,15 @@ function size(width2, height2, box = this.bbox()) {
|
|
|
11284
11071
|
return this;
|
|
11285
11072
|
}
|
|
11286
11073
|
function width(width2, box = this.bbox()) {
|
|
11287
|
-
if (width2 == null)
|
|
11288
|
-
return box.width;
|
|
11074
|
+
if (width2 == null) return box.width;
|
|
11289
11075
|
return this.size(width2, box.height, box);
|
|
11290
11076
|
}
|
|
11291
11077
|
function x(x2, box = this.bbox()) {
|
|
11292
|
-
if (x2 == null)
|
|
11293
|
-
return box.x;
|
|
11078
|
+
if (x2 == null) return box.x;
|
|
11294
11079
|
return this.move(x2, box.y, box);
|
|
11295
11080
|
}
|
|
11296
11081
|
function y(y2, box = this.bbox()) {
|
|
11297
|
-
if (y2 == null)
|
|
11298
|
-
return box.y;
|
|
11082
|
+
if (y2 == null) return box.y;
|
|
11299
11083
|
return this.move(box.x, y2, box);
|
|
11300
11084
|
}
|
|
11301
11085
|
var containerGeometry = {
|
|
@@ -11349,8 +11133,7 @@ registerMethods({
|
|
|
11349
11133
|
Element: {
|
|
11350
11134
|
unlink() {
|
|
11351
11135
|
const link = this.linker();
|
|
11352
|
-
if (!link)
|
|
11353
|
-
return this;
|
|
11136
|
+
if (!link) return this;
|
|
11354
11137
|
const parent = link.parent();
|
|
11355
11138
|
if (!parent) {
|
|
11356
11139
|
return this.remove();
|
|
@@ -11434,12 +11217,9 @@ class Stop extends Element {
|
|
|
11434
11217
|
opacity: arguments[2]
|
|
11435
11218
|
};
|
|
11436
11219
|
}
|
|
11437
|
-
if (o.opacity != null)
|
|
11438
|
-
|
|
11439
|
-
if (o.
|
|
11440
|
-
this.attr("stop-color", o.color);
|
|
11441
|
-
if (o.offset != null)
|
|
11442
|
-
this.attr("offset", new SVGNumber(o.offset));
|
|
11220
|
+
if (o.opacity != null) this.attr("stop-opacity", o.opacity);
|
|
11221
|
+
if (o.color != null) this.attr("stop-color", o.color);
|
|
11222
|
+
if (o.offset != null) this.attr("offset", new SVGNumber(o.offset));
|
|
11443
11223
|
return this;
|
|
11444
11224
|
}
|
|
11445
11225
|
}
|
|
@@ -11453,10 +11233,8 @@ registerMethods({
|
|
|
11453
11233
|
});
|
|
11454
11234
|
register(Stop, "Stop");
|
|
11455
11235
|
function cssRule(selector, rule) {
|
|
11456
|
-
if (!selector)
|
|
11457
|
-
|
|
11458
|
-
if (!rule)
|
|
11459
|
-
return selector;
|
|
11236
|
+
if (!selector) return "";
|
|
11237
|
+
if (!rule) return selector;
|
|
11460
11238
|
let ret = selector + "{";
|
|
11461
11239
|
for (const i in rule) {
|
|
11462
11240
|
ret += unCamelCase(i) + ":" + rule[i] + ";";
|
|
@@ -11620,16 +11398,12 @@ extend(Shape, {
|
|
|
11620
11398
|
x: x2,
|
|
11621
11399
|
y: y2
|
|
11622
11400
|
} = this.attr(["width", "height", "rx", "ry", "x", "y"]);
|
|
11623
|
-
if (rx2 < 0)
|
|
11624
|
-
|
|
11625
|
-
if (ry2 < 0)
|
|
11626
|
-
ry2 = 0;
|
|
11401
|
+
if (rx2 < 0) rx2 = 0;
|
|
11402
|
+
if (ry2 < 0) ry2 = 0;
|
|
11627
11403
|
rx2 = rx2 || ry2;
|
|
11628
11404
|
ry2 = ry2 || rx2;
|
|
11629
|
-
if (rx2 > w / 2)
|
|
11630
|
-
|
|
11631
|
-
if (ry2 > h / 2)
|
|
11632
|
-
ry2 = h / 2;
|
|
11405
|
+
if (rx2 > w / 2) rx2 = w / 2;
|
|
11406
|
+
if (ry2 > h / 2) ry2 = h / 2;
|
|
11633
11407
|
if (rx2 && ry2) {
|
|
11634
11408
|
d = [
|
|
11635
11409
|
["M", rx2 + x2, y2],
|
|
@@ -11793,8 +11567,7 @@ function getSVGCircle(cx2, cy2, radius, strokeStyle = {}, fillStyle = {}) {
|
|
|
11793
11567
|
}
|
|
11794
11568
|
function mergeOptions(target, source) {
|
|
11795
11569
|
for (const key of Object.keys(source)) {
|
|
11796
|
-
if (source[key] instanceof Object)
|
|
11797
|
-
Object.assign(source[key], mergeOptions(target[key], source[key]));
|
|
11570
|
+
if (source[key] instanceof Object) Object.assign(source[key], mergeOptions(target[key], source[key]));
|
|
11798
11571
|
}
|
|
11799
11572
|
Object.assign(target || {}, source);
|
|
11800
11573
|
return target;
|
|
@@ -11979,7 +11752,7 @@ class VisibleChainPass extends ChainPass {
|
|
|
11979
11752
|
}
|
|
11980
11753
|
async draw(svg2, viewmap) {
|
|
11981
11754
|
const chains = viewmap.chains.filter((c) => c.visibility === ChainVisibility.Visible);
|
|
11982
|
-
const meshes = Array.from(viewmap.meshes).filter((
|
|
11755
|
+
const meshes = Array.from(viewmap.meshes).filter((m3) => m3.drawVisibleContours);
|
|
11983
11756
|
const group = new G({ id: "visible-contours" });
|
|
11984
11757
|
drawChains(group, meshes, chains, this.options);
|
|
11985
11758
|
svg2.add(group);
|
|
@@ -12002,7 +11775,7 @@ class HiddenChainPass extends ChainPass {
|
|
|
12002
11775
|
const chains = viewmap.chains.filter(
|
|
12003
11776
|
(c) => c.visibility === ChainVisibility.Hidden
|
|
12004
11777
|
);
|
|
12005
|
-
const meshes = Array.from(viewmap.meshes).filter((
|
|
11778
|
+
const meshes = Array.from(viewmap.meshes).filter((m3) => m3.drawHiddenContours);
|
|
12006
11779
|
const group = new G({ id: "hidden-contours" });
|
|
12007
11780
|
svg2.add(group);
|
|
12008
11781
|
drawChains(group, meshes, chains, this.options);
|
|
@@ -12090,7 +11863,7 @@ function orient3D(a, b, c, d) {
|
|
|
12090
11863
|
const det = _matrix.determinant();
|
|
12091
11864
|
if (det > EPSILON) {
|
|
12092
11865
|
return 1;
|
|
12093
|
-
} else if (det < -
|
|
11866
|
+
} else if (det < -1e-10) {
|
|
12094
11867
|
return -1;
|
|
12095
11868
|
}
|
|
12096
11869
|
return 0;
|
|
@@ -12524,10 +12297,10 @@ function addVertex(struct, position2, checkDuplicates = false, tolerance = 1e-10
|
|
|
12524
12297
|
}
|
|
12525
12298
|
}
|
|
12526
12299
|
}
|
|
12527
|
-
const
|
|
12528
|
-
|
|
12529
|
-
struct.vertices.push(
|
|
12530
|
-
return
|
|
12300
|
+
const v2 = new Vertex();
|
|
12301
|
+
v2.position.copy(position2);
|
|
12302
|
+
struct.vertices.push(v2);
|
|
12303
|
+
return v2;
|
|
12531
12304
|
}
|
|
12532
12305
|
function removeFace(struct, face) {
|
|
12533
12306
|
if (!struct.faces.remove(face)) {
|
|
@@ -12718,8 +12491,7 @@ function setFromGeometry(struct, geometry, tolerance = 1e-10) {
|
|
|
12718
12491
|
}
|
|
12719
12492
|
const hash1 = i1 + "-" + i2;
|
|
12720
12493
|
let h1 = halfedgeMap.get(hash1);
|
|
12721
|
-
if (h1 == null ? void 0 : h1.face)
|
|
12722
|
-
h1 = void 0;
|
|
12494
|
+
if (h1 == null ? void 0 : h1.face) h1 = void 0;
|
|
12723
12495
|
if (!h1) {
|
|
12724
12496
|
try {
|
|
12725
12497
|
h1 = struct.addEdge(v1, v2);
|
|
@@ -12731,14 +12503,11 @@ function setFromGeometry(struct, geometry, tolerance = 1e-10) {
|
|
|
12731
12503
|
} catch (e) {
|
|
12732
12504
|
}
|
|
12733
12505
|
}
|
|
12734
|
-
if (h1)
|
|
12735
|
-
|
|
12736
|
-
else
|
|
12737
|
-
break;
|
|
12506
|
+
if (h1) loopHalfedges.push(h1);
|
|
12507
|
+
else break;
|
|
12738
12508
|
}
|
|
12739
12509
|
try {
|
|
12740
|
-
if (loopHalfedges.length < 3)
|
|
12741
|
-
throw "need 3 for face";
|
|
12510
|
+
if (loopHalfedges.length < 3) throw "need 3 for face";
|
|
12742
12511
|
struct.addFace(loopHalfedges);
|
|
12743
12512
|
} catch (e) {
|
|
12744
12513
|
}
|
|
@@ -13011,38 +12780,26 @@ function getBounds(triangleBounds, offset, count, target, centroidTarget) {
|
|
|
13011
12780
|
const hx = triangleBounds[i + 1];
|
|
13012
12781
|
const lx = cx2 - hx;
|
|
13013
12782
|
const rx2 = cx2 + hx;
|
|
13014
|
-
if (lx < minx)
|
|
13015
|
-
|
|
13016
|
-
if (
|
|
13017
|
-
|
|
13018
|
-
if (cx2 < cminx)
|
|
13019
|
-
cminx = cx2;
|
|
13020
|
-
if (cx2 > cmaxx)
|
|
13021
|
-
cmaxx = cx2;
|
|
12783
|
+
if (lx < minx) minx = lx;
|
|
12784
|
+
if (rx2 > maxx) maxx = rx2;
|
|
12785
|
+
if (cx2 < cminx) cminx = cx2;
|
|
12786
|
+
if (cx2 > cmaxx) cmaxx = cx2;
|
|
13022
12787
|
const cy2 = triangleBounds[i + 2];
|
|
13023
12788
|
const hy = triangleBounds[i + 3];
|
|
13024
12789
|
const ly = cy2 - hy;
|
|
13025
12790
|
const ry2 = cy2 + hy;
|
|
13026
|
-
if (ly < miny)
|
|
13027
|
-
|
|
13028
|
-
if (
|
|
13029
|
-
|
|
13030
|
-
if (cy2 < cminy)
|
|
13031
|
-
cminy = cy2;
|
|
13032
|
-
if (cy2 > cmaxy)
|
|
13033
|
-
cmaxy = cy2;
|
|
12791
|
+
if (ly < miny) miny = ly;
|
|
12792
|
+
if (ry2 > maxy) maxy = ry2;
|
|
12793
|
+
if (cy2 < cminy) cminy = cy2;
|
|
12794
|
+
if (cy2 > cmaxy) cmaxy = cy2;
|
|
13034
12795
|
const cz = triangleBounds[i + 4];
|
|
13035
12796
|
const hz = triangleBounds[i + 5];
|
|
13036
12797
|
const lz = cz - hz;
|
|
13037
12798
|
const rz = cz + hz;
|
|
13038
|
-
if (lz < minz)
|
|
13039
|
-
|
|
13040
|
-
if (
|
|
13041
|
-
|
|
13042
|
-
if (cz < cminz)
|
|
13043
|
-
cminz = cz;
|
|
13044
|
-
if (cz > cmaxz)
|
|
13045
|
-
cmaxz = cz;
|
|
12799
|
+
if (lz < minz) minz = lz;
|
|
12800
|
+
if (rz > maxz) maxz = rz;
|
|
12801
|
+
if (cz < cminz) cminz = cz;
|
|
12802
|
+
if (cz > cmaxz) cmaxz = cz;
|
|
13046
12803
|
}
|
|
13047
12804
|
target[0] = minx;
|
|
13048
12805
|
target[1] = miny;
|
|
@@ -13107,15 +12864,11 @@ function computeTriangleBounds(geo, target = null, offset = null, count = null)
|
|
|
13107
12864
|
c = posArr[ci + el];
|
|
13108
12865
|
}
|
|
13109
12866
|
let min2 = a;
|
|
13110
|
-
if (b < min2)
|
|
13111
|
-
|
|
13112
|
-
if (c < min2)
|
|
13113
|
-
min2 = c;
|
|
12867
|
+
if (b < min2) min2 = b;
|
|
12868
|
+
if (c < min2) min2 = c;
|
|
13114
12869
|
let max2 = a;
|
|
13115
|
-
if (b > max2)
|
|
13116
|
-
|
|
13117
|
-
if (c > max2)
|
|
13118
|
-
max2 = c;
|
|
12870
|
+
if (b > max2) max2 = b;
|
|
12871
|
+
if (c > max2) max2 = c;
|
|
13119
12872
|
const halfExtents = (max2 - min2) / 2;
|
|
13120
12873
|
const el2 = el * 2;
|
|
13121
12874
|
triangleBounds[tri6 + el2 + 0] = min2 + halfExtents;
|
|
@@ -13295,8 +13048,7 @@ function getOptimalSplit(nodeBoundingData, centroidBoundingData, triangleBounds,
|
|
|
13295
13048
|
const triCenter = triangleBounds[c + 2 * a];
|
|
13296
13049
|
const relativeCenter = triCenter - axisLeft;
|
|
13297
13050
|
let binIndex = ~~(relativeCenter / binWidth);
|
|
13298
|
-
if (binIndex >= BIN_COUNT)
|
|
13299
|
-
binIndex = BIN_COUNT - 1;
|
|
13051
|
+
if (binIndex >= BIN_COUNT) binIndex = BIN_COUNT - 1;
|
|
13300
13052
|
const bin = sahBins[binIndex];
|
|
13301
13053
|
bin.count++;
|
|
13302
13054
|
expandByTriangleBounds(c, triangleBounds, bin.bounds);
|
|
@@ -13752,25 +13504,21 @@ const sphereIntersectTriangle = function() {
|
|
|
13752
13504
|
lineTemp.start = a;
|
|
13753
13505
|
lineTemp.end = b;
|
|
13754
13506
|
const closestPoint1 = lineTemp.closestPointToPoint(center2, true, closestPointTemp);
|
|
13755
|
-
if (closestPoint1.distanceTo(center2) <= radius)
|
|
13756
|
-
return true;
|
|
13507
|
+
if (closestPoint1.distanceTo(center2) <= radius) return true;
|
|
13757
13508
|
lineTemp.start = a;
|
|
13758
13509
|
lineTemp.end = c;
|
|
13759
13510
|
const closestPoint2 = lineTemp.closestPointToPoint(center2, true, closestPointTemp);
|
|
13760
|
-
if (closestPoint2.distanceTo(center2) <= radius)
|
|
13761
|
-
return true;
|
|
13511
|
+
if (closestPoint2.distanceTo(center2) <= radius) return true;
|
|
13762
13512
|
lineTemp.start = b;
|
|
13763
13513
|
lineTemp.end = c;
|
|
13764
13514
|
const closestPoint3 = lineTemp.closestPointToPoint(center2, true, closestPointTemp);
|
|
13765
|
-
if (closestPoint3.distanceTo(center2) <= radius)
|
|
13766
|
-
return true;
|
|
13515
|
+
if (closestPoint3.distanceTo(center2) <= radius) return true;
|
|
13767
13516
|
const plane = triangle3.getPlane(planeTemp);
|
|
13768
13517
|
const dp = Math.abs(plane.distanceToPoint(center2));
|
|
13769
13518
|
if (dp <= radius) {
|
|
13770
13519
|
const pp = plane.projectPoint(center2, projectedPointTemp);
|
|
13771
13520
|
const cp = triangle3.containsPoint(pp);
|
|
13772
|
-
if (cp)
|
|
13773
|
-
return true;
|
|
13521
|
+
if (cp) return true;
|
|
13774
13522
|
}
|
|
13775
13523
|
return false;
|
|
13776
13524
|
};
|
|
@@ -13838,29 +13586,23 @@ ExtendedTriangle.prototype.closestPointToSegment = function() {
|
|
|
13838
13586
|
distSq = point1.distanceToSquared(point2);
|
|
13839
13587
|
if (distSq < closestDistanceSq) {
|
|
13840
13588
|
closestDistanceSq = distSq;
|
|
13841
|
-
if (target1)
|
|
13842
|
-
|
|
13843
|
-
if (target2)
|
|
13844
|
-
target2.copy(point2);
|
|
13589
|
+
if (target1) target1.copy(point1);
|
|
13590
|
+
if (target2) target2.copy(point2);
|
|
13845
13591
|
}
|
|
13846
13592
|
}
|
|
13847
13593
|
this.closestPointToPoint(start, point1);
|
|
13848
13594
|
distSq = start.distanceToSquared(point1);
|
|
13849
13595
|
if (distSq < closestDistanceSq) {
|
|
13850
13596
|
closestDistanceSq = distSq;
|
|
13851
|
-
if (target1)
|
|
13852
|
-
|
|
13853
|
-
if (target2)
|
|
13854
|
-
target2.copy(start);
|
|
13597
|
+
if (target1) target1.copy(point1);
|
|
13598
|
+
if (target2) target2.copy(start);
|
|
13855
13599
|
}
|
|
13856
13600
|
this.closestPointToPoint(end, point1);
|
|
13857
13601
|
distSq = end.distanceToSquared(point1);
|
|
13858
13602
|
if (distSq < closestDistanceSq) {
|
|
13859
13603
|
closestDistanceSq = distSq;
|
|
13860
|
-
if (target1)
|
|
13861
|
-
|
|
13862
|
-
if (target2)
|
|
13863
|
-
target2.copy(end);
|
|
13604
|
+
if (target1) target1.copy(point1);
|
|
13605
|
+
if (target2) target2.copy(end);
|
|
13864
13606
|
}
|
|
13865
13607
|
return Math.sqrt(closestDistanceSq);
|
|
13866
13608
|
};
|
|
@@ -13943,8 +13685,7 @@ ExtendedTriangle.prototype.intersectsTriangle = function() {
|
|
|
13943
13685
|
const sb = satBounds1[i];
|
|
13944
13686
|
const sa = satAxes1[i];
|
|
13945
13687
|
cachedSatBounds.setFromPoints(sa, arr2);
|
|
13946
|
-
if (sb.isSeparated(cachedSatBounds))
|
|
13947
|
-
return false;
|
|
13688
|
+
if (sb.isSeparated(cachedSatBounds)) return false;
|
|
13948
13689
|
}
|
|
13949
13690
|
const satBounds2 = other.satBounds;
|
|
13950
13691
|
const satAxes2 = other.satAxes;
|
|
@@ -13955,8 +13696,7 @@ ExtendedTriangle.prototype.intersectsTriangle = function() {
|
|
|
13955
13696
|
const sb = satBounds2[i];
|
|
13956
13697
|
const sa = satAxes2[i];
|
|
13957
13698
|
cachedSatBounds.setFromPoints(sa, arr1);
|
|
13958
|
-
if (sb.isSeparated(cachedSatBounds))
|
|
13959
|
-
return false;
|
|
13699
|
+
if (sb.isSeparated(cachedSatBounds)) return false;
|
|
13960
13700
|
}
|
|
13961
13701
|
for (let i = 0; i < 4; i++) {
|
|
13962
13702
|
const sa1 = satAxes1[i];
|
|
@@ -13965,8 +13705,7 @@ ExtendedTriangle.prototype.intersectsTriangle = function() {
|
|
|
13965
13705
|
cachedAxis.crossVectors(sa1, sa2);
|
|
13966
13706
|
cachedSatBounds.setFromPoints(cachedAxis, arr1);
|
|
13967
13707
|
cachedSatBounds2.setFromPoints(cachedAxis, arr2);
|
|
13968
|
-
if (cachedSatBounds.isSeparated(cachedSatBounds2))
|
|
13969
|
-
return false;
|
|
13708
|
+
if (cachedSatBounds.isSeparated(cachedSatBounds2)) return false;
|
|
13970
13709
|
}
|
|
13971
13710
|
}
|
|
13972
13711
|
if (target) {
|
|
@@ -14049,10 +13788,8 @@ ExtendedTriangle.prototype.distanceToTriangle = function() {
|
|
|
14049
13788
|
const lineTarget = target1 || target2 ? line1 : null;
|
|
14050
13789
|
if (this.intersectsTriangle(other, lineTarget)) {
|
|
14051
13790
|
if (target1 || target2) {
|
|
14052
|
-
if (target1)
|
|
14053
|
-
|
|
14054
|
-
if (target2)
|
|
14055
|
-
lineTarget.getCenter(target2);
|
|
13791
|
+
if (target1) lineTarget.getCenter(target1);
|
|
13792
|
+
if (target2) lineTarget.getCenter(target2);
|
|
14056
13793
|
}
|
|
14057
13794
|
return 0;
|
|
14058
13795
|
}
|
|
@@ -14065,20 +13802,16 @@ ExtendedTriangle.prototype.distanceToTriangle = function() {
|
|
|
14065
13802
|
dist = otherVec.distanceToSquared(point2);
|
|
14066
13803
|
if (dist < closestDistanceSq) {
|
|
14067
13804
|
closestDistanceSq = dist;
|
|
14068
|
-
if (target1)
|
|
14069
|
-
|
|
14070
|
-
if (target2)
|
|
14071
|
-
target2.copy(otherVec);
|
|
13805
|
+
if (target1) target1.copy(point2);
|
|
13806
|
+
if (target2) target2.copy(otherVec);
|
|
14072
13807
|
}
|
|
14073
13808
|
const thisVec = this[field];
|
|
14074
13809
|
other.closestPointToPoint(thisVec, point2);
|
|
14075
13810
|
dist = thisVec.distanceToSquared(point2);
|
|
14076
13811
|
if (dist < closestDistanceSq) {
|
|
14077
13812
|
closestDistanceSq = dist;
|
|
14078
|
-
if (target1)
|
|
14079
|
-
|
|
14080
|
-
if (target2)
|
|
14081
|
-
target2.copy(point2);
|
|
13813
|
+
if (target1) target1.copy(thisVec);
|
|
13814
|
+
if (target2) target2.copy(point2);
|
|
14082
13815
|
}
|
|
14083
13816
|
}
|
|
14084
13817
|
for (let i = 0; i < 3; i++) {
|
|
@@ -14093,10 +13826,8 @@ ExtendedTriangle.prototype.distanceToTriangle = function() {
|
|
|
14093
13826
|
const dist = point2.distanceToSquared(point22);
|
|
14094
13827
|
if (dist < closestDistanceSq) {
|
|
14095
13828
|
closestDistanceSq = dist;
|
|
14096
|
-
if (target1)
|
|
14097
|
-
|
|
14098
|
-
if (target2)
|
|
14099
|
-
target2.copy(point22);
|
|
13829
|
+
if (target1) target1.copy(point2);
|
|
13830
|
+
if (target2) target2.copy(point22);
|
|
14100
13831
|
}
|
|
14101
13832
|
}
|
|
14102
13833
|
}
|
|
@@ -14115,12 +13846,9 @@ class OrientedBox {
|
|
|
14115
13846
|
this.satBounds = new Array(3).fill().map(() => new SeparatingAxisBounds());
|
|
14116
13847
|
this.alignedSatBounds = new Array(3).fill().map(() => new SeparatingAxisBounds());
|
|
14117
13848
|
this.needsUpdate = false;
|
|
14118
|
-
if (min2)
|
|
14119
|
-
|
|
14120
|
-
if (
|
|
14121
|
-
this.max.copy(max2);
|
|
14122
|
-
if (matrix)
|
|
14123
|
-
this.matrix.copy(matrix);
|
|
13849
|
+
if (min2) this.min.copy(min2);
|
|
13850
|
+
if (max2) this.max.copy(max2);
|
|
13851
|
+
if (matrix) this.matrix.copy(matrix);
|
|
14124
13852
|
}
|
|
14125
13853
|
set(min2, max2, matrix) {
|
|
14126
13854
|
this.min.copy(min2);
|
|
@@ -14145,11 +13873,11 @@ OrientedBox.prototype.update = /* @__PURE__ */ function() {
|
|
|
14145
13873
|
for (let y2 = 0; y2 <= 1; y2++) {
|
|
14146
13874
|
for (let z = 0; z <= 1; z++) {
|
|
14147
13875
|
const i = (1 << 0) * x2 | (1 << 1) * y2 | (1 << 2) * z;
|
|
14148
|
-
const
|
|
14149
|
-
|
|
14150
|
-
|
|
14151
|
-
|
|
14152
|
-
|
|
13876
|
+
const v2 = points[i];
|
|
13877
|
+
v2.x = x2 ? max2.x : min2.x;
|
|
13878
|
+
v2.y = y2 ? max2.y : min2.y;
|
|
13879
|
+
v2.z = z ? max2.z : min2.z;
|
|
13880
|
+
v2.applyMatrix4(matrix);
|
|
14153
13881
|
}
|
|
14154
13882
|
}
|
|
14155
13883
|
}
|
|
@@ -14185,22 +13913,18 @@ OrientedBox.prototype.intersectsBox = function() {
|
|
|
14185
13913
|
const alignedSatBounds = this.alignedSatBounds;
|
|
14186
13914
|
aabbBounds.min = min2.x;
|
|
14187
13915
|
aabbBounds.max = max2.x;
|
|
14188
|
-
if (alignedSatBounds[0].isSeparated(aabbBounds))
|
|
14189
|
-
return false;
|
|
13916
|
+
if (alignedSatBounds[0].isSeparated(aabbBounds)) return false;
|
|
14190
13917
|
aabbBounds.min = min2.y;
|
|
14191
13918
|
aabbBounds.max = max2.y;
|
|
14192
|
-
if (alignedSatBounds[1].isSeparated(aabbBounds))
|
|
14193
|
-
return false;
|
|
13919
|
+
if (alignedSatBounds[1].isSeparated(aabbBounds)) return false;
|
|
14194
13920
|
aabbBounds.min = min2.z;
|
|
14195
13921
|
aabbBounds.max = max2.z;
|
|
14196
|
-
if (alignedSatBounds[2].isSeparated(aabbBounds))
|
|
14197
|
-
return false;
|
|
13922
|
+
if (alignedSatBounds[2].isSeparated(aabbBounds)) return false;
|
|
14198
13923
|
for (let i = 0; i < 3; i++) {
|
|
14199
13924
|
const axis = satAxes[i];
|
|
14200
13925
|
const sb = satBounds[i];
|
|
14201
13926
|
aabbBounds.setFromBox(axis, box);
|
|
14202
|
-
if (sb.isSeparated(aabbBounds))
|
|
14203
|
-
return false;
|
|
13927
|
+
if (sb.isSeparated(aabbBounds)) return false;
|
|
14204
13928
|
}
|
|
14205
13929
|
return true;
|
|
14206
13930
|
};
|
|
@@ -14231,8 +13955,7 @@ OrientedBox.prototype.intersectsTriangle = function() {
|
|
|
14231
13955
|
const sb = satBounds[i];
|
|
14232
13956
|
const sa = satAxes[i];
|
|
14233
13957
|
cachedSatBounds.setFromPoints(sa, pointsArr);
|
|
14234
|
-
if (sb.isSeparated(cachedSatBounds))
|
|
14235
|
-
return false;
|
|
13958
|
+
if (sb.isSeparated(cachedSatBounds)) return false;
|
|
14236
13959
|
}
|
|
14237
13960
|
const triSatBounds = triangle3.satBounds;
|
|
14238
13961
|
const triSatAxes = triangle3.satAxes;
|
|
@@ -14241,8 +13964,7 @@ OrientedBox.prototype.intersectsTriangle = function() {
|
|
|
14241
13964
|
const sb = triSatBounds[i];
|
|
14242
13965
|
const sa = triSatAxes[i];
|
|
14243
13966
|
cachedSatBounds.setFromPoints(sa, points);
|
|
14244
|
-
if (sb.isSeparated(cachedSatBounds))
|
|
14245
|
-
return false;
|
|
13967
|
+
if (sb.isSeparated(cachedSatBounds)) return false;
|
|
14246
13968
|
}
|
|
14247
13969
|
for (let i = 0; i < 3; i++) {
|
|
14248
13970
|
const sa1 = satAxes[i];
|
|
@@ -14251,8 +13973,7 @@ OrientedBox.prototype.intersectsTriangle = function() {
|
|
|
14251
13973
|
cachedAxis.crossVectors(sa1, sa2);
|
|
14252
13974
|
cachedSatBounds.setFromPoints(cachedAxis, pointsArr);
|
|
14253
13975
|
cachedSatBounds2.setFromPoints(cachedAxis, points);
|
|
14254
|
-
if (cachedSatBounds.isSeparated(cachedSatBounds2))
|
|
14255
|
-
return false;
|
|
13976
|
+
if (cachedSatBounds.isSeparated(cachedSatBounds2)) return false;
|
|
14256
13977
|
}
|
|
14257
13978
|
}
|
|
14258
13979
|
return true;
|
|
@@ -14289,10 +14010,8 @@ OrientedBox.prototype.distanceToBox = function() {
|
|
|
14289
14010
|
box.getCenter(point2);
|
|
14290
14011
|
this.closestPointToPoint(point2, point1);
|
|
14291
14012
|
box.closestPointToPoint(point1, point2);
|
|
14292
|
-
if (target1)
|
|
14293
|
-
|
|
14294
|
-
if (target2)
|
|
14295
|
-
target2.copy(point2);
|
|
14013
|
+
if (target1) target1.copy(point1);
|
|
14014
|
+
if (target2) target2.copy(point2);
|
|
14296
14015
|
}
|
|
14297
14016
|
return 0;
|
|
14298
14017
|
}
|
|
@@ -14307,12 +14026,9 @@ OrientedBox.prototype.distanceToBox = function() {
|
|
|
14307
14026
|
const dist = p.distanceToSquared(point2);
|
|
14308
14027
|
if (dist < closestDistanceSq) {
|
|
14309
14028
|
closestDistanceSq = dist;
|
|
14310
|
-
if (target1)
|
|
14311
|
-
|
|
14312
|
-
if (
|
|
14313
|
-
target2.copy(point2);
|
|
14314
|
-
if (dist < threshold2)
|
|
14315
|
-
return Math.sqrt(dist);
|
|
14029
|
+
if (target1) target1.copy(p);
|
|
14030
|
+
if (target2) target2.copy(point2);
|
|
14031
|
+
if (dist < threshold2) return Math.sqrt(dist);
|
|
14316
14032
|
}
|
|
14317
14033
|
}
|
|
14318
14034
|
let count = 0;
|
|
@@ -14353,12 +14069,9 @@ OrientedBox.prototype.distanceToBox = function() {
|
|
|
14353
14069
|
const dist = point2.distanceToSquared(point1);
|
|
14354
14070
|
if (dist < closestDistanceSq) {
|
|
14355
14071
|
closestDistanceSq = dist;
|
|
14356
|
-
if (target1)
|
|
14357
|
-
|
|
14358
|
-
if (
|
|
14359
|
-
target2.copy(point2);
|
|
14360
|
-
if (dist < threshold2)
|
|
14361
|
-
return Math.sqrt(dist);
|
|
14072
|
+
if (target1) target1.copy(point1);
|
|
14073
|
+
if (target2) target2.copy(point2);
|
|
14074
|
+
if (dist < threshold2) return Math.sqrt(dist);
|
|
14362
14075
|
}
|
|
14363
14076
|
}
|
|
14364
14077
|
}
|
|
@@ -14371,12 +14084,9 @@ OrientedBox.prototype.distanceToBox = function() {
|
|
|
14371
14084
|
const dist = point1.distanceToSquared(point2);
|
|
14372
14085
|
if (dist < closestDistanceSq) {
|
|
14373
14086
|
closestDistanceSq = dist;
|
|
14374
|
-
if (target1)
|
|
14375
|
-
|
|
14376
|
-
if (
|
|
14377
|
-
target2.copy(point2);
|
|
14378
|
-
if (dist < threshold2)
|
|
14379
|
-
return Math.sqrt(dist);
|
|
14087
|
+
if (target1) target1.copy(point1);
|
|
14088
|
+
if (target2) target2.copy(point2);
|
|
14089
|
+
if (dist < threshold2) return Math.sqrt(dist);
|
|
14380
14090
|
}
|
|
14381
14091
|
}
|
|
14382
14092
|
}
|
|
@@ -14527,8 +14237,7 @@ function shapecastTraverse(nodeIndex32, geometry, intersectsBoundsFunc, intersec
|
|
|
14527
14237
|
depth + 1
|
|
14528
14238
|
);
|
|
14529
14239
|
}
|
|
14530
|
-
if (c1StopTraversal)
|
|
14531
|
-
return true;
|
|
14240
|
+
if (c1StopTraversal) return true;
|
|
14532
14241
|
box2 = _box2;
|
|
14533
14242
|
arrayToBox(BOUNDING_DATA_INDEX(c2), float32Array2, box2);
|
|
14534
14243
|
const isC2Leaf = IS_LEAF(c2 * 2, uint16Array2);
|
|
@@ -14550,8 +14259,7 @@ function shapecastTraverse(nodeIndex32, geometry, intersectsBoundsFunc, intersec
|
|
|
14550
14259
|
depth + 1
|
|
14551
14260
|
);
|
|
14552
14261
|
}
|
|
14553
|
-
if (c2StopTraversal)
|
|
14554
|
-
return true;
|
|
14262
|
+
if (c2StopTraversal) return true;
|
|
14555
14263
|
return false;
|
|
14556
14264
|
}
|
|
14557
14265
|
}
|
|
@@ -14587,13 +14295,10 @@ function closestPointToPoint(bvh, point2, target = {}, minThreshold = 0, maxThre
|
|
|
14587
14295
|
}
|
|
14588
14296
|
}
|
|
14589
14297
|
);
|
|
14590
|
-
if (closestDistanceSq === Infinity)
|
|
14591
|
-
return null;
|
|
14298
|
+
if (closestDistanceSq === Infinity) return null;
|
|
14592
14299
|
const closestDistance = Math.sqrt(closestDistanceSq);
|
|
14593
|
-
if (!target.point)
|
|
14594
|
-
|
|
14595
|
-
else
|
|
14596
|
-
target.point.copy(temp1$2);
|
|
14300
|
+
if (!target.point) target.point = temp1$2.clone();
|
|
14301
|
+
else target.point.copy(temp1$2);
|
|
14597
14302
|
target.distance = closestDistance, target.faceIndex = closestDistanceTriIndex;
|
|
14598
14303
|
return target;
|
|
14599
14304
|
}
|
|
@@ -14614,8 +14319,7 @@ function checkIntersection(ray2, pA, pB, pC, point2, side) {
|
|
|
14614
14319
|
} else {
|
|
14615
14320
|
intersect = ray2.intersectTriangle(pA, pB, pC, side !== DoubleSide, point2);
|
|
14616
14321
|
}
|
|
14617
|
-
if (intersect === null)
|
|
14618
|
-
return null;
|
|
14322
|
+
if (intersect === null) return null;
|
|
14619
14323
|
const distance = ray2.origin.distanceTo(point2);
|
|
14620
14324
|
return {
|
|
14621
14325
|
distance,
|
|
@@ -14677,8 +14381,7 @@ function intersectTri(geo, side, ray2, tri, intersections) {
|
|
|
14677
14381
|
const intersection = checkBufferGeometryIntersection(ray2, position2, normal, uv, uv1, a, b, c, side);
|
|
14678
14382
|
if (intersection) {
|
|
14679
14383
|
intersection.faceIndex = tri;
|
|
14680
|
-
if (intersections)
|
|
14681
|
-
intersections.push(intersection);
|
|
14384
|
+
if (intersections) intersections.push(intersection);
|
|
14682
14385
|
return intersection;
|
|
14683
14386
|
}
|
|
14684
14387
|
return null;
|
|
@@ -14775,18 +14478,12 @@ function refit(bvh, nodeIndices = null) {
|
|
|
14775
14478
|
const x2 = posAttr.getX(index);
|
|
14776
14479
|
const y2 = posAttr.getY(index);
|
|
14777
14480
|
const z = posAttr.getZ(index);
|
|
14778
|
-
if (x2 < minx)
|
|
14779
|
-
|
|
14780
|
-
if (
|
|
14781
|
-
|
|
14782
|
-
if (
|
|
14783
|
-
|
|
14784
|
-
if (y2 > maxy)
|
|
14785
|
-
maxy = y2;
|
|
14786
|
-
if (z < minz)
|
|
14787
|
-
minz = z;
|
|
14788
|
-
if (z > maxz)
|
|
14789
|
-
maxz = z;
|
|
14481
|
+
if (x2 < minx) minx = x2;
|
|
14482
|
+
if (x2 > maxx) maxx = x2;
|
|
14483
|
+
if (y2 < miny) miny = y2;
|
|
14484
|
+
if (y2 > maxy) maxy = y2;
|
|
14485
|
+
if (z < minz) minz = z;
|
|
14486
|
+
if (z > maxz) maxz = z;
|
|
14790
14487
|
}
|
|
14791
14488
|
if (float32Array2[node32Index + 0] !== minx || float32Array2[node32Index + 1] !== miny || float32Array2[node32Index + 2] !== minz || float32Array2[node32Index + 3] !== maxx || float32Array2[node32Index + 4] !== maxy || float32Array2[node32Index + 5] !== maxz) {
|
|
14792
14489
|
float32Array2[node32Index + 0] = minx;
|
|
@@ -14870,12 +14567,9 @@ function intersectRay(nodeIndex32, array2, ray2) {
|
|
|
14870
14567
|
tymin = (maxy - oy) * invdiry;
|
|
14871
14568
|
tymax = (miny - oy) * invdiry;
|
|
14872
14569
|
}
|
|
14873
|
-
if (tmin > tymax || tymin > tmax)
|
|
14874
|
-
|
|
14875
|
-
if (
|
|
14876
|
-
tmin = tymin;
|
|
14877
|
-
if (tymax < tmax || isNaN(tmax))
|
|
14878
|
-
tmax = tymax;
|
|
14570
|
+
if (tmin > tymax || tymin > tmax) return false;
|
|
14571
|
+
if (tymin > tmin || isNaN(tmin)) tmin = tymin;
|
|
14572
|
+
if (tymax < tmax || isNaN(tmax)) tmax = tymax;
|
|
14879
14573
|
if (invdirz >= 0) {
|
|
14880
14574
|
tzmin = (minz - oz) * invdirz;
|
|
14881
14575
|
tzmax = (maxz - oz) * invdirz;
|
|
@@ -14883,12 +14577,9 @@ function intersectRay(nodeIndex32, array2, ray2) {
|
|
|
14883
14577
|
tzmin = (maxz - oz) * invdirz;
|
|
14884
14578
|
tzmax = (minz - oz) * invdirz;
|
|
14885
14579
|
}
|
|
14886
|
-
if (tmin > tzmax || tzmin > tmax)
|
|
14887
|
-
|
|
14888
|
-
if (
|
|
14889
|
-
tmax = tzmax;
|
|
14890
|
-
if (tmax < 0)
|
|
14891
|
-
return false;
|
|
14580
|
+
if (tmin > tzmax || tzmin > tmax) return false;
|
|
14581
|
+
if (tzmax < tmax || tmax !== tmax) tmax = tzmax;
|
|
14582
|
+
if (tmax < 0) return false;
|
|
14892
14583
|
return true;
|
|
14893
14584
|
}
|
|
14894
14585
|
function intersectTris_indirect(bvh, side, ray2, offset, count, intersections) {
|
|
@@ -15075,12 +14766,10 @@ function _intersectsGeometry$1(nodeIndex32, bvh, otherGeometry, geometryToBvh, c
|
|
|
15075
14766
|
const right = uint32Array2[nodeIndex32 + 6];
|
|
15076
14767
|
arrayToBox(BOUNDING_DATA_INDEX(left), float32Array2, boundingBox$1);
|
|
15077
14768
|
const leftIntersection = cachedObb.intersectsBox(boundingBox$1) && _intersectsGeometry$1(left, bvh, otherGeometry, geometryToBvh, cachedObb);
|
|
15078
|
-
if (leftIntersection)
|
|
15079
|
-
return true;
|
|
14769
|
+
if (leftIntersection) return true;
|
|
15080
14770
|
arrayToBox(BOUNDING_DATA_INDEX(right), float32Array2, boundingBox$1);
|
|
15081
14771
|
const rightIntersection = cachedObb.intersectsBox(boundingBox$1) && _intersectsGeometry$1(right, bvh, otherGeometry, geometryToBvh, cachedObb);
|
|
15082
|
-
if (rightIntersection)
|
|
15083
|
-
return true;
|
|
14772
|
+
if (rightIntersection) return true;
|
|
15084
14773
|
return false;
|
|
15085
14774
|
}
|
|
15086
14775
|
}
|
|
@@ -15212,10 +14901,8 @@ function closestPointToGeometry(bvh, otherGeometry, geometryToBvh, target1 = {},
|
|
|
15212
14901
|
}
|
|
15213
14902
|
target1.distance = closestDistance, target1.faceIndex = closestDistanceTriIndex;
|
|
15214
14903
|
if (target2) {
|
|
15215
|
-
if (!target2.point)
|
|
15216
|
-
|
|
15217
|
-
else
|
|
15218
|
-
target2.point.copy(tempTargetDest2);
|
|
14904
|
+
if (!target2.point) target2.point = tempTargetDest2.clone();
|
|
14905
|
+
else target2.point.copy(tempTargetDest2);
|
|
15219
14906
|
target2.point.applyMatrix4(tempMatrix$1);
|
|
15220
14907
|
tempTargetDest1.applyMatrix4(tempMatrix$1);
|
|
15221
14908
|
target2.distance = tempTargetDest1.sub(target2.point).length();
|
|
@@ -15261,18 +14948,12 @@ function refit_indirect(bvh, nodeIndices = null) {
|
|
|
15261
14948
|
const x2 = posAttr.getX(index);
|
|
15262
14949
|
const y2 = posAttr.getY(index);
|
|
15263
14950
|
const z = posAttr.getZ(index);
|
|
15264
|
-
if (x2 < minx)
|
|
15265
|
-
|
|
15266
|
-
if (
|
|
15267
|
-
|
|
15268
|
-
if (
|
|
15269
|
-
|
|
15270
|
-
if (y2 > maxy)
|
|
15271
|
-
maxy = y2;
|
|
15272
|
-
if (z < minz)
|
|
15273
|
-
minz = z;
|
|
15274
|
-
if (z > maxz)
|
|
15275
|
-
maxz = z;
|
|
14951
|
+
if (x2 < minx) minx = x2;
|
|
14952
|
+
if (x2 > maxx) maxx = x2;
|
|
14953
|
+
if (y2 < miny) miny = y2;
|
|
14954
|
+
if (y2 > maxy) maxy = y2;
|
|
14955
|
+
if (z < minz) minz = z;
|
|
14956
|
+
if (z > maxz) maxz = z;
|
|
15276
14957
|
}
|
|
15277
14958
|
}
|
|
15278
14959
|
if (float32Array2[node32Index + 0] !== minx || float32Array2[node32Index + 1] !== miny || float32Array2[node32Index + 2] !== minz || float32Array2[node32Index + 3] !== maxx || float32Array2[node32Index + 4] !== maxy || float32Array2[node32Index + 5] !== maxz) {
|
|
@@ -15480,12 +15161,10 @@ function _intersectsGeometry(nodeIndex32, bvh, otherGeometry, geometryToBvh, cac
|
|
|
15480
15161
|
const right = uint32Array2[nodeIndex32 + 6];
|
|
15481
15162
|
arrayToBox(BOUNDING_DATA_INDEX(left), float32Array2, boundingBox);
|
|
15482
15163
|
const leftIntersection = cachedObb.intersectsBox(boundingBox) && _intersectsGeometry(left, bvh, otherGeometry, geometryToBvh, cachedObb);
|
|
15483
|
-
if (leftIntersection)
|
|
15484
|
-
return true;
|
|
15164
|
+
if (leftIntersection) return true;
|
|
15485
15165
|
arrayToBox(BOUNDING_DATA_INDEX(right), float32Array2, boundingBox);
|
|
15486
15166
|
const rightIntersection = cachedObb.intersectsBox(boundingBox) && _intersectsGeometry(right, bvh, otherGeometry, geometryToBvh, cachedObb);
|
|
15487
|
-
if (rightIntersection)
|
|
15488
|
-
return true;
|
|
15167
|
+
if (rightIntersection) return true;
|
|
15489
15168
|
return false;
|
|
15490
15169
|
}
|
|
15491
15170
|
}
|
|
@@ -15620,10 +15299,8 @@ function closestPointToGeometry_indirect(bvh, otherGeometry, geometryToBvh, targ
|
|
|
15620
15299
|
}
|
|
15621
15300
|
target1.distance = closestDistance, target1.faceIndex = closestDistanceTriIndex;
|
|
15622
15301
|
if (target2) {
|
|
15623
|
-
if (!target2.point)
|
|
15624
|
-
|
|
15625
|
-
else
|
|
15626
|
-
target2.point.copy(tempTargetDest2);
|
|
15302
|
+
if (!target2.point) target2.point = tempTargetDest2.clone();
|
|
15303
|
+
else target2.point.copy(tempTargetDest2);
|
|
15627
15304
|
target2.point.applyMatrix4(tempMatrix);
|
|
15628
15305
|
tempTargetDest1.applyMatrix4(tempMatrix);
|
|
15629
15306
|
target2.distance = tempTargetDest1.sub(target2.point).length();
|
|
@@ -15641,7 +15318,12 @@ const _leftBox1 = new Box3();
|
|
|
15641
15318
|
const _rightBox1 = new Box3();
|
|
15642
15319
|
const _leftBox2 = new Box3();
|
|
15643
15320
|
const _rightBox2 = new Box3();
|
|
15321
|
+
let _active = false;
|
|
15644
15322
|
function bvhcast(bvh, otherBvh, matrixToLocal, intersectsRanges) {
|
|
15323
|
+
if (_active) {
|
|
15324
|
+
throw new Error("MeshBVH: Recursive calls to bvhcast not supported.");
|
|
15325
|
+
}
|
|
15326
|
+
_active = true;
|
|
15645
15327
|
const roots = bvh._roots;
|
|
15646
15328
|
const otherRoots = otherBvh._roots;
|
|
15647
15329
|
let result;
|
|
@@ -15681,6 +15363,7 @@ function bvhcast(bvh, otherBvh, matrixToLocal, intersectsRanges) {
|
|
|
15681
15363
|
break;
|
|
15682
15364
|
}
|
|
15683
15365
|
}
|
|
15366
|
+
_active = false;
|
|
15684
15367
|
return result;
|
|
15685
15368
|
}
|
|
15686
15369
|
function _traverse(node1Index32, node2Index32, matrix2to1, matrix1to2, intersectsRangesFunc, node1IndexByteOffset = 0, node2IndexByteOffset = 0, depth1 = 0, depth2 = 0, currBox = null, reversed = false) {
|
|
@@ -16236,8 +15919,7 @@ const tmpInverseMatrix = /* @__PURE__ */ new Matrix4();
|
|
|
16236
15919
|
const origMeshRaycastFunc = Mesh.prototype.raycast;
|
|
16237
15920
|
function acceleratedRaycast(raycaster, intersects) {
|
|
16238
15921
|
if (this.geometry.boundsTree) {
|
|
16239
|
-
if (this.material === void 0)
|
|
16240
|
-
return;
|
|
15922
|
+
if (this.material === void 0) return;
|
|
16241
15923
|
tmpInverseMatrix.copy(this.matrixWorld).invert();
|
|
16242
15924
|
ray.copy(raycaster.ray).applyMatrix4(tmpInverseMatrix);
|
|
16243
15925
|
const bvh = this.geometry.boundsTree;
|
|
@@ -16435,8 +16117,7 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
16435
16117
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
16436
16118
|
if (decorator = decorators[i])
|
|
16437
16119
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
16438
|
-
if (kind && result)
|
|
16439
|
-
__defProp(target, key, result);
|
|
16120
|
+
if (kind && result) __defProp(target, key, result);
|
|
16440
16121
|
return result;
|
|
16441
16122
|
};
|
|
16442
16123
|
let ThreeSVGRendererPlugin = class extends AViewerPluginSync {
|
|
@@ -16466,8 +16147,7 @@ let ThreeSVGRendererPlugin = class extends AViewerPluginSync {
|
|
|
16466
16147
|
this._rendering = false;
|
|
16467
16148
|
this._viewerListeners = {
|
|
16468
16149
|
postRender: (_) => {
|
|
16469
|
-
if (this.autoRender)
|
|
16470
|
-
this.render();
|
|
16150
|
+
if (this.autoRender) this.render();
|
|
16471
16151
|
}
|
|
16472
16152
|
};
|
|
16473
16153
|
this._onResize = this._onResize.bind(this);
|
|
@@ -16546,40 +16226,32 @@ let ThreeSVGRendererPlugin = class extends AViewerPluginSync {
|
|
|
16546
16226
|
viewer.scene.modelRoot.removeEventListener("objectUpdate", this.updateMeshes);
|
|
16547
16227
|
}
|
|
16548
16228
|
_onMeshDispose(ev) {
|
|
16549
|
-
if (!ev.target)
|
|
16550
|
-
return;
|
|
16229
|
+
if (!ev.target) return;
|
|
16551
16230
|
const mesh = ev.target;
|
|
16552
16231
|
const svgMesh = this._meshes.get(mesh.uuid);
|
|
16553
|
-
if (!svgMesh)
|
|
16554
|
-
return;
|
|
16232
|
+
if (!svgMesh) return;
|
|
16555
16233
|
svgMesh.dispose();
|
|
16556
16234
|
this._meshes.delete(mesh.uuid);
|
|
16557
16235
|
mesh.removeEventListener("dispose", this._onMeshDispose);
|
|
16558
16236
|
mesh.removeEventListener("objectUpdate", this._onMeshUpdate);
|
|
16559
16237
|
}
|
|
16560
16238
|
_onMeshUpdate(ev) {
|
|
16561
|
-
if (!ev.target)
|
|
16562
|
-
return;
|
|
16239
|
+
if (!ev.target) return;
|
|
16563
16240
|
const mesh = ev.target;
|
|
16564
16241
|
const svgMesh = this._meshes.get(mesh.uuid);
|
|
16565
|
-
if (!svgMesh)
|
|
16566
|
-
return;
|
|
16242
|
+
if (!svgMesh) return;
|
|
16567
16243
|
svgMesh.updateObject();
|
|
16568
16244
|
}
|
|
16569
16245
|
_refreshMeshes(root2) {
|
|
16570
|
-
if (!this.autoMakeSvgObjects)
|
|
16571
|
-
|
|
16572
|
-
if (!root2
|
|
16573
|
-
root2 = this._viewer.scene.modelRoot;
|
|
16574
|
-
if (!root2)
|
|
16575
|
-
return [];
|
|
16246
|
+
if (!this.autoMakeSvgObjects) return [];
|
|
16247
|
+
if (!root2 && this._viewer) root2 = this._viewer.scene.modelRoot;
|
|
16248
|
+
if (!root2) return [];
|
|
16576
16249
|
root2.traverse((o) => {
|
|
16577
16250
|
this.makeSVGObject(o);
|
|
16578
16251
|
});
|
|
16579
16252
|
}
|
|
16580
16253
|
makeSVGObject(o) {
|
|
16581
|
-
if (!(o.isMesh && !this._meshes.has(o.uuid)))
|
|
16582
|
-
return;
|
|
16254
|
+
if (!(o.isMesh && !this._meshes.has(o.uuid))) return;
|
|
16583
16255
|
const ud = o.userData;
|
|
16584
16256
|
o.userData = {};
|
|
16585
16257
|
const svgMesh = new SVGMesh(o);
|
|
@@ -16608,12 +16280,9 @@ let ThreeSVGRendererPlugin = class extends AViewerPluginSync {
|
|
|
16608
16280
|
}
|
|
16609
16281
|
}
|
|
16610
16282
|
async render() {
|
|
16611
|
-
if (!this._viewer || !this._viewer.renderEnabled)
|
|
16612
|
-
|
|
16613
|
-
if (this.
|
|
16614
|
-
return;
|
|
16615
|
-
if (this._rendering)
|
|
16616
|
-
return;
|
|
16283
|
+
if (!this._viewer || !this._viewer.renderEnabled) return;
|
|
16284
|
+
if (this.isDisabled()) return;
|
|
16285
|
+
if (this._rendering) return;
|
|
16617
16286
|
this._rendering = true;
|
|
16618
16287
|
this._refreshParams();
|
|
16619
16288
|
this._refreshMeshes();
|
|
@@ -16670,21 +16339,18 @@ let ThreeSVGRendererPlugin = class extends AViewerPluginSync {
|
|
|
16670
16339
|
}
|
|
16671
16340
|
get svgNode() {
|
|
16672
16341
|
var _a;
|
|
16673
|
-
if (!this.svgNodeContainer.children.length)
|
|
16674
|
-
return void 0;
|
|
16342
|
+
if (!this.svgNodeContainer.children.length) return void 0;
|
|
16675
16343
|
if (this.svgNodeContainer.children.length > 1) {
|
|
16676
16344
|
(_a = this._viewer) == null ? void 0 : _a.console.warn("ThreeSVGRenderer: Multiple svg nodes in container, should not be possible");
|
|
16677
16345
|
}
|
|
16678
16346
|
return this.svgNodeContainer.children[0];
|
|
16679
16347
|
}
|
|
16680
16348
|
_refreshParams() {
|
|
16681
|
-
if (this.isDisabled())
|
|
16682
|
-
return;
|
|
16349
|
+
if (this.isDisabled()) return;
|
|
16683
16350
|
if (this._meshesNeedsUpdate) {
|
|
16684
16351
|
this.renderer.viewmap.options.updateMeshes = true;
|
|
16685
16352
|
this._meshesNeedsUpdate = false;
|
|
16686
|
-
} else
|
|
16687
|
-
this.renderer.viewmap.options.updateMeshes = this.alwaysUpdateMeshes;
|
|
16353
|
+
} else this.renderer.viewmap.options.updateMeshes = this.alwaysUpdateMeshes;
|
|
16688
16354
|
this.renderer.viewmap.options.creaseAngle.min = this.creaseAngle.x;
|
|
16689
16355
|
this.renderer.viewmap.options.creaseAngle.max = this.creaseAngle.y;
|
|
16690
16356
|
const passes = this.renderer.drawHandler.passes;
|
|
@@ -16705,55 +16371,54 @@ let ThreeSVGRendererPlugin = class extends AViewerPluginSync {
|
|
|
16705
16371
|
}
|
|
16706
16372
|
}
|
|
16707
16373
|
_onResize() {
|
|
16708
|
-
if (!this._viewer)
|
|
16709
|
-
return;
|
|
16374
|
+
if (!this._viewer) return;
|
|
16710
16375
|
}
|
|
16711
16376
|
};
|
|
16712
16377
|
ThreeSVGRendererPlugin.PluginType = "ThreeSVGRendererPlugin";
|
|
16713
16378
|
ThreeSVGRendererPlugin.SVG_RENDER_TIMEOUT = 2e3;
|
|
16714
16379
|
__decorateClass([
|
|
16715
16380
|
uiToggle$1(),
|
|
16716
|
-
onChange
|
|
16381
|
+
onChange(ThreeSVGRendererPlugin.prototype.setDirty)
|
|
16717
16382
|
], ThreeSVGRendererPlugin.prototype, "enabled", 2);
|
|
16718
16383
|
__decorateClass([
|
|
16719
16384
|
uiToggle$1(),
|
|
16720
|
-
onChange
|
|
16385
|
+
onChange(ThreeSVGRendererPlugin.prototype.setDirty)
|
|
16721
16386
|
], ThreeSVGRendererPlugin.prototype, "autoRender", 2);
|
|
16722
16387
|
__decorateClass([
|
|
16723
16388
|
uiToggle$1(),
|
|
16724
|
-
onChange
|
|
16389
|
+
onChange(ThreeSVGRendererPlugin.prototype.setDirty)
|
|
16725
16390
|
], ThreeSVGRendererPlugin.prototype, "drawPolygons", 2);
|
|
16726
16391
|
__decorateClass([
|
|
16727
16392
|
uiToggle$1(),
|
|
16728
|
-
onChange
|
|
16393
|
+
onChange(ThreeSVGRendererPlugin.prototype.setDirty)
|
|
16729
16394
|
], ThreeSVGRendererPlugin.prototype, "drawPolygonFills", 2);
|
|
16730
16395
|
__decorateClass([
|
|
16731
16396
|
uiToggle$1(),
|
|
16732
|
-
onChange
|
|
16397
|
+
onChange(ThreeSVGRendererPlugin.prototype.setDirty)
|
|
16733
16398
|
], ThreeSVGRendererPlugin.prototype, "drawPolygonStrokes", 2);
|
|
16734
16399
|
__decorateClass([
|
|
16735
16400
|
uiToggle$1(),
|
|
16736
|
-
onChange
|
|
16401
|
+
onChange(ThreeSVGRendererPlugin.prototype.setDirty)
|
|
16737
16402
|
], ThreeSVGRendererPlugin.prototype, "drawImageFills", 2);
|
|
16738
16403
|
__decorateClass([
|
|
16739
16404
|
uiToggle$1(),
|
|
16740
|
-
onChange
|
|
16405
|
+
onChange(ThreeSVGRendererPlugin.prototype.setDirty)
|
|
16741
16406
|
], ThreeSVGRendererPlugin.prototype, "drawVisibleContours", 2);
|
|
16742
16407
|
__decorateClass([
|
|
16743
16408
|
uiToggle$1(),
|
|
16744
|
-
onChange
|
|
16409
|
+
onChange(ThreeSVGRendererPlugin.prototype.setDirty)
|
|
16745
16410
|
], ThreeSVGRendererPlugin.prototype, "drawHiddenContours", 2);
|
|
16746
16411
|
__decorateClass([
|
|
16747
16412
|
uiToggle$1(),
|
|
16748
|
-
onChange
|
|
16413
|
+
onChange(ThreeSVGRendererPlugin.prototype.setDirty)
|
|
16749
16414
|
], ThreeSVGRendererPlugin.prototype, "alwaysUpdateMeshes", 2);
|
|
16750
16415
|
__decorateClass([
|
|
16751
16416
|
uiVector(),
|
|
16752
|
-
onChange
|
|
16417
|
+
onChange(ThreeSVGRendererPlugin.prototype.setDirty)
|
|
16753
16418
|
], ThreeSVGRendererPlugin.prototype, "creaseAngle", 2);
|
|
16754
16419
|
__decorateClass([
|
|
16755
16420
|
uiToggle$1(),
|
|
16756
|
-
onChange
|
|
16421
|
+
onChange(ThreeSVGRendererPlugin.prototype.setDirty)
|
|
16757
16422
|
], ThreeSVGRendererPlugin.prototype, "autoMakeSvgObjects", 2);
|
|
16758
16423
|
__decorateClass([
|
|
16759
16424
|
uiButton()
|