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