@threepipe/plugin-svg-renderer 0.2.1 → 0.2.3
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 +15 -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.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
})(this, function(exports2, threepipe, three) {
|
|
4
4
|
"use strict";/**
|
|
5
5
|
* @license
|
|
6
|
-
* @threepipe/plugin-svg-renderer v0.2.
|
|
7
|
-
* Copyright 2022-
|
|
6
|
+
* @threepipe/plugin-svg-renderer v0.2.3
|
|
7
|
+
* Copyright 2022-2025 repalash <palash@shaders.app>
|
|
8
8
|
* GPLV3 License
|
|
9
9
|
* See ./dependencies.txt for any bundled third-party dependencies and licenses.
|
|
10
10
|
*/
|
|
@@ -114,8 +114,7 @@
|
|
|
114
114
|
uvs.push(x2, y2);
|
|
115
115
|
}
|
|
116
116
|
function checkTriangleVisibility(v1, v2, v3) {
|
|
117
|
-
if (v1.visible === true || v2.visible === true || v3.visible === true)
|
|
118
|
-
return true;
|
|
117
|
+
if (v1.visible === true || v2.visible === true || v3.visible === true) return true;
|
|
119
118
|
_points3[0] = v1.positionScreen;
|
|
120
119
|
_points3[1] = v2.positionScreen;
|
|
121
120
|
_points3[2] = v3.positionScreen;
|
|
@@ -150,8 +149,7 @@
|
|
|
150
149
|
const v1 = _vertexPool[a];
|
|
151
150
|
const v2 = _vertexPool[b];
|
|
152
151
|
const v3 = _vertexPool[c];
|
|
153
|
-
if (checkTriangleVisibility(v1, v2, v3) === false)
|
|
154
|
-
return;
|
|
152
|
+
if (checkTriangleVisibility(v1, v2, v3) === false) return;
|
|
155
153
|
if (material.side === threepipe.DoubleSide || checkBackfaceCulling(v1, v2, v3) === true) {
|
|
156
154
|
_face = getNextFaceInPool();
|
|
157
155
|
_face.id = object.id;
|
|
@@ -195,21 +193,16 @@
|
|
|
195
193
|
}
|
|
196
194
|
const renderList = new RenderList();
|
|
197
195
|
function projectObject(object) {
|
|
198
|
-
if (object.visible === false)
|
|
199
|
-
return;
|
|
196
|
+
if (object.visible === false) return;
|
|
200
197
|
if (object.isLight) {
|
|
201
198
|
_renderData.lights.push(object);
|
|
202
199
|
} else if (object.isMesh || object.isLine || object.isPoints) {
|
|
203
|
-
if (object.material.visible === false)
|
|
204
|
-
|
|
205
|
-
if (object.frustumCulled === true && _frustum.intersectsObject(object) === false)
|
|
206
|
-
return;
|
|
200
|
+
if (object.material.visible === false) return;
|
|
201
|
+
if (object.frustumCulled === true && _frustum.intersectsObject(object) === false) return;
|
|
207
202
|
addObject(object);
|
|
208
203
|
} else if (object.isSprite) {
|
|
209
|
-
if (object.material.visible === false)
|
|
210
|
-
|
|
211
|
-
if (object.frustumCulled === true && _frustum.intersectsSprite(object) === false)
|
|
212
|
-
return;
|
|
204
|
+
if (object.material.visible === false) return;
|
|
205
|
+
if (object.frustumCulled === true && _frustum.intersectsSprite(object) === false) return;
|
|
213
206
|
addObject(object);
|
|
214
207
|
}
|
|
215
208
|
const children = object.children;
|
|
@@ -232,10 +225,8 @@
|
|
|
232
225
|
_lineCount = 0;
|
|
233
226
|
_spriteCount = 0;
|
|
234
227
|
_renderData.elements.length = 0;
|
|
235
|
-
if (scene.matrixWorldAutoUpdate === true)
|
|
236
|
-
|
|
237
|
-
if (camera.parent === null && camera.matrixWorldAutoUpdate === true)
|
|
238
|
-
camera.updateMatrixWorld();
|
|
228
|
+
if (scene.matrixWorldAutoUpdate === true) scene.updateMatrixWorld();
|
|
229
|
+
if (camera.parent === null && camera.matrixWorldAutoUpdate === true) camera.updateMatrixWorld();
|
|
239
230
|
_viewMatrix.copy(camera.matrixWorldInverse);
|
|
240
231
|
_viewProjectionMatrix.multiplyMatrices(camera.projectionMatrix, _viewMatrix);
|
|
241
232
|
_frustum.setFromProjectionMatrix(_viewProjectionMatrix);
|
|
@@ -258,8 +249,7 @@
|
|
|
258
249
|
const isMultiMaterial = Array.isArray(material);
|
|
259
250
|
const attributes = geometry.attributes;
|
|
260
251
|
const groups = geometry.groups;
|
|
261
|
-
if (attributes.position === void 0)
|
|
262
|
-
continue;
|
|
252
|
+
if (attributes.position === void 0) continue;
|
|
263
253
|
const positions = attributes.position.array;
|
|
264
254
|
for (let i = 0, l = positions.length; i < l; i += 3) {
|
|
265
255
|
let x2 = positions[i];
|
|
@@ -271,8 +261,7 @@
|
|
|
271
261
|
const morphInfluences = object.morphTargetInfluences;
|
|
272
262
|
for (let t = 0, tl = morphTargets.length; t < tl; t++) {
|
|
273
263
|
const influence = morphInfluences[t];
|
|
274
|
-
if (influence === 0)
|
|
275
|
-
continue;
|
|
264
|
+
if (influence === 0) continue;
|
|
276
265
|
const target = morphTargets[t];
|
|
277
266
|
if (morphTargetsRelative) {
|
|
278
267
|
x2 += target.getX(i / 3) * influence;
|
|
@@ -311,8 +300,7 @@
|
|
|
311
300
|
for (let g = 0; g < groups.length; g++) {
|
|
312
301
|
const group = groups[g];
|
|
313
302
|
material = isMultiMaterial === true ? object.material[group.materialIndex] : object.material;
|
|
314
|
-
if (material === void 0)
|
|
315
|
-
continue;
|
|
303
|
+
if (material === void 0) continue;
|
|
316
304
|
for (let i = group.start, l = group.start + group.count; i < l; i += 3) {
|
|
317
305
|
renderList.pushTriangle(indices[i], indices[i + 1], indices[i + 2], material);
|
|
318
306
|
}
|
|
@@ -327,8 +315,7 @@
|
|
|
327
315
|
for (let g = 0; g < groups.length; g++) {
|
|
328
316
|
const group = groups[g];
|
|
329
317
|
material = isMultiMaterial === true ? object.material[group.materialIndex] : object.material;
|
|
330
|
-
if (material === void 0)
|
|
331
|
-
continue;
|
|
318
|
+
if (material === void 0) continue;
|
|
332
319
|
for (let i = group.start, l = group.start + group.count; i < l; i += 3) {
|
|
333
320
|
renderList.pushTriangle(i, i + 1, i + 2, material);
|
|
334
321
|
}
|
|
@@ -585,8 +572,7 @@
|
|
|
585
572
|
for (let e = 0, el = _elements.length; e < el; e++) {
|
|
586
573
|
const element = _elements[e];
|
|
587
574
|
const material = element.material;
|
|
588
|
-
if (material === void 0 || material.opacity === 0)
|
|
589
|
-
continue;
|
|
575
|
+
if (material === void 0 || material.opacity === 0) continue;
|
|
590
576
|
_elemBox.makeEmpty();
|
|
591
577
|
if (element instanceof RenderableSprite) {
|
|
592
578
|
_v1 = element;
|
|
@@ -608,12 +594,9 @@
|
|
|
608
594
|
_v1 = element.v1;
|
|
609
595
|
_v22 = element.v2;
|
|
610
596
|
_v3 = element.v3;
|
|
611
|
-
if (_v1.positionScreen.z < -1 || _v1.positionScreen.z > 1)
|
|
612
|
-
|
|
613
|
-
if (
|
|
614
|
-
continue;
|
|
615
|
-
if (_v3.positionScreen.z < -1 || _v3.positionScreen.z > 1)
|
|
616
|
-
continue;
|
|
597
|
+
if (_v1.positionScreen.z < -1 || _v1.positionScreen.z > 1) continue;
|
|
598
|
+
if (_v22.positionScreen.z < -1 || _v22.positionScreen.z > 1) continue;
|
|
599
|
+
if (_v3.positionScreen.z < -1 || _v3.positionScreen.z > 1) continue;
|
|
617
600
|
_v1.positionScreen.x *= _svgWidthHalf;
|
|
618
601
|
_v1.positionScreen.y *= -_svgHeightHalf;
|
|
619
602
|
_v22.positionScreen.x *= _svgWidthHalf;
|
|
@@ -640,8 +623,7 @@
|
|
|
640
623
|
if (object.isSVGObject) {
|
|
641
624
|
_vector3.setFromMatrixPosition(object.matrixWorld);
|
|
642
625
|
_vector3.applyMatrix4(_viewProjectionMatrix);
|
|
643
|
-
if (_vector3.z < -1 || _vector3.z > 1)
|
|
644
|
-
return;
|
|
626
|
+
if (_vector3.z < -1 || _vector3.z > 1) return;
|
|
645
627
|
const x2 = _vector3.x * _svgWidthHalf;
|
|
646
628
|
const y2 = -_vector3.y * _svgHeightHalf;
|
|
647
629
|
const node = object.node;
|
|
@@ -679,8 +661,7 @@
|
|
|
679
661
|
if (light.isDirectionalLight) {
|
|
680
662
|
const lightPosition = _vector3.setFromMatrixPosition(light.matrixWorld).sub(_normal2.setFromMatrixPosition(light.target.matrixWorld)).normalize();
|
|
681
663
|
let amount = normal.dot(lightPosition);
|
|
682
|
-
if (amount <= 0)
|
|
683
|
-
continue;
|
|
664
|
+
if (amount <= 0) continue;
|
|
684
665
|
amount *= light.intensity;
|
|
685
666
|
color.r += lightColor.r * amount;
|
|
686
667
|
color.g += lightColor.g * amount;
|
|
@@ -688,11 +669,9 @@
|
|
|
688
669
|
} else if (light.isPointLight) {
|
|
689
670
|
const lightPosition = _vector3.setFromMatrixPosition(light.matrixWorld);
|
|
690
671
|
let amount = normal.dot(_vector3.subVectors(lightPosition, position2).normalize());
|
|
691
|
-
if (amount <= 0)
|
|
692
|
-
continue;
|
|
672
|
+
if (amount <= 0) continue;
|
|
693
673
|
amount *= light.distance == 0 ? 1 : 1 - Math.min(position2.distanceTo(lightPosition) / light.distance, 1);
|
|
694
|
-
if (amount == 0)
|
|
695
|
-
continue;
|
|
674
|
+
if (amount == 0) continue;
|
|
696
675
|
amount *= light.intensity;
|
|
697
676
|
color.r += lightColor.r * amount;
|
|
698
677
|
color.g += lightColor.g * amount;
|
|
@@ -757,8 +736,7 @@
|
|
|
757
736
|
function expand(v1, v2, pixels) {
|
|
758
737
|
let x2 = v2.x - v1.x, y2 = v2.y - v1.y;
|
|
759
738
|
const det = x2 * x2 + y2 * y2;
|
|
760
|
-
if (det === 0)
|
|
761
|
-
return;
|
|
739
|
+
if (det === 0) return;
|
|
762
740
|
const idet = pixels / Math.sqrt(det);
|
|
763
741
|
x2 *= idet;
|
|
764
742
|
y2 *= idet;
|
|
@@ -800,22 +778,18 @@
|
|
|
800
778
|
};
|
|
801
779
|
/**
|
|
802
780
|
* @license
|
|
803
|
-
* uiconfig.js v0.
|
|
804
|
-
* Copyright 2022-
|
|
781
|
+
* uiconfig.js v0.1.3
|
|
782
|
+
* Copyright 2022-2025 repalash <palash@shaders.app>
|
|
805
783
|
* MIT License
|
|
806
784
|
*/
|
|
807
|
-
function
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
const
|
|
814
|
-
|
|
815
|
-
data2[6] = data2[6] & 15 | 64;
|
|
816
|
-
data2[8] = data2[8] & 63 | 128;
|
|
817
|
-
const view = new DataView(data2.buffer);
|
|
818
|
-
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)}`;
|
|
785
|
+
function Ee(n, ...e) {
|
|
786
|
+
return typeof n == "function" && (n = n(...e)), n;
|
|
787
|
+
}
|
|
788
|
+
function it() {
|
|
789
|
+
const n = (i, r) => i.toString(16).padStart(r, "0"), e = crypto.getRandomValues(new Uint8Array(16));
|
|
790
|
+
e[6] = e[6] & 15 | 64, e[8] = e[8] & 63 | 128;
|
|
791
|
+
const t = new DataView(e.buffer);
|
|
792
|
+
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)}`;
|
|
819
793
|
}
|
|
820
794
|
class UiConfigTypeMap {
|
|
821
795
|
}
|
|
@@ -829,7 +803,7 @@
|
|
|
829
803
|
} else {
|
|
830
804
|
const uiType = valueToUiType(val);
|
|
831
805
|
if (uiType === "folder") {
|
|
832
|
-
result = generateUiFolder(key + "", val);
|
|
806
|
+
result = generateUiFolder(key + "", val, {}, "folder", true);
|
|
833
807
|
} else if (uiType)
|
|
834
808
|
result = {
|
|
835
809
|
type: uiType,
|
|
@@ -854,15 +828,14 @@
|
|
|
854
828
|
types.push(type);
|
|
855
829
|
type = Object.getPrototypeOf(type);
|
|
856
830
|
}
|
|
857
|
-
if (!types.length) {
|
|
831
|
+
if (!types.length || Array.isArray(obj)) {
|
|
858
832
|
const keys = typeof obj === "object" ? Object.keys(obj) : Array.isArray(obj) ? obj.map((_, i) => i) : [];
|
|
859
833
|
for (const key of keys) {
|
|
860
834
|
const val = obj[key];
|
|
861
835
|
if (val === void 0 || val === null)
|
|
862
836
|
continue;
|
|
863
837
|
const c = () => generateValueConfig(obj, key, key + "", val);
|
|
864
|
-
|
|
865
|
-
result.push(c);
|
|
838
|
+
result.push(c);
|
|
866
839
|
}
|
|
867
840
|
}
|
|
868
841
|
types.reverse().forEach((t) => {
|
|
@@ -895,8 +868,8 @@
|
|
|
895
868
|
});
|
|
896
869
|
return result;
|
|
897
870
|
}
|
|
898
|
-
function generateUiFolder(label, obj, params = {}, type = "folder") {
|
|
899
|
-
return Object.assign({ type, label, children: generateUiConfig(obj), uuid:
|
|
871
|
+
function generateUiFolder(label, obj, params = {}, type = "folder", dynamic = false) {
|
|
872
|
+
return Object.assign({ type, label, children: !dynamic ? generateUiConfig(obj) : () => generateUiConfig(obj), uuid: it() }, params);
|
|
900
873
|
}
|
|
901
874
|
function valueToUiType(val) {
|
|
902
875
|
if (val === null || val === void 0)
|
|
@@ -950,7 +923,7 @@
|
|
|
950
923
|
return class extends constructor {
|
|
951
924
|
constructor() {
|
|
952
925
|
super(...arguments);
|
|
953
|
-
this.uiConfig = generateUiFolder(
|
|
926
|
+
this.uiConfig = generateUiFolder(Ee(label, this) || "", this, {}, type);
|
|
954
927
|
}
|
|
955
928
|
};
|
|
956
929
|
};
|
|
@@ -969,62 +942,66 @@
|
|
|
969
942
|
function uiFolderContainer(label, params) {
|
|
970
943
|
return uiContainer(label, params, "folder");
|
|
971
944
|
}
|
|
945
|
+
typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
|
|
946
|
+
var e = new Error(message);
|
|
947
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
948
|
+
};
|
|
972
949
|
/**
|
|
973
950
|
* @license
|
|
974
|
-
* ts-browser-helpers v0.
|
|
975
|
-
* Copyright 2022-
|
|
951
|
+
* ts-browser-helpers v0.16.2
|
|
952
|
+
* Copyright 2022-2025 repalash <palash@shaders.app>
|
|
976
953
|
* MIT License
|
|
954
|
+
* See ./dependencies.txt for bundled third-party dependencies and licenses.
|
|
977
955
|
*/
|
|
978
|
-
function
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
956
|
+
function v(n, e) {
|
|
957
|
+
return Object.hasOwn ? Object.hasOwn(n, e) : n.hasOwnProperty(e);
|
|
958
|
+
}
|
|
959
|
+
const m = class m2 {
|
|
960
|
+
static callFunction(e, t, i = []) {
|
|
961
|
+
if (!t) return e(...i);
|
|
962
|
+
if (e.name && t[e.name] === e) return e.call(t, ...i);
|
|
963
|
+
m2.methodMap.has(t) || m2.methodMap.set(t, /* @__PURE__ */ new WeakMap());
|
|
964
|
+
const r = m2.methodMap.get(t);
|
|
965
|
+
if (!r.has(e)) {
|
|
966
|
+
let s = t;
|
|
967
|
+
for (; s; ) {
|
|
968
|
+
const o = Object.values(Object.getOwnPropertyDescriptors(s));
|
|
969
|
+
for (let c of o)
|
|
970
|
+
if (c.value === e)
|
|
971
|
+
return r.set(e, true), e.call(t, ...i);
|
|
972
|
+
s = Object.getPrototypeOf(s);
|
|
973
|
+
}
|
|
974
|
+
r.set(e, false);
|
|
975
|
+
}
|
|
976
|
+
return r.get(e) ? e.call(t, ...i) : e(...i);
|
|
977
|
+
}
|
|
978
|
+
};
|
|
979
|
+
m.methodMap = /* @__PURE__ */ new WeakMap();
|
|
980
|
+
let E = m;
|
|
981
|
+
function x$4(n, e = "param") {
|
|
982
|
+
if (!n) throw new Error("onChange: fnKey is undefined, make sure the function exists or provide a string");
|
|
983
|
+
return (t, i, r) => {
|
|
984
|
+
const s = {
|
|
983
985
|
get() {
|
|
984
|
-
return this[`_oc_${
|
|
986
|
+
return this[`_oc_${i}`];
|
|
985
987
|
},
|
|
986
|
-
set(
|
|
987
|
-
var
|
|
988
|
-
const
|
|
989
|
-
if (
|
|
990
|
-
|
|
991
|
-
this[
|
|
992
|
-
|
|
993
|
-
if (typeof fnKey === "string")
|
|
994
|
-
(_a = this[fnKey]) === null || _a === void 0 ? void 0 : _a.call(this, ...params);
|
|
995
|
-
else if (typeof fnKey === "function") {
|
|
996
|
-
let called = false;
|
|
997
|
-
if (fnKey.name) {
|
|
998
|
-
let p = this;
|
|
999
|
-
while (p) {
|
|
1000
|
-
const fn = p[fnKey.name];
|
|
1001
|
-
if (fn === fnKey) {
|
|
1002
|
-
fnKey.call(this, ...params);
|
|
1003
|
-
called = true;
|
|
1004
|
-
break;
|
|
1005
|
-
} else if (fn && fn.name && fn.name.endsWith(`bound ${fnKey.name}`)) {
|
|
1006
|
-
fn(...params);
|
|
1007
|
-
called = true;
|
|
1008
|
-
break;
|
|
1009
|
-
}
|
|
1010
|
-
p = Object.getPrototypeOf(p);
|
|
1011
|
-
}
|
|
1012
|
-
}
|
|
1013
|
-
if (!called) {
|
|
1014
|
-
if (fnKey.name && this[fnKey.name].name.endsWith(`bound ${fnKey.name}`))
|
|
1015
|
-
this[fnKey.name](...params);
|
|
1016
|
-
else
|
|
1017
|
-
fnKey(...params);
|
|
1018
|
-
}
|
|
1019
|
-
}
|
|
988
|
+
set(o) {
|
|
989
|
+
var u;
|
|
990
|
+
const c = this[`_oc_${i}`];
|
|
991
|
+
if (c === o) return;
|
|
992
|
+
this[`_oc_${i}`] = o;
|
|
993
|
+
const a = e === "param" ? [i, o, c, this] : e === "object" ? [{ key: i, value: o, oldValue: c, target: this }] : [];
|
|
994
|
+
typeof n == "string" ? (u = this[n]) == null || u.call(this, ...a) : typeof n == "function" && E.callFunction(n, this, a);
|
|
1020
995
|
}
|
|
1021
|
-
}
|
|
996
|
+
};
|
|
997
|
+
if (r)
|
|
998
|
+
return v(r, "value") && delete r.value, v(r, "writable") && delete r.writable, v(r, "initializer") && delete r.initializer, Object.assign(r, s);
|
|
999
|
+
Object.defineProperty(t, i, s);
|
|
1022
1000
|
};
|
|
1023
1001
|
}
|
|
1024
|
-
function
|
|
1025
|
-
if (!fnKey)
|
|
1026
|
-
|
|
1027
|
-
return onChange(fnKey, paramType);
|
|
1002
|
+
function ze(n, e = "void") {
|
|
1003
|
+
if (!n) throw new Error("onChange: fnKey is undefined, make sure the function exists or provide a string");
|
|
1004
|
+
return x$4(n, e);
|
|
1028
1005
|
}
|
|
1029
1006
|
var __defProp$2 = Object.defineProperty;
|
|
1030
1007
|
var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
|
|
@@ -1033,8 +1010,7 @@
|
|
|
1033
1010
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1034
1011
|
if (decorator = decorators[i])
|
|
1035
1012
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1036
|
-
if (kind && result)
|
|
1037
|
-
__defProp$2(target, key, result);
|
|
1013
|
+
if (kind && result) __defProp$2(target, key, result);
|
|
1038
1014
|
return result;
|
|
1039
1015
|
};
|
|
1040
1016
|
exports2.BasicSVGRenderer = class BasicSVGRenderer extends SVGRenderer$1 {
|
|
@@ -1060,7 +1036,7 @@
|
|
|
1060
1036
|
], exports2.BasicSVGRenderer.prototype, "overdraw", 2);
|
|
1061
1037
|
__decorateClass$2([
|
|
1062
1038
|
uiDropdown(void 0, ["low", "high"]),
|
|
1063
|
-
|
|
1039
|
+
ze(exports2.BasicSVGRenderer.prototype._refresh)
|
|
1064
1040
|
], exports2.BasicSVGRenderer.prototype, "quality", 2);
|
|
1065
1041
|
exports2.BasicSVGRenderer = __decorateClass$2([
|
|
1066
1042
|
uiFolderContainer("Basic SVG Renderer")
|
|
@@ -1072,8 +1048,7 @@
|
|
|
1072
1048
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1073
1049
|
if (decorator = decorators[i])
|
|
1074
1050
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1075
|
-
if (kind && result)
|
|
1076
|
-
__defProp$1(target, key, result);
|
|
1051
|
+
if (kind && result) __defProp$1(target, key, result);
|
|
1077
1052
|
return result;
|
|
1078
1053
|
};
|
|
1079
1054
|
exports2.BasicSVGRendererPlugin = class BasicSVGRendererPlugin extends threepipe.AViewerPluginSync {
|
|
@@ -1090,8 +1065,7 @@
|
|
|
1090
1065
|
this.autoRender = true;
|
|
1091
1066
|
this._viewerListeners = {
|
|
1092
1067
|
postRender: (_) => {
|
|
1093
|
-
if (this.autoRender)
|
|
1094
|
-
this.render();
|
|
1068
|
+
if (this.autoRender) this.render();
|
|
1095
1069
|
}
|
|
1096
1070
|
};
|
|
1097
1071
|
this._onResize = this._onResize.bind(this);
|
|
@@ -1135,10 +1109,8 @@
|
|
|
1135
1109
|
this.renderer.domElement.style.display = "none";
|
|
1136
1110
|
}
|
|
1137
1111
|
render() {
|
|
1138
|
-
if (!this._viewer)
|
|
1139
|
-
|
|
1140
|
-
if (this.isDisabled())
|
|
1141
|
-
return;
|
|
1112
|
+
if (!this._viewer) return;
|
|
1113
|
+
if (this.isDisabled()) return;
|
|
1142
1114
|
this.renderer.render(this._viewer.scene, this._viewer.scene.mainCamera);
|
|
1143
1115
|
}
|
|
1144
1116
|
download() {
|
|
@@ -1151,13 +1123,11 @@
|
|
|
1151
1123
|
return this.renderer.domElement;
|
|
1152
1124
|
}
|
|
1153
1125
|
_refreshParams() {
|
|
1154
|
-
if (this.isDisabled())
|
|
1155
|
-
return;
|
|
1126
|
+
if (this.isDisabled()) return;
|
|
1156
1127
|
this.renderer.setQuality("medium");
|
|
1157
1128
|
}
|
|
1158
1129
|
_onResize() {
|
|
1159
|
-
if (!this._viewer)
|
|
1160
|
-
return;
|
|
1130
|
+
if (!this._viewer) return;
|
|
1161
1131
|
this.renderer.setSize(this._viewer.canvas.clientWidth, this._viewer.canvas.clientHeight);
|
|
1162
1132
|
}
|
|
1163
1133
|
};
|
|
@@ -1217,7 +1187,7 @@
|
|
|
1217
1187
|
}
|
|
1218
1188
|
toJSON() {
|
|
1219
1189
|
return {
|
|
1220
|
-
id: [...this.a.vertices].map((
|
|
1190
|
+
id: [...this.a.vertices].map((v2) => v2.id).join(",") + "-" + [...this.b.vertices].map((v2) => v2.id).join(",")
|
|
1221
1191
|
};
|
|
1222
1192
|
}
|
|
1223
1193
|
clone() {
|
|
@@ -1485,7 +1455,7 @@
|
|
|
1485
1455
|
}
|
|
1486
1456
|
};
|
|
1487
1457
|
var Arrangement2D = (() => {
|
|
1488
|
-
var _scriptDir = typeof document === "undefined" && typeof location === "undefined" ? require("url").pathToFileURL(__filename).href : typeof document === "undefined" ? location.href : _documentCurrentScript && _documentCurrentScript.src || new URL("index.js", document.baseURI).href;
|
|
1458
|
+
var _scriptDir = typeof document === "undefined" && typeof location === "undefined" ? require("url").pathToFileURL(__filename).href : typeof document === "undefined" ? location.href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("index.js", document.baseURI).href;
|
|
1489
1459
|
return function(Arrangement2D2) {
|
|
1490
1460
|
Arrangement2D2 = Arrangement2D2 || {};
|
|
1491
1461
|
var Module = typeof Arrangement2D2 != "undefined" ? Arrangement2D2 : {};
|
|
@@ -1883,8 +1853,7 @@
|
|
|
1883
1853
|
}
|
|
1884
1854
|
var read_, readAsync, readBinary;
|
|
1885
1855
|
function logExceptionOnExit(e) {
|
|
1886
|
-
if (e instanceof ExitStatus)
|
|
1887
|
-
return;
|
|
1856
|
+
if (e instanceof ExitStatus) return;
|
|
1888
1857
|
let toLog = e;
|
|
1889
1858
|
if (e && typeof e == "object" && e.stack) {
|
|
1890
1859
|
toLog = [e, e.stack];
|
|
@@ -1895,8 +1864,7 @@
|
|
|
1895
1864
|
var nodePath;
|
|
1896
1865
|
var requireNodeFS;
|
|
1897
1866
|
if (ENVIRONMENT_IS_NODE) {
|
|
1898
|
-
if (!(typeof process == "object" && typeof require == "function"))
|
|
1899
|
-
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?)");
|
|
1867
|
+
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?)");
|
|
1900
1868
|
if (ENVIRONMENT_IS_WORKER) {
|
|
1901
1869
|
scriptDirectory = require("path").dirname(scriptDirectory) + "/";
|
|
1902
1870
|
} else {
|
|
@@ -1933,10 +1901,8 @@
|
|
|
1933
1901
|
requireNodeFS();
|
|
1934
1902
|
filename = nodePath["normalize"](filename);
|
|
1935
1903
|
fs.readFile(filename, function(err2, data2) {
|
|
1936
|
-
if (err2)
|
|
1937
|
-
|
|
1938
|
-
else
|
|
1939
|
-
onload(data2.buffer);
|
|
1904
|
+
if (err2) onerror(err2);
|
|
1905
|
+
else onload(data2.buffer);
|
|
1940
1906
|
});
|
|
1941
1907
|
};
|
|
1942
1908
|
if (process["argv"].length > 1) {
|
|
@@ -1952,19 +1918,16 @@
|
|
|
1952
1918
|
throw reason;
|
|
1953
1919
|
});
|
|
1954
1920
|
quit_ = (status, toThrow) => {
|
|
1955
|
-
|
|
1921
|
+
{
|
|
1956
1922
|
process["exitCode"] = status;
|
|
1957
1923
|
throw toThrow;
|
|
1958
1924
|
}
|
|
1959
|
-
logExceptionOnExit(toThrow);
|
|
1960
|
-
process["exit"](status);
|
|
1961
1925
|
};
|
|
1962
1926
|
Module["inspect"] = function() {
|
|
1963
1927
|
return "[Emscripten Module object]";
|
|
1964
1928
|
};
|
|
1965
1929
|
} else if (ENVIRONMENT_IS_SHELL) {
|
|
1966
|
-
if (typeof process == "object" && typeof require === "function" || typeof window == "object" || typeof importScripts == "function")
|
|
1967
|
-
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?)");
|
|
1930
|
+
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?)");
|
|
1968
1931
|
if (typeof read != "undefined") {
|
|
1969
1932
|
read_ = function shell_read(f) {
|
|
1970
1933
|
const data2 = tryParseAsDataURI(f);
|
|
@@ -2000,8 +1963,7 @@
|
|
|
2000
1963
|
};
|
|
2001
1964
|
}
|
|
2002
1965
|
if (typeof print != "undefined") {
|
|
2003
|
-
if (typeof console == "undefined")
|
|
2004
|
-
console = {};
|
|
1966
|
+
if (typeof console == "undefined") console = {};
|
|
2005
1967
|
console.log = print;
|
|
2006
1968
|
console.warn = console.error = typeof printErr != "undefined" ? printErr : print;
|
|
2007
1969
|
}
|
|
@@ -2019,8 +1981,7 @@
|
|
|
2019
1981
|
} else {
|
|
2020
1982
|
scriptDirectory = "";
|
|
2021
1983
|
}
|
|
2022
|
-
if (!(typeof window == "object" || typeof importScripts == "function"))
|
|
2023
|
-
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?)");
|
|
1984
|
+
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?)");
|
|
2024
1985
|
{
|
|
2025
1986
|
read_ = (url) => {
|
|
2026
1987
|
try {
|
|
@@ -2081,14 +2042,11 @@
|
|
|
2081
2042
|
Object.assign(Module, moduleOverrides);
|
|
2082
2043
|
moduleOverrides = null;
|
|
2083
2044
|
checkIncomingModuleAPI();
|
|
2084
|
-
if (Module["arguments"])
|
|
2085
|
-
Module["arguments"];
|
|
2045
|
+
if (Module["arguments"]) Module["arguments"];
|
|
2086
2046
|
legacyModuleProp("arguments", "arguments_");
|
|
2087
|
-
if (Module["thisProgram"])
|
|
2088
|
-
thisProgram = Module["thisProgram"];
|
|
2047
|
+
if (Module["thisProgram"]) thisProgram = Module["thisProgram"];
|
|
2089
2048
|
legacyModuleProp("thisProgram", "thisProgram");
|
|
2090
|
-
if (Module["quit"])
|
|
2091
|
-
quit_ = Module["quit"];
|
|
2049
|
+
if (Module["quit"]) quit_ = Module["quit"];
|
|
2092
2050
|
legacyModuleProp("quit", "quit_");
|
|
2093
2051
|
assert(typeof Module["memoryInitializerPrefixURL"] == "undefined", "Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead");
|
|
2094
2052
|
assert(typeof Module["pthreadMainPrefixURL"] == "undefined", "Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead");
|
|
@@ -2105,8 +2063,7 @@
|
|
|
2105
2063
|
legacyModuleProp("setWindowTitle", "setWindowTitle");
|
|
2106
2064
|
assert(!ENVIRONMENT_IS_SHELL, "shell environment detected but not enabled at build time. Add 'shell' to `-sENVIRONMENT` to enable.");
|
|
2107
2065
|
function warnOnce(text) {
|
|
2108
|
-
if (!warnOnce.shown)
|
|
2109
|
-
warnOnce.shown = {};
|
|
2066
|
+
if (!warnOnce.shown) warnOnce.shown = {};
|
|
2110
2067
|
if (!warnOnce.shown[text]) {
|
|
2111
2068
|
warnOnce.shown[text] = 1;
|
|
2112
2069
|
err(text);
|
|
@@ -2144,8 +2101,7 @@
|
|
|
2144
2101
|
}
|
|
2145
2102
|
}
|
|
2146
2103
|
var wasmBinary;
|
|
2147
|
-
if (Module["wasmBinary"])
|
|
2148
|
-
wasmBinary = Module["wasmBinary"];
|
|
2104
|
+
if (Module["wasmBinary"]) wasmBinary = Module["wasmBinary"];
|
|
2149
2105
|
legacyModuleProp("wasmBinary", "wasmBinary");
|
|
2150
2106
|
var noExitRuntime = Module["noExitRuntime"] || true;
|
|
2151
2107
|
legacyModuleProp("noExitRuntime", "noExitRuntime");
|
|
@@ -2163,8 +2119,7 @@
|
|
|
2163
2119
|
function UTF8ArrayToString(heapOrArray, idx, maxBytesToRead) {
|
|
2164
2120
|
var endIdx = idx + maxBytesToRead;
|
|
2165
2121
|
var endPtr = idx;
|
|
2166
|
-
while (heapOrArray[endPtr] && !(endPtr >= endIdx))
|
|
2167
|
-
++endPtr;
|
|
2122
|
+
while (heapOrArray[endPtr] && !(endPtr >= endIdx)) ++endPtr;
|
|
2168
2123
|
if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) {
|
|
2169
2124
|
return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr));
|
|
2170
2125
|
} else {
|
|
@@ -2184,8 +2139,7 @@
|
|
|
2184
2139
|
if ((u0 & 240) == 224) {
|
|
2185
2140
|
u0 = (u0 & 15) << 12 | u1 << 6 | u2;
|
|
2186
2141
|
} else {
|
|
2187
|
-
if ((u0 & 248) != 240)
|
|
2188
|
-
warnOnce("Invalid UTF-8 leading byte 0x" + u0.toString(16) + " encountered when deserializing a UTF-8 string in wasm memory to a JS string!");
|
|
2142
|
+
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!");
|
|
2189
2143
|
u0 = (u0 & 7) << 18 | u1 << 12 | u2 << 6 | heapOrArray[idx++] & 63;
|
|
2190
2144
|
}
|
|
2191
2145
|
if (u0 < 65536) {
|
|
@@ -2202,8 +2156,7 @@
|
|
|
2202
2156
|
return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : "";
|
|
2203
2157
|
}
|
|
2204
2158
|
function stringToUTF8Array(str, heap, outIdx, maxBytesToWrite) {
|
|
2205
|
-
if (!(maxBytesToWrite > 0))
|
|
2206
|
-
return 0;
|
|
2159
|
+
if (!(maxBytesToWrite > 0)) return 0;
|
|
2207
2160
|
var startIdx = outIdx;
|
|
2208
2161
|
var endIdx = outIdx + maxBytesToWrite - 1;
|
|
2209
2162
|
for (var i = 0; i < str.length; ++i) {
|
|
@@ -2213,25 +2166,20 @@
|
|
|
2213
2166
|
u = 65536 + ((u & 1023) << 10) | u1 & 1023;
|
|
2214
2167
|
}
|
|
2215
2168
|
if (u <= 127) {
|
|
2216
|
-
if (outIdx >= endIdx)
|
|
2217
|
-
break;
|
|
2169
|
+
if (outIdx >= endIdx) break;
|
|
2218
2170
|
heap[outIdx++] = u;
|
|
2219
2171
|
} else if (u <= 2047) {
|
|
2220
|
-
if (outIdx + 1 >= endIdx)
|
|
2221
|
-
break;
|
|
2172
|
+
if (outIdx + 1 >= endIdx) break;
|
|
2222
2173
|
heap[outIdx++] = 192 | u >> 6;
|
|
2223
2174
|
heap[outIdx++] = 128 | u & 63;
|
|
2224
2175
|
} else if (u <= 65535) {
|
|
2225
|
-
if (outIdx + 2 >= endIdx)
|
|
2226
|
-
break;
|
|
2176
|
+
if (outIdx + 2 >= endIdx) break;
|
|
2227
2177
|
heap[outIdx++] = 224 | u >> 12;
|
|
2228
2178
|
heap[outIdx++] = 128 | u >> 6 & 63;
|
|
2229
2179
|
heap[outIdx++] = 128 | u & 63;
|
|
2230
2180
|
} else {
|
|
2231
|
-
if (outIdx + 3 >= endIdx)
|
|
2232
|
-
|
|
2233
|
-
if (u > 1114111)
|
|
2234
|
-
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).");
|
|
2181
|
+
if (outIdx + 3 >= endIdx) break;
|
|
2182
|
+
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).");
|
|
2235
2183
|
heap[outIdx++] = 240 | u >> 18;
|
|
2236
2184
|
heap[outIdx++] = 128 | u >> 12 & 63;
|
|
2237
2185
|
heap[outIdx++] = 128 | u >> 6 & 63;
|
|
@@ -2245,16 +2193,11 @@
|
|
|
2245
2193
|
var len = 0;
|
|
2246
2194
|
for (var i = 0; i < str.length; ++i) {
|
|
2247
2195
|
var u = str.charCodeAt(i);
|
|
2248
|
-
if (u >= 55296 && u <= 57343)
|
|
2249
|
-
|
|
2250
|
-
if (u <=
|
|
2251
|
-
|
|
2252
|
-
else
|
|
2253
|
-
len += 2;
|
|
2254
|
-
else if (u <= 65535)
|
|
2255
|
-
len += 3;
|
|
2256
|
-
else
|
|
2257
|
-
len += 4;
|
|
2196
|
+
if (u >= 55296 && u <= 57343) u = 65536 + ((u & 1023) << 10) | str.charCodeAt(++i) & 1023;
|
|
2197
|
+
if (u <= 127) ++len;
|
|
2198
|
+
else if (u <= 2047) len += 2;
|
|
2199
|
+
else if (u <= 65535) len += 3;
|
|
2200
|
+
else len += 4;
|
|
2258
2201
|
}
|
|
2259
2202
|
return len;
|
|
2260
2203
|
}
|
|
@@ -2268,8 +2211,7 @@
|
|
|
2268
2211
|
assert(str.charCodeAt(i) === (str.charCodeAt(i) & 255));
|
|
2269
2212
|
HEAP8[buffer2++ >> 0] = str.charCodeAt(i);
|
|
2270
2213
|
}
|
|
2271
|
-
|
|
2272
|
-
HEAP8[buffer2 >> 0] = 0;
|
|
2214
|
+
HEAP8[buffer2 >> 0] = 0;
|
|
2273
2215
|
}
|
|
2274
2216
|
var buffer, HEAP8, HEAPU8, HEAP32, HEAPU32;
|
|
2275
2217
|
function updateGlobalBufferAndViews(buf) {
|
|
@@ -2284,8 +2226,7 @@
|
|
|
2284
2226
|
Module["HEAPF64"] = new Float64Array(buf);
|
|
2285
2227
|
}
|
|
2286
2228
|
var TOTAL_STACK = 5242880;
|
|
2287
|
-
if (Module["TOTAL_STACK"])
|
|
2288
|
-
assert(TOTAL_STACK === Module["TOTAL_STACK"], "the stack size can no longer be determined at runtime");
|
|
2229
|
+
if (Module["TOTAL_STACK"]) assert(TOTAL_STACK === Module["TOTAL_STACK"], "the stack size can no longer be determined at runtime");
|
|
2289
2230
|
var INITIAL_MEMORY = Module["INITIAL_MEMORY"] || 16777216;
|
|
2290
2231
|
legacyModuleProp("INITIAL_MEMORY", "INITIAL_MEMORY");
|
|
2291
2232
|
assert(INITIAL_MEMORY >= TOTAL_STACK, "INITIAL_MEMORY should be larger than TOTAL_STACK, was " + INITIAL_MEMORY + "! (TOTAL_STACK=" + TOTAL_STACK + ")");
|
|
@@ -2301,23 +2242,20 @@
|
|
|
2301
2242
|
HEAPU32[0] = 1668509029;
|
|
2302
2243
|
}
|
|
2303
2244
|
function checkStackCookie() {
|
|
2304
|
-
if (ABORT)
|
|
2305
|
-
return;
|
|
2245
|
+
if (ABORT) return;
|
|
2306
2246
|
var max = _emscripten_stack_get_end();
|
|
2307
2247
|
var cookie1 = HEAPU32[max >> 2];
|
|
2308
2248
|
var cookie2 = HEAPU32[max + 4 >> 2];
|
|
2309
2249
|
if (cookie1 != 34821223 || cookie2 != 2310721022) {
|
|
2310
2250
|
abort("Stack overflow! Stack cookie has been overwritten, expected hex dwords 0x89BACDFE and 0x2135467, but received 0x" + cookie2.toString(16) + " 0x" + cookie1.toString(16));
|
|
2311
2251
|
}
|
|
2312
|
-
if (HEAPU32[0] !== 1668509029)
|
|
2313
|
-
abort("Runtime error: The application has corrupted its heap memory area (address zero)!");
|
|
2252
|
+
if (HEAPU32[0] !== 1668509029) abort("Runtime error: The application has corrupted its heap memory area (address zero)!");
|
|
2314
2253
|
}
|
|
2315
2254
|
(function() {
|
|
2316
2255
|
var h16 = new Int16Array(1);
|
|
2317
2256
|
var h8 = new Int8Array(h16.buffer);
|
|
2318
2257
|
h16[0] = 25459;
|
|
2319
|
-
if (h8[0] !== 115 || h8[1] !== 99)
|
|
2320
|
-
throw "Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)";
|
|
2258
|
+
if (h8[0] !== 115 || h8[1] !== 99) throw "Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)";
|
|
2321
2259
|
})();
|
|
2322
2260
|
var __ATPRERUN__ = [];
|
|
2323
2261
|
var __ATINIT__ = [];
|
|
@@ -2328,8 +2266,7 @@
|
|
|
2328
2266
|
}
|
|
2329
2267
|
function preRun() {
|
|
2330
2268
|
if (Module["preRun"]) {
|
|
2331
|
-
if (typeof Module["preRun"] == "function")
|
|
2332
|
-
Module["preRun"] = [Module["preRun"]];
|
|
2269
|
+
if (typeof Module["preRun"] == "function") Module["preRun"] = [Module["preRun"]];
|
|
2333
2270
|
while (Module["preRun"].length) {
|
|
2334
2271
|
addOnPreRun(Module["preRun"].shift());
|
|
2335
2272
|
}
|
|
@@ -2345,8 +2282,7 @@
|
|
|
2345
2282
|
function postRun() {
|
|
2346
2283
|
checkStackCookie();
|
|
2347
2284
|
if (Module["postRun"]) {
|
|
2348
|
-
if (typeof Module["postRun"] == "function")
|
|
2349
|
-
Module["postRun"] = [Module["postRun"]];
|
|
2285
|
+
if (typeof Module["postRun"] == "function") Module["postRun"] = [Module["postRun"]];
|
|
2350
2286
|
while (Module["postRun"].length) {
|
|
2351
2287
|
addOnPostRun(Module["postRun"].shift());
|
|
2352
2288
|
}
|
|
@@ -2375,7 +2311,7 @@
|
|
|
2375
2311
|
if (Module["monitorRunDependencies"]) {
|
|
2376
2312
|
Module["monitorRunDependencies"](runDependencies);
|
|
2377
2313
|
}
|
|
2378
|
-
|
|
2314
|
+
{
|
|
2379
2315
|
assert(!runDependencyTracking[id]);
|
|
2380
2316
|
runDependencyTracking[id] = 1;
|
|
2381
2317
|
if (runDependencyWatcher === null && typeof setInterval != "undefined") {
|
|
@@ -2398,8 +2334,6 @@
|
|
|
2398
2334
|
}
|
|
2399
2335
|
}, 1e4);
|
|
2400
2336
|
}
|
|
2401
|
-
} else {
|
|
2402
|
-
err("warning: run dependency added without ID");
|
|
2403
2337
|
}
|
|
2404
2338
|
}
|
|
2405
2339
|
function removeRunDependency(id) {
|
|
@@ -2407,11 +2341,9 @@
|
|
|
2407
2341
|
if (Module["monitorRunDependencies"]) {
|
|
2408
2342
|
Module["monitorRunDependencies"](runDependencies);
|
|
2409
2343
|
}
|
|
2410
|
-
|
|
2344
|
+
{
|
|
2411
2345
|
assert(runDependencyTracking[id]);
|
|
2412
2346
|
delete runDependencyTracking[id];
|
|
2413
|
-
} else {
|
|
2414
|
-
err("warning: run dependency removed without ID");
|
|
2415
2347
|
}
|
|
2416
2348
|
if (runDependencies == 0) {
|
|
2417
2349
|
if (runDependencyWatcher !== null) {
|
|
@@ -2474,7 +2406,7 @@
|
|
|
2474
2406
|
return function() {
|
|
2475
2407
|
var displayName = name;
|
|
2476
2408
|
var asm = fixedasm;
|
|
2477
|
-
|
|
2409
|
+
{
|
|
2478
2410
|
asm = Module["asm"];
|
|
2479
2411
|
}
|
|
2480
2412
|
assert(runtimeInitialized, "native function `" + displayName + "` called before runtime initialization");
|
|
@@ -2617,8 +2549,7 @@
|
|
|
2617
2549
|
function getWasmTableEntry(funcPtr) {
|
|
2618
2550
|
var func = wasmTableMirror[funcPtr];
|
|
2619
2551
|
if (!func) {
|
|
2620
|
-
if (funcPtr >= wasmTableMirror.length)
|
|
2621
|
-
wasmTableMirror.length = funcPtr + 1;
|
|
2552
|
+
if (funcPtr >= wasmTableMirror.length) wasmTableMirror.length = funcPtr + 1;
|
|
2622
2553
|
wasmTableMirror[funcPtr] = func = wasmTable.get(funcPtr);
|
|
2623
2554
|
}
|
|
2624
2555
|
assert(wasmTable.get(funcPtr) == func, "JavaScript-side Wasm function table mirror is out of date!");
|
|
@@ -2689,8 +2620,7 @@
|
|
|
2689
2620
|
return HEAPU32[this.excPtr >> 2];
|
|
2690
2621
|
}
|
|
2691
2622
|
var adjusted = this.get_adjusted_ptr();
|
|
2692
|
-
if (adjusted !== 0)
|
|
2693
|
-
return adjusted;
|
|
2623
|
+
if (adjusted !== 0) return adjusted;
|
|
2694
2624
|
return this.excPtr;
|
|
2695
2625
|
};
|
|
2696
2626
|
}
|
|
@@ -2748,10 +2678,8 @@
|
|
|
2748
2678
|
var lang = (typeof navigator == "object" && navigator.languages && navigator.languages[0] || "C").replace("-", "_") + ".UTF-8";
|
|
2749
2679
|
var env = { "USER": "web_user", "LOGNAME": "web_user", "PATH": "/", "PWD": "/", "HOME": "/home/web_user", "LANG": lang, "_": getExecutableName() };
|
|
2750
2680
|
for (var x2 in ENV) {
|
|
2751
|
-
if (ENV[x2] === void 0)
|
|
2752
|
-
|
|
2753
|
-
else
|
|
2754
|
-
env[x2] = ENV[x2];
|
|
2681
|
+
if (ENV[x2] === void 0) delete env[x2];
|
|
2682
|
+
else env[x2] = ENV[x2];
|
|
2755
2683
|
}
|
|
2756
2684
|
var strings = [];
|
|
2757
2685
|
for (var x2 in env) {
|
|
@@ -2806,10 +2734,8 @@
|
|
|
2806
2734
|
}
|
|
2807
2735
|
function flush_NO_FILESYSTEM() {
|
|
2808
2736
|
_fflush(0);
|
|
2809
|
-
if (printCharBuffers[1].length)
|
|
2810
|
-
|
|
2811
|
-
if (printCharBuffers[2].length)
|
|
2812
|
-
printChar(2, 10);
|
|
2737
|
+
if (printCharBuffers[1].length) printChar(1, 10);
|
|
2738
|
+
if (printCharBuffers[2].length) printChar(2, 10);
|
|
2813
2739
|
}
|
|
2814
2740
|
function _fd_write(fd, iov, iovcnt, pnum) {
|
|
2815
2741
|
var num = 0;
|
|
@@ -2949,10 +2875,8 @@
|
|
|
2949
2875
|
return leadingNulls(date2.tm_hour, 2);
|
|
2950
2876
|
}, "%I": function(date2) {
|
|
2951
2877
|
var twelveHour = date2.tm_hour;
|
|
2952
|
-
if (twelveHour == 0)
|
|
2953
|
-
|
|
2954
|
-
else if (twelveHour > 12)
|
|
2955
|
-
twelveHour -= 12;
|
|
2878
|
+
if (twelveHour == 0) twelveHour = 12;
|
|
2879
|
+
else if (twelveHour > 12) twelveHour -= 12;
|
|
2956
2880
|
return leadingNulls(twelveHour, 2);
|
|
2957
2881
|
}, "%j": function(date2) {
|
|
2958
2882
|
return leadingNulls(date2.tm_mday + __arraySum(__isLeapYear(date2.tm_year + 1900) ? __MONTH_DAYS_LEAP : __MONTH_DAYS_REGULAR, date2.tm_mon - 1), 3);
|
|
@@ -2990,8 +2914,7 @@
|
|
|
2990
2914
|
}
|
|
2991
2915
|
} else if (val == 53) {
|
|
2992
2916
|
var jan1 = (date2.tm_wday + 371 - date2.tm_yday) % 7;
|
|
2993
|
-
if (jan1 != 4 && (jan1 != 3 || !__isLeapYear(date2.tm_year)))
|
|
2994
|
-
val = 1;
|
|
2917
|
+
if (jan1 != 4 && (jan1 != 3 || !__isLeapYear(date2.tm_year))) val = 1;
|
|
2995
2918
|
}
|
|
2996
2919
|
return leadingNulls(val, 2);
|
|
2997
2920
|
}, "%w": function(date2) {
|
|
@@ -3021,7 +2944,7 @@
|
|
|
3021
2944
|
}
|
|
3022
2945
|
}
|
|
3023
2946
|
pattern = pattern.replace(/\0\0/g, "%");
|
|
3024
|
-
var bytes = intArrayFromString(pattern
|
|
2947
|
+
var bytes = intArrayFromString(pattern);
|
|
3025
2948
|
if (bytes.length > maxsize) {
|
|
3026
2949
|
return 0;
|
|
3027
2950
|
}
|
|
@@ -3032,11 +2955,9 @@
|
|
|
3032
2955
|
return _strftime(s, maxsize, format, tm);
|
|
3033
2956
|
}
|
|
3034
2957
|
function intArrayFromString(stringy, dontAddNull, length2) {
|
|
3035
|
-
var len =
|
|
2958
|
+
var len = lengthBytesUTF8(stringy) + 1;
|
|
3036
2959
|
var u8array = new Array(len);
|
|
3037
|
-
|
|
3038
|
-
if (dontAddNull)
|
|
3039
|
-
u8array.length = numBytesWritten;
|
|
2960
|
+
stringToUTF8Array(stringy, u8array, 0, u8array.length);
|
|
3040
2961
|
return u8array;
|
|
3041
2962
|
}
|
|
3042
2963
|
function intArrayToString(array2) {
|
|
@@ -3406,10 +3327,8 @@
|
|
|
3406
3327
|
this.status = status;
|
|
3407
3328
|
}
|
|
3408
3329
|
dependenciesFulfilled = function runCaller() {
|
|
3409
|
-
if (!calledRun)
|
|
3410
|
-
|
|
3411
|
-
if (!calledRun)
|
|
3412
|
-
dependenciesFulfilled = runCaller;
|
|
3330
|
+
if (!calledRun) run();
|
|
3331
|
+
if (!calledRun) dependenciesFulfilled = runCaller;
|
|
3413
3332
|
};
|
|
3414
3333
|
function stackCheckInit() {
|
|
3415
3334
|
_emscripten_stack_init();
|
|
@@ -3425,16 +3344,13 @@
|
|
|
3425
3344
|
return;
|
|
3426
3345
|
}
|
|
3427
3346
|
function doRun() {
|
|
3428
|
-
if (calledRun)
|
|
3429
|
-
return;
|
|
3347
|
+
if (calledRun) return;
|
|
3430
3348
|
calledRun = true;
|
|
3431
3349
|
Module["calledRun"] = true;
|
|
3432
|
-
if (ABORT)
|
|
3433
|
-
return;
|
|
3350
|
+
if (ABORT) return;
|
|
3434
3351
|
initRuntime();
|
|
3435
3352
|
readyPromiseResolve(Module);
|
|
3436
|
-
if (Module["onRuntimeInitialized"])
|
|
3437
|
-
Module["onRuntimeInitialized"]();
|
|
3353
|
+
if (Module["onRuntimeInitialized"]) Module["onRuntimeInitialized"]();
|
|
3438
3354
|
assert(!Module["_main"], 'compiled without a main, but one is present. if you added it from JS, use Module["onRuntimeInitialized"]');
|
|
3439
3355
|
postRun();
|
|
3440
3356
|
}
|
|
@@ -3472,7 +3388,7 @@
|
|
|
3472
3388
|
}
|
|
3473
3389
|
function exit(status, implicit) {
|
|
3474
3390
|
checkUnflushedContent();
|
|
3475
|
-
|
|
3391
|
+
{
|
|
3476
3392
|
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)";
|
|
3477
3393
|
readyPromiseReject(msg);
|
|
3478
3394
|
err(msg);
|
|
@@ -3481,15 +3397,13 @@
|
|
|
3481
3397
|
}
|
|
3482
3398
|
function procExit(code) {
|
|
3483
3399
|
if (!keepRuntimeAlive()) {
|
|
3484
|
-
if (Module["onExit"])
|
|
3485
|
-
Module["onExit"](code);
|
|
3400
|
+
if (Module["onExit"]) Module["onExit"](code);
|
|
3486
3401
|
ABORT = true;
|
|
3487
3402
|
}
|
|
3488
3403
|
quit_(code, new ExitStatus(code));
|
|
3489
3404
|
}
|
|
3490
3405
|
if (Module["preInit"]) {
|
|
3491
|
-
if (typeof Module["preInit"] == "function")
|
|
3492
|
-
Module["preInit"] = [Module["preInit"]];
|
|
3406
|
+
if (typeof Module["preInit"] == "function") Module["preInit"] = [Module["preInit"]];
|
|
3493
3407
|
while (Module["preInit"].length > 0) {
|
|
3494
3408
|
Module["preInit"].pop()();
|
|
3495
3409
|
}
|
|
@@ -3509,8 +3423,7 @@
|
|
|
3509
3423
|
function wrapPointer(ptr, __class__) {
|
|
3510
3424
|
var cache = getCache(__class__);
|
|
3511
3425
|
var ret = cache[ptr];
|
|
3512
|
-
if (ret)
|
|
3513
|
-
return ret;
|
|
3426
|
+
if (ret) return ret;
|
|
3514
3427
|
ret = Object.create((__class__ || WrapperObject).prototype);
|
|
3515
3428
|
ret.ptr = ptr;
|
|
3516
3429
|
return cache[ptr] = ret;
|
|
@@ -3522,8 +3435,7 @@
|
|
|
3522
3435
|
Module["castObject"] = castObject;
|
|
3523
3436
|
Module["NULL"] = wrapPointer(0);
|
|
3524
3437
|
function destroy(obj) {
|
|
3525
|
-
if (!obj["__destroy__"])
|
|
3526
|
-
throw "Error: Cannot destroy object. (Did you create it yourself?)";
|
|
3438
|
+
if (!obj["__destroy__"]) throw "Error: Cannot destroy object. (Did you create it yourself?)";
|
|
3527
3439
|
obj["__destroy__"]();
|
|
3528
3440
|
delete getCache(obj.__class__)[obj.ptr];
|
|
3529
3441
|
}
|
|
@@ -3563,8 +3475,7 @@
|
|
|
3563
3475
|
Module["ArrangementBuilder"] = ArrangementBuilder;
|
|
3564
3476
|
ArrangementBuilder.prototype["getPolygons"] = ArrangementBuilder.prototype.getPolygons = function(points) {
|
|
3565
3477
|
var self2 = this.ptr;
|
|
3566
|
-
if (points && typeof points === "object")
|
|
3567
|
-
points = points.ptr;
|
|
3478
|
+
if (points && typeof points === "object") points = points.ptr;
|
|
3568
3479
|
return wrapPointer(_emscripten_bind_ArrangementBuilder_getPolygons_1(self2, points), PolygonList);
|
|
3569
3480
|
};
|
|
3570
3481
|
ArrangementBuilder.prototype["__destroy__"] = ArrangementBuilder.prototype.__destroy__ = function() {
|
|
@@ -3572,10 +3483,8 @@
|
|
|
3572
3483
|
_emscripten_bind_ArrangementBuilder___destroy___0(self2);
|
|
3573
3484
|
};
|
|
3574
3485
|
function Point2(x2, y2) {
|
|
3575
|
-
if (x2 && typeof x2 === "object")
|
|
3576
|
-
|
|
3577
|
-
if (y2 && typeof y2 === "object")
|
|
3578
|
-
y2 = y2.ptr;
|
|
3486
|
+
if (x2 && typeof x2 === "object") x2 = x2.ptr;
|
|
3487
|
+
if (y2 && typeof y2 === "object") y2 = y2.ptr;
|
|
3579
3488
|
if (x2 === void 0) {
|
|
3580
3489
|
this.ptr = _emscripten_bind_Point_Point_0();
|
|
3581
3490
|
getCache(Point2)[this.ptr] = this;
|
|
@@ -3600,8 +3509,7 @@
|
|
|
3600
3509
|
};
|
|
3601
3510
|
Point2.prototype["set_x"] = Point2.prototype.set_x = function(arg0) {
|
|
3602
3511
|
var self2 = this.ptr;
|
|
3603
|
-
if (arg0 && typeof arg0 === "object")
|
|
3604
|
-
arg0 = arg0.ptr;
|
|
3512
|
+
if (arg0 && typeof arg0 === "object") arg0 = arg0.ptr;
|
|
3605
3513
|
_emscripten_bind_Point_set_x_1(self2, arg0);
|
|
3606
3514
|
};
|
|
3607
3515
|
Object.defineProperty(Point2.prototype, "x", { get: Point2.prototype.get_x, set: Point2.prototype.set_x });
|
|
@@ -3611,8 +3519,7 @@
|
|
|
3611
3519
|
};
|
|
3612
3520
|
Point2.prototype["set_y"] = Point2.prototype.set_y = function(arg0) {
|
|
3613
3521
|
var self2 = this.ptr;
|
|
3614
|
-
if (arg0 && typeof arg0 === "object")
|
|
3615
|
-
arg0 = arg0.ptr;
|
|
3522
|
+
if (arg0 && typeof arg0 === "object") arg0 = arg0.ptr;
|
|
3616
3523
|
_emscripten_bind_Point_set_y_1(self2, arg0);
|
|
3617
3524
|
};
|
|
3618
3525
|
Object.defineProperty(Point2.prototype, "y", { get: Point2.prototype.get_y, set: Point2.prototype.set_y });
|
|
@@ -3621,10 +3528,8 @@
|
|
|
3621
3528
|
_emscripten_bind_Point___destroy___0(self2);
|
|
3622
3529
|
};
|
|
3623
3530
|
function Polygon2(contour, holes) {
|
|
3624
|
-
if (contour && typeof contour === "object")
|
|
3625
|
-
|
|
3626
|
-
if (holes && typeof holes === "object")
|
|
3627
|
-
holes = holes.ptr;
|
|
3531
|
+
if (contour && typeof contour === "object") contour = contour.ptr;
|
|
3532
|
+
if (holes && typeof holes === "object") holes = holes.ptr;
|
|
3628
3533
|
this.ptr = _emscripten_bind_Polygon_Polygon_2(contour, holes);
|
|
3629
3534
|
getCache(Polygon2)[this.ptr] = this;
|
|
3630
3535
|
}
|
|
@@ -3635,8 +3540,7 @@
|
|
|
3635
3540
|
Module["Polygon"] = Polygon2;
|
|
3636
3541
|
Polygon2.prototype["getInsidePoint"] = Polygon2.prototype.getInsidePoint = function(point2) {
|
|
3637
3542
|
var self2 = this.ptr;
|
|
3638
|
-
if (point2 && typeof point2 === "object")
|
|
3639
|
-
point2 = point2.ptr;
|
|
3543
|
+
if (point2 && typeof point2 === "object") point2 = point2.ptr;
|
|
3640
3544
|
return !!_emscripten_bind_Polygon_getInsidePoint_1(self2, point2);
|
|
3641
3545
|
};
|
|
3642
3546
|
Polygon2.prototype["getPolyTristripArea"] = Polygon2.prototype.getPolyTristripArea = function() {
|
|
@@ -3649,8 +3553,7 @@
|
|
|
3649
3553
|
};
|
|
3650
3554
|
Polygon2.prototype["set_contour"] = Polygon2.prototype.set_contour = function(arg0) {
|
|
3651
3555
|
var self2 = this.ptr;
|
|
3652
|
-
if (arg0 && typeof arg0 === "object")
|
|
3653
|
-
arg0 = arg0.ptr;
|
|
3556
|
+
if (arg0 && typeof arg0 === "object") arg0 = arg0.ptr;
|
|
3654
3557
|
_emscripten_bind_Polygon_set_contour_1(self2, arg0);
|
|
3655
3558
|
};
|
|
3656
3559
|
Object.defineProperty(Polygon2.prototype, "contour", { get: Polygon2.prototype.get_contour, set: Polygon2.prototype.set_contour });
|
|
@@ -3660,8 +3563,7 @@
|
|
|
3660
3563
|
};
|
|
3661
3564
|
Polygon2.prototype["set_holes"] = Polygon2.prototype.set_holes = function(arg0) {
|
|
3662
3565
|
var self2 = this.ptr;
|
|
3663
|
-
if (arg0 && typeof arg0 === "object")
|
|
3664
|
-
arg0 = arg0.ptr;
|
|
3566
|
+
if (arg0 && typeof arg0 === "object") arg0 = arg0.ptr;
|
|
3665
3567
|
_emscripten_bind_Polygon_set_holes_1(self2, arg0);
|
|
3666
3568
|
};
|
|
3667
3569
|
Object.defineProperty(Polygon2.prototype, "holes", { get: Polygon2.prototype.get_holes, set: Polygon2.prototype.set_holes });
|
|
@@ -3680,8 +3582,7 @@
|
|
|
3680
3582
|
Module["PointList"] = PointList;
|
|
3681
3583
|
PointList.prototype["push_back"] = PointList.prototype.push_back = function(s) {
|
|
3682
3584
|
var self2 = this.ptr;
|
|
3683
|
-
if (s && typeof s === "object")
|
|
3684
|
-
s = s.ptr;
|
|
3585
|
+
if (s && typeof s === "object") s = s.ptr;
|
|
3685
3586
|
_emscripten_bind_PointList_push_back_1(self2, s);
|
|
3686
3587
|
};
|
|
3687
3588
|
PointList.prototype["size"] = PointList.prototype.size = function() {
|
|
@@ -3690,8 +3591,7 @@
|
|
|
3690
3591
|
};
|
|
3691
3592
|
PointList.prototype["at"] = PointList.prototype.at = function(i) {
|
|
3692
3593
|
var self2 = this.ptr;
|
|
3693
|
-
if (i && typeof i === "object")
|
|
3694
|
-
i = i.ptr;
|
|
3594
|
+
if (i && typeof i === "object") i = i.ptr;
|
|
3695
3595
|
return wrapPointer(_emscripten_bind_PointList_at_1(self2, i), Point2);
|
|
3696
3596
|
};
|
|
3697
3597
|
PointList.prototype["clear"] = PointList.prototype.clear = function() {
|
|
@@ -3713,8 +3613,7 @@
|
|
|
3713
3613
|
Module["PolygonList"] = PolygonList;
|
|
3714
3614
|
PolygonList.prototype["push_back"] = PolygonList.prototype.push_back = function(s) {
|
|
3715
3615
|
var self2 = this.ptr;
|
|
3716
|
-
if (s && typeof s === "object")
|
|
3717
|
-
s = s.ptr;
|
|
3616
|
+
if (s && typeof s === "object") s = s.ptr;
|
|
3718
3617
|
_emscripten_bind_PolygonList_push_back_1(self2, s);
|
|
3719
3618
|
};
|
|
3720
3619
|
PolygonList.prototype["size"] = PolygonList.prototype.size = function() {
|
|
@@ -3723,8 +3622,7 @@
|
|
|
3723
3622
|
};
|
|
3724
3623
|
PolygonList.prototype["at"] = PolygonList.prototype.at = function(i) {
|
|
3725
3624
|
var self2 = this.ptr;
|
|
3726
|
-
if (i && typeof i === "object")
|
|
3727
|
-
i = i.ptr;
|
|
3625
|
+
if (i && typeof i === "object") i = i.ptr;
|
|
3728
3626
|
return wrapPointer(_emscripten_bind_PolygonList_at_1(self2, i), Polygon2);
|
|
3729
3627
|
};
|
|
3730
3628
|
PolygonList.prototype["clear"] = PolygonList.prototype.clear = function() {
|
|
@@ -3746,8 +3644,7 @@
|
|
|
3746
3644
|
Module["Contour"] = Contour;
|
|
3747
3645
|
Contour.prototype["push_back"] = Contour.prototype.push_back = function(s) {
|
|
3748
3646
|
var self2 = this.ptr;
|
|
3749
|
-
if (s && typeof s === "object")
|
|
3750
|
-
s = s.ptr;
|
|
3647
|
+
if (s && typeof s === "object") s = s.ptr;
|
|
3751
3648
|
_emscripten_bind_Contour_push_back_1(self2, s);
|
|
3752
3649
|
};
|
|
3753
3650
|
Contour.prototype["size"] = Contour.prototype.size = function() {
|
|
@@ -3756,8 +3653,7 @@
|
|
|
3756
3653
|
};
|
|
3757
3654
|
Contour.prototype["at"] = Contour.prototype.at = function(i) {
|
|
3758
3655
|
var self2 = this.ptr;
|
|
3759
|
-
if (i && typeof i === "object")
|
|
3760
|
-
i = i.ptr;
|
|
3656
|
+
if (i && typeof i === "object") i = i.ptr;
|
|
3761
3657
|
return wrapPointer(_emscripten_bind_Contour_at_1(self2, i), Point2);
|
|
3762
3658
|
};
|
|
3763
3659
|
Contour.prototype["clear"] = Contour.prototype.clear = function() {
|
|
@@ -3779,8 +3675,7 @@
|
|
|
3779
3675
|
Module["ContourList"] = ContourList;
|
|
3780
3676
|
ContourList.prototype["push_back"] = ContourList.prototype.push_back = function(s) {
|
|
3781
3677
|
var self2 = this.ptr;
|
|
3782
|
-
if (s && typeof s === "object")
|
|
3783
|
-
s = s.ptr;
|
|
3678
|
+
if (s && typeof s === "object") s = s.ptr;
|
|
3784
3679
|
_emscripten_bind_ContourList_push_back_1(self2, s);
|
|
3785
3680
|
};
|
|
3786
3681
|
ContourList.prototype["size"] = ContourList.prototype.size = function() {
|
|
@@ -3789,8 +3684,7 @@
|
|
|
3789
3684
|
};
|
|
3790
3685
|
ContourList.prototype["at"] = ContourList.prototype.at = function(i) {
|
|
3791
3686
|
var self2 = this.ptr;
|
|
3792
|
-
if (i && typeof i === "object")
|
|
3793
|
-
i = i.ptr;
|
|
3687
|
+
if (i && typeof i === "object") i = i.ptr;
|
|
3794
3688
|
return wrapPointer(_emscripten_bind_ContourList_at_1(self2, i), Contour);
|
|
3795
3689
|
};
|
|
3796
3690
|
ContourList.prototype["clear"] = ContourList.prototype.clear = function() {
|
|
@@ -4082,12 +3976,12 @@
|
|
|
4082
3976
|
_tmp1.subVectors(tri.a, tri.b);
|
|
4083
3977
|
_tmp2.subVectors(tri.a, tri.c);
|
|
4084
3978
|
_tmp1.cross(_tmp2);
|
|
4085
|
-
return _tmp1.x > -
|
|
3979
|
+
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;
|
|
4086
3980
|
}
|
|
4087
3981
|
function orient3D$1(a, b, c, d) {
|
|
4088
3982
|
_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);
|
|
4089
3983
|
const det = _matrix4.determinant();
|
|
4090
|
-
if (det < -
|
|
3984
|
+
if (det < -1e-10)
|
|
4091
3985
|
return -1;
|
|
4092
3986
|
else if (det > EPSILON$1)
|
|
4093
3987
|
return 1;
|
|
@@ -4097,7 +3991,7 @@
|
|
|
4097
3991
|
function orient2D(a, b, c) {
|
|
4098
3992
|
_matrix3.set(a.x, a.y, 1, b.x, b.y, 1, c.x, c.y, 1);
|
|
4099
3993
|
const det = _matrix3.determinant();
|
|
4100
|
-
if (det < -
|
|
3994
|
+
if (det < -1e-10)
|
|
4101
3995
|
return -1;
|
|
4102
3996
|
else if (det > EPSILON$1)
|
|
4103
3997
|
return 1;
|
|
@@ -4507,8 +4401,8 @@
|
|
|
4507
4401
|
_u$2.subVectors(position2, edge.a.pos3d);
|
|
4508
4402
|
_v$1.subVectors(edge.b.pos3d, edge.a.pos3d);
|
|
4509
4403
|
const cross = _u$2.cross(_v$1);
|
|
4510
|
-
const
|
|
4511
|
-
if (
|
|
4404
|
+
const v2 = cross.x + cross.y + cross.z;
|
|
4405
|
+
if (v2 > 1e-10 || v2 < -1e-10) {
|
|
4512
4406
|
return null;
|
|
4513
4407
|
}
|
|
4514
4408
|
if (_u$2.dot(_v$1) < -1e-10) {
|
|
@@ -4813,24 +4707,24 @@
|
|
|
4813
4707
|
}
|
|
4814
4708
|
return t;
|
|
4815
4709
|
}
|
|
4816
|
-
function split(key,
|
|
4710
|
+
function split(key, v2, comparator) {
|
|
4817
4711
|
var left, right;
|
|
4818
|
-
if (
|
|
4712
|
+
if (v2 === null) {
|
|
4819
4713
|
left = right = null;
|
|
4820
4714
|
} else {
|
|
4821
|
-
|
|
4822
|
-
var cmp = comparator(
|
|
4715
|
+
v2 = splay(key, v2, comparator);
|
|
4716
|
+
var cmp = comparator(v2.key, key);
|
|
4823
4717
|
if (cmp === 0) {
|
|
4824
|
-
left =
|
|
4825
|
-
right =
|
|
4718
|
+
left = v2.left;
|
|
4719
|
+
right = v2.right;
|
|
4826
4720
|
} else if (cmp < 0) {
|
|
4827
|
-
right =
|
|
4828
|
-
|
|
4829
|
-
left =
|
|
4721
|
+
right = v2.right;
|
|
4722
|
+
v2.right = null;
|
|
4723
|
+
left = v2;
|
|
4830
4724
|
} else {
|
|
4831
|
-
left =
|
|
4832
|
-
|
|
4833
|
-
right =
|
|
4725
|
+
left = v2.left;
|
|
4726
|
+
v2.left = null;
|
|
4727
|
+
right = v2;
|
|
4834
4728
|
}
|
|
4835
4729
|
}
|
|
4836
4730
|
return { left, right };
|
|
@@ -4859,8 +4753,7 @@
|
|
|
4859
4753
|
}
|
|
4860
4754
|
}
|
|
4861
4755
|
var Tree = function Tree2(comparator) {
|
|
4862
|
-
if (comparator === void 0)
|
|
4863
|
-
comparator = DEFAULT_COMPARE;
|
|
4756
|
+
if (comparator === void 0) comparator = DEFAULT_COMPARE;
|
|
4864
4757
|
this._comparator = comparator;
|
|
4865
4758
|
this._root = null;
|
|
4866
4759
|
this._size = 0;
|
|
@@ -4999,8 +4892,7 @@
|
|
|
4999
4892
|
return null;
|
|
5000
4893
|
};
|
|
5001
4894
|
Tree.prototype.minNode = function minNode(t) {
|
|
5002
|
-
if (t === void 0)
|
|
5003
|
-
t = this._root;
|
|
4895
|
+
if (t === void 0) t = this._root;
|
|
5004
4896
|
if (t) {
|
|
5005
4897
|
while (t.left) {
|
|
5006
4898
|
t = t.left;
|
|
@@ -5009,8 +4901,7 @@
|
|
|
5009
4901
|
return t;
|
|
5010
4902
|
};
|
|
5011
4903
|
Tree.prototype.maxNode = function maxNode(t) {
|
|
5012
|
-
if (t === void 0)
|
|
5013
|
-
t = this._root;
|
|
4904
|
+
if (t === void 0) t = this._root;
|
|
5014
4905
|
if (t) {
|
|
5015
4906
|
while (t.right) {
|
|
5016
4907
|
t = t.right;
|
|
@@ -5097,12 +4988,9 @@
|
|
|
5097
4988
|
return toList(this._root);
|
|
5098
4989
|
};
|
|
5099
4990
|
Tree.prototype.load = function load(keys, values, presort) {
|
|
5100
|
-
if (keys === void 0)
|
|
5101
|
-
|
|
5102
|
-
if (
|
|
5103
|
-
values = [];
|
|
5104
|
-
if (presort === void 0)
|
|
5105
|
-
presort = false;
|
|
4991
|
+
if (keys === void 0) keys = [];
|
|
4992
|
+
if (values === void 0) values = [];
|
|
4993
|
+
if (presort === void 0) presort = false;
|
|
5106
4994
|
var size2 = keys.length;
|
|
5107
4995
|
var comparator = this._comparator;
|
|
5108
4996
|
if (presort) {
|
|
@@ -5125,13 +5013,12 @@
|
|
|
5125
5013
|
return this._size;
|
|
5126
5014
|
};
|
|
5127
5015
|
Tree.prototype.toString = function toString(printNode) {
|
|
5128
|
-
if (printNode === void 0)
|
|
5129
|
-
|
|
5130
|
-
|
|
5131
|
-
};
|
|
5016
|
+
if (printNode === void 0) printNode = function(n) {
|
|
5017
|
+
return n.key;
|
|
5018
|
+
};
|
|
5132
5019
|
var out = [];
|
|
5133
|
-
printRow(this._root, "", true, function(
|
|
5134
|
-
return out.push(
|
|
5020
|
+
printRow(this._root, "", true, function(v2) {
|
|
5021
|
+
return out.push(v2);
|
|
5135
5022
|
}, printNode);
|
|
5136
5023
|
return out.join("");
|
|
5137
5024
|
};
|
|
@@ -5209,10 +5096,9 @@
|
|
|
5209
5096
|
return null;
|
|
5210
5097
|
}
|
|
5211
5098
|
function mergeLists(l1, l2, compare) {
|
|
5212
|
-
if (compare === void 0)
|
|
5213
|
-
|
|
5214
|
-
|
|
5215
|
-
};
|
|
5099
|
+
if (compare === void 0) compare = function(a, b) {
|
|
5100
|
+
return a - b;
|
|
5101
|
+
};
|
|
5216
5102
|
var head = {};
|
|
5217
5103
|
var p = head;
|
|
5218
5104
|
var p1 = l1;
|
|
@@ -5497,19 +5383,19 @@
|
|
|
5497
5383
|
values[i] = values[j];
|
|
5498
5384
|
values[j] = temp5;
|
|
5499
5385
|
var k = 4 * i;
|
|
5500
|
-
var
|
|
5386
|
+
var m2 = 4 * j;
|
|
5501
5387
|
var a = boxes[k];
|
|
5502
5388
|
var b = boxes[k + 1];
|
|
5503
5389
|
var c = boxes[k + 2];
|
|
5504
5390
|
var d = boxes[k + 3];
|
|
5505
|
-
boxes[k] = boxes[
|
|
5506
|
-
boxes[k + 1] = boxes[
|
|
5507
|
-
boxes[k + 2] = boxes[
|
|
5508
|
-
boxes[k + 3] = boxes[
|
|
5509
|
-
boxes[
|
|
5510
|
-
boxes[
|
|
5511
|
-
boxes[
|
|
5512
|
-
boxes[
|
|
5391
|
+
boxes[k] = boxes[m2];
|
|
5392
|
+
boxes[k + 1] = boxes[m2 + 1];
|
|
5393
|
+
boxes[k + 2] = boxes[m2 + 2];
|
|
5394
|
+
boxes[k + 3] = boxes[m2 + 3];
|
|
5395
|
+
boxes[m2] = a;
|
|
5396
|
+
boxes[m2 + 1] = b;
|
|
5397
|
+
boxes[m2 + 2] = c;
|
|
5398
|
+
boxes[m2 + 3] = d;
|
|
5513
5399
|
var e = indices[i];
|
|
5514
5400
|
indices[i] = indices[j];
|
|
5515
5401
|
indices[j] = e;
|
|
@@ -5561,7 +5447,7 @@
|
|
|
5561
5447
|
}
|
|
5562
5448
|
function bush(lines, options) {
|
|
5563
5449
|
var results = [];
|
|
5564
|
-
var reportIntersection =
|
|
5450
|
+
var reportIntersection = defaultIntersectionReporter;
|
|
5565
5451
|
var asyncState;
|
|
5566
5452
|
var index = new Flatbush(lines.length);
|
|
5567
5453
|
lines.forEach(addToIndex);
|
|
@@ -5680,11 +5566,10 @@
|
|
|
5680
5566
|
}
|
|
5681
5567
|
}
|
|
5682
5568
|
}
|
|
5683
|
-
if (splitViewVertices.length === 0)
|
|
5684
|
-
;
|
|
5569
|
+
if (splitViewVertices.length === 0) ;
|
|
5685
5570
|
else if (splitViewVertices.length === 1) {
|
|
5686
|
-
const
|
|
5687
|
-
|
|
5571
|
+
const v2 = splitViewVertices[0];
|
|
5572
|
+
v2.singularity = ViewVertexSingularity.ImageIntersection;
|
|
5688
5573
|
} else {
|
|
5689
5574
|
const v1 = splitViewVertices[0];
|
|
5690
5575
|
const v2 = splitViewVertices[1];
|
|
@@ -5873,8 +5758,7 @@
|
|
|
5873
5758
|
const res = () => {
|
|
5874
5759
|
resolve(this.buildAsync(idx + 1, actions, info, progressCallback));
|
|
5875
5760
|
};
|
|
5876
|
-
if (this.skipActions)
|
|
5877
|
-
res();
|
|
5761
|
+
if (this.skipActions) res();
|
|
5878
5762
|
else {
|
|
5879
5763
|
actions[idx].process().catch((_) => {
|
|
5880
5764
|
}).then(res);
|
|
@@ -6019,10 +5903,10 @@
|
|
|
6019
5903
|
}
|
|
6020
5904
|
const methods$1 = {};
|
|
6021
5905
|
const names = [];
|
|
6022
|
-
function registerMethods(name,
|
|
5906
|
+
function registerMethods(name, m2) {
|
|
6023
5907
|
if (Array.isArray(name)) {
|
|
6024
5908
|
for (const _name of name) {
|
|
6025
|
-
registerMethods(_name,
|
|
5909
|
+
registerMethods(_name, m2);
|
|
6026
5910
|
}
|
|
6027
5911
|
return;
|
|
6028
5912
|
}
|
|
@@ -6032,8 +5916,8 @@
|
|
|
6032
5916
|
}
|
|
6033
5917
|
return;
|
|
6034
5918
|
}
|
|
6035
|
-
addMethodNames(Object.getOwnPropertyNames(
|
|
6036
|
-
methods$1[name] = Object.assign(methods$1[name] || {},
|
|
5919
|
+
addMethodNames(Object.getOwnPropertyNames(m2));
|
|
5920
|
+
methods$1[name] = Object.assign(methods$1[name] || {}, m2);
|
|
6037
5921
|
}
|
|
6038
5922
|
function getMethodsFor(name) {
|
|
6039
5923
|
return methods$1[name] || {};
|
|
@@ -6068,12 +5952,12 @@
|
|
|
6068
5952
|
return d % 360 * Math.PI / 180;
|
|
6069
5953
|
}
|
|
6070
5954
|
function camelCase(s) {
|
|
6071
|
-
return s.toLowerCase().replace(/-(.)/g, function(
|
|
5955
|
+
return s.toLowerCase().replace(/-(.)/g, function(m2, g) {
|
|
6072
5956
|
return g.toUpperCase();
|
|
6073
5957
|
});
|
|
6074
5958
|
}
|
|
6075
5959
|
function unCamelCase(s) {
|
|
6076
|
-
return s.replace(/([A-Z])/g, function(
|
|
5960
|
+
return s.replace(/([A-Z])/g, function(m2, g) {
|
|
6077
5961
|
return "-" + g.toLowerCase();
|
|
6078
5962
|
});
|
|
6079
5963
|
}
|
|
@@ -6144,8 +6028,7 @@
|
|
|
6144
6028
|
return globals.document.createElementNS(ns, name);
|
|
6145
6029
|
}
|
|
6146
6030
|
function makeInstance(element, isHTML = false) {
|
|
6147
|
-
if (element instanceof Base)
|
|
6148
|
-
return element;
|
|
6031
|
+
if (element instanceof Base) return element;
|
|
6149
6032
|
if (typeof element === "object") {
|
|
6150
6033
|
return adopter(element);
|
|
6151
6034
|
}
|
|
@@ -6165,10 +6048,8 @@
|
|
|
6165
6048
|
return node && node.ownerDocument && node instanceof node.ownerDocument.defaultView.Node ? node : create(name);
|
|
6166
6049
|
}
|
|
6167
6050
|
function adopt(node) {
|
|
6168
|
-
if (!node)
|
|
6169
|
-
|
|
6170
|
-
if (node.instance instanceof Base)
|
|
6171
|
-
return node.instance;
|
|
6051
|
+
if (!node) return null;
|
|
6052
|
+
if (node.instance instanceof Base) return node.instance;
|
|
6172
6053
|
if (node.nodeName === "#document-fragment") {
|
|
6173
6054
|
return new elements.Fragment(node);
|
|
6174
6055
|
}
|
|
@@ -6183,8 +6064,7 @@
|
|
|
6183
6064
|
let adopter = adopt;
|
|
6184
6065
|
function register(element, name = element.name, asRoot = false) {
|
|
6185
6066
|
elements[name] = element;
|
|
6186
|
-
if (asRoot)
|
|
6187
|
-
elements[root] = element;
|
|
6067
|
+
if (asRoot) elements[root] = element;
|
|
6188
6068
|
addMethodNames(Object.getOwnPropertyNames(element.prototype));
|
|
6189
6069
|
return element;
|
|
6190
6070
|
}
|
|
@@ -6390,7 +6270,7 @@
|
|
|
6390
6270
|
hide,
|
|
6391
6271
|
visible
|
|
6392
6272
|
});
|
|
6393
|
-
function data(a,
|
|
6273
|
+
function data(a, v2, r) {
|
|
6394
6274
|
if (a == null) {
|
|
6395
6275
|
return this.data(map(filter(this.node.attributes, (el) => el.nodeName.indexOf("data-") === 0), (el) => el.nodeName.slice(5)));
|
|
6396
6276
|
} else if (a instanceof Array) {
|
|
@@ -6400,8 +6280,8 @@
|
|
|
6400
6280
|
}
|
|
6401
6281
|
return data2;
|
|
6402
6282
|
} else if (typeof a === "object") {
|
|
6403
|
-
for (
|
|
6404
|
-
this.data(
|
|
6283
|
+
for (v2 in a) {
|
|
6284
|
+
this.data(v2, a[v2]);
|
|
6405
6285
|
}
|
|
6406
6286
|
} else if (arguments.length < 2) {
|
|
6407
6287
|
try {
|
|
@@ -6410,14 +6290,14 @@
|
|
|
6410
6290
|
return this.attr("data-" + a);
|
|
6411
6291
|
}
|
|
6412
6292
|
} else {
|
|
6413
|
-
this.attr("data-" + a,
|
|
6293
|
+
this.attr("data-" + a, v2 === null ? null : r === true || typeof v2 === "string" || typeof v2 === "number" ? v2 : JSON.stringify(v2));
|
|
6414
6294
|
}
|
|
6415
6295
|
return this;
|
|
6416
6296
|
}
|
|
6417
6297
|
registerMethods("Dom", {
|
|
6418
6298
|
data
|
|
6419
6299
|
});
|
|
6420
|
-
function remember(k,
|
|
6300
|
+
function remember(k, v2) {
|
|
6421
6301
|
if (typeof arguments[0] === "object") {
|
|
6422
6302
|
for (const key in k) {
|
|
6423
6303
|
this.remember(key, k[key]);
|
|
@@ -6425,7 +6305,7 @@
|
|
|
6425
6305
|
} else if (arguments.length === 1) {
|
|
6426
6306
|
return this.memory()[k];
|
|
6427
6307
|
} else {
|
|
6428
|
-
this.memory()[k] =
|
|
6308
|
+
this.memory()[k] = v2;
|
|
6429
6309
|
}
|
|
6430
6310
|
return this;
|
|
6431
6311
|
}
|
|
@@ -6518,16 +6398,11 @@
|
|
|
6518
6398
|
}
|
|
6519
6399
|
}
|
|
6520
6400
|
function hueToRgb(p, q, t) {
|
|
6521
|
-
if (t < 0)
|
|
6522
|
-
|
|
6523
|
-
if (t
|
|
6524
|
-
|
|
6525
|
-
if (t <
|
|
6526
|
-
return p + (q - p) * 6 * t;
|
|
6527
|
-
if (t < 1 / 2)
|
|
6528
|
-
return q;
|
|
6529
|
-
if (t < 2 / 3)
|
|
6530
|
-
return p + (q - p) * (2 / 3 - t) * 6;
|
|
6401
|
+
if (t < 0) t += 1;
|
|
6402
|
+
if (t > 1) t -= 1;
|
|
6403
|
+
if (t < 1 / 6) return p + (q - p) * 6 * t;
|
|
6404
|
+
if (t < 1 / 2) return q;
|
|
6405
|
+
if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
|
|
6531
6406
|
return p;
|
|
6532
6407
|
}
|
|
6533
6408
|
class Color {
|
|
@@ -6607,15 +6482,15 @@
|
|
|
6607
6482
|
_b,
|
|
6608
6483
|
_c
|
|
6609
6484
|
} = this.rgb();
|
|
6610
|
-
const [r, g, b] = [_a, _b, _c].map((
|
|
6485
|
+
const [r, g, b] = [_a, _b, _c].map((v2) => v2 / 255);
|
|
6611
6486
|
const k = Math.min(1 - r, 1 - g, 1 - b);
|
|
6612
6487
|
if (k === 1) {
|
|
6613
6488
|
return new Color(0, 0, 0, 1, "cmyk");
|
|
6614
6489
|
}
|
|
6615
6490
|
const c = (1 - r - k) / (1 - k);
|
|
6616
|
-
const
|
|
6491
|
+
const m2 = (1 - g - k) / (1 - k);
|
|
6617
6492
|
const y2 = (1 - b - k) / (1 - k);
|
|
6618
|
-
const color = new Color(c,
|
|
6493
|
+
const color = new Color(c, m2, y2, k, "cmyk");
|
|
6619
6494
|
return color;
|
|
6620
6495
|
}
|
|
6621
6496
|
hsl() {
|
|
@@ -6624,7 +6499,7 @@
|
|
|
6624
6499
|
_b,
|
|
6625
6500
|
_c
|
|
6626
6501
|
} = this.rgb();
|
|
6627
|
-
const [r, g, b] = [_a, _b, _c].map((
|
|
6502
|
+
const [r, g, b] = [_a, _b, _c].map((v2) => v2 / 255);
|
|
6628
6503
|
const max = Math.max(r, g, b);
|
|
6629
6504
|
const min = Math.min(r, g, b);
|
|
6630
6505
|
const l = (max + min) / 2;
|
|
@@ -6666,7 +6541,7 @@
|
|
|
6666
6541
|
} else if (typeof a === "string") {
|
|
6667
6542
|
if (isRgb.test(a)) {
|
|
6668
6543
|
const noWhitespace = a.replace(whitespace, "");
|
|
6669
|
-
const [_a2, _b2, _c2] = rgb.exec(noWhitespace).slice(1, 4).map((
|
|
6544
|
+
const [_a2, _b2, _c2] = rgb.exec(noWhitespace).slice(1, 4).map((v2) => parseInt(v2));
|
|
6670
6545
|
Object.assign(this, {
|
|
6671
6546
|
_a: _a2,
|
|
6672
6547
|
_b: _b2,
|
|
@@ -6675,7 +6550,7 @@
|
|
|
6675
6550
|
space: "rgb"
|
|
6676
6551
|
});
|
|
6677
6552
|
} else if (isHex.test(a)) {
|
|
6678
|
-
const hexParse = (
|
|
6553
|
+
const hexParse = (v2) => parseInt(v2, 16);
|
|
6679
6554
|
const [, _a2, _b2, _c2] = hex.exec(sixDigitHex(a)).map(hexParse);
|
|
6680
6555
|
Object.assign(this, {
|
|
6681
6556
|
_a: _a2,
|
|
@@ -6684,8 +6559,7 @@
|
|
|
6684
6559
|
_d: 0,
|
|
6685
6560
|
space: "rgb"
|
|
6686
6561
|
});
|
|
6687
|
-
} else
|
|
6688
|
-
throw Error("Unsupported string format, can't construct Color");
|
|
6562
|
+
} else throw Error("Unsupported string format, can't construct Color");
|
|
6689
6563
|
}
|
|
6690
6564
|
const {
|
|
6691
6565
|
_a,
|
|
@@ -6819,12 +6693,12 @@
|
|
|
6819
6693
|
} else if (this.space === "cmyk") {
|
|
6820
6694
|
const {
|
|
6821
6695
|
c,
|
|
6822
|
-
m,
|
|
6696
|
+
m: m2,
|
|
6823
6697
|
y: y2,
|
|
6824
6698
|
k
|
|
6825
6699
|
} = this;
|
|
6826
6700
|
const r = 255 * (1 - Math.min(1, c * (1 - k) + k));
|
|
6827
|
-
const g = 255 * (1 - Math.min(1,
|
|
6701
|
+
const g = 255 * (1 - Math.min(1, m2 * (1 - k) + k));
|
|
6828
6702
|
const b = 255 * (1 - Math.min(1, y2 * (1 - k) + k));
|
|
6829
6703
|
const color = new Color(r, g, b);
|
|
6830
6704
|
return color;
|
|
@@ -6860,7 +6734,7 @@
|
|
|
6860
6734
|
_b: g255,
|
|
6861
6735
|
_c: b255
|
|
6862
6736
|
} = this.rgb();
|
|
6863
|
-
const [r, g, b] = [r255, g255, b255].map((
|
|
6737
|
+
const [r, g, b] = [r255, g255, b255].map((v2) => v2 / 255);
|
|
6864
6738
|
const rL = r > 0.04045 ? Math.pow((r + 0.055) / 1.055, 2.4) : r / 12.92;
|
|
6865
6739
|
const gL = g > 0.04045 ? Math.pow((g + 0.055) / 1.055, 2.4) : g / 12.92;
|
|
6866
6740
|
const bL = b > 0.04045 ? Math.pow((b + 0.055) / 1.055, 2.4) : b / 12.92;
|
|
@@ -6887,7 +6761,7 @@
|
|
|
6887
6761
|
min,
|
|
6888
6762
|
round: round2
|
|
6889
6763
|
} = Math;
|
|
6890
|
-
const format = (
|
|
6764
|
+
const format = (v2) => max(0, min(round2(v2), 255));
|
|
6891
6765
|
return [_a, _b, _c].map(format);
|
|
6892
6766
|
}
|
|
6893
6767
|
/*
|
|
@@ -6925,20 +6799,20 @@
|
|
|
6925
6799
|
toArray() {
|
|
6926
6800
|
return [this.x, this.y];
|
|
6927
6801
|
}
|
|
6928
|
-
transform(
|
|
6929
|
-
return this.clone().transformO(
|
|
6802
|
+
transform(m2) {
|
|
6803
|
+
return this.clone().transformO(m2);
|
|
6930
6804
|
}
|
|
6931
6805
|
// Transform point with matrix
|
|
6932
|
-
transformO(
|
|
6933
|
-
if (!Matrix.isMatrixLike(
|
|
6934
|
-
|
|
6806
|
+
transformO(m2) {
|
|
6807
|
+
if (!Matrix.isMatrixLike(m2)) {
|
|
6808
|
+
m2 = new Matrix(m2);
|
|
6935
6809
|
}
|
|
6936
6810
|
const {
|
|
6937
6811
|
x: x2,
|
|
6938
6812
|
y: y2
|
|
6939
6813
|
} = this;
|
|
6940
|
-
this.x =
|
|
6941
|
-
this.y =
|
|
6814
|
+
this.x = m2.a * x2 + m2.c * y2 + m2.e;
|
|
6815
|
+
this.y = m2.b * x2 + m2.d * y2 + m2.f;
|
|
6942
6816
|
return this;
|
|
6943
6817
|
}
|
|
6944
6818
|
}
|
|
@@ -6946,7 +6820,7 @@
|
|
|
6946
6820
|
return new Point(x2, y2).transformO(this.screenCTM().inverseO());
|
|
6947
6821
|
}
|
|
6948
6822
|
function closeEnough(a, b, threshold) {
|
|
6949
|
-
return Math.abs(b - a) <
|
|
6823
|
+
return Math.abs(b - a) < 1e-6;
|
|
6950
6824
|
}
|
|
6951
6825
|
class Matrix {
|
|
6952
6826
|
constructor(...args) {
|
|
@@ -7073,8 +6947,7 @@
|
|
|
7073
6947
|
}
|
|
7074
6948
|
// Check if two matrices are equal
|
|
7075
6949
|
equals(other) {
|
|
7076
|
-
if (other === this)
|
|
7077
|
-
return true;
|
|
6950
|
+
if (other === this) return true;
|
|
7078
6951
|
const comp = new Matrix(other);
|
|
7079
6952
|
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);
|
|
7080
6953
|
}
|
|
@@ -7109,8 +6982,7 @@
|
|
|
7109
6982
|
const e = this.e;
|
|
7110
6983
|
const f = this.f;
|
|
7111
6984
|
const det = a * d - b * c;
|
|
7112
|
-
if (!det)
|
|
7113
|
-
throw new Error("Cannot invert " + this);
|
|
6985
|
+
if (!det) throw new Error("Cannot invert " + this);
|
|
7114
6986
|
const na = d / det;
|
|
7115
6987
|
const nb = -b / det;
|
|
7116
6988
|
const nc = -c / det;
|
|
@@ -7303,9 +7175,9 @@
|
|
|
7303
7175
|
function screenCTM() {
|
|
7304
7176
|
if (typeof this.isRoot === "function" && !this.isRoot()) {
|
|
7305
7177
|
const rect = this.rect(1, 1);
|
|
7306
|
-
const
|
|
7178
|
+
const m2 = rect.node.getScreenCTM();
|
|
7307
7179
|
rect.remove();
|
|
7308
|
-
return new Matrix(
|
|
7180
|
+
return new Matrix(m2);
|
|
7309
7181
|
}
|
|
7310
7182
|
return new Matrix(this.node.getScreenCTM());
|
|
7311
7183
|
}
|
|
@@ -7378,9 +7250,9 @@
|
|
|
7378
7250
|
toString() {
|
|
7379
7251
|
return this.x + " " + this.y + " " + this.width + " " + this.height;
|
|
7380
7252
|
}
|
|
7381
|
-
transform(
|
|
7382
|
-
if (!(
|
|
7383
|
-
|
|
7253
|
+
transform(m2) {
|
|
7254
|
+
if (!(m2 instanceof Matrix)) {
|
|
7255
|
+
m2 = new Matrix(m2);
|
|
7384
7256
|
}
|
|
7385
7257
|
let xMin = Infinity;
|
|
7386
7258
|
let xMax = -Infinity;
|
|
@@ -7388,7 +7260,7 @@
|
|
|
7388
7260
|
let yMax = -Infinity;
|
|
7389
7261
|
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)];
|
|
7390
7262
|
pts.forEach(function(p) {
|
|
7391
|
-
p = p.transform(
|
|
7263
|
+
p = p.transform(m2);
|
|
7392
7264
|
xMin = Math.min(xMin, p.x);
|
|
7393
7265
|
xMax = Math.max(xMax, p.x);
|
|
7394
7266
|
yMin = Math.min(yMin, p.y);
|
|
@@ -7444,8 +7316,7 @@
|
|
|
7444
7316
|
registerMethods({
|
|
7445
7317
|
viewbox: {
|
|
7446
7318
|
viewbox(x2, y2, width2, height2) {
|
|
7447
|
-
if (x2 == null)
|
|
7448
|
-
return new Box(this.attr("viewBox"));
|
|
7319
|
+
if (x2 == null) return new Box(this.attr("viewBox"));
|
|
7449
7320
|
return this.attr("viewBox", new Box(x2, y2, width2, height2));
|
|
7450
7321
|
},
|
|
7451
7322
|
zoom(level, point2) {
|
|
@@ -7460,18 +7331,17 @@
|
|
|
7460
7331
|
if (!width2 || !height2) {
|
|
7461
7332
|
throw new Error("Impossible to get absolute width and height. Please provide an absolute width and height attribute on the zooming element");
|
|
7462
7333
|
}
|
|
7463
|
-
const
|
|
7464
|
-
const zoomX = width2 /
|
|
7465
|
-
const zoomY = height2 /
|
|
7334
|
+
const v2 = this.viewbox();
|
|
7335
|
+
const zoomX = width2 / v2.width;
|
|
7336
|
+
const zoomY = height2 / v2.height;
|
|
7466
7337
|
const zoom = Math.min(zoomX, zoomY);
|
|
7467
7338
|
if (level == null) {
|
|
7468
7339
|
return zoom;
|
|
7469
7340
|
}
|
|
7470
7341
|
let zoomAmount = zoom / level;
|
|
7471
|
-
if (zoomAmount === Infinity)
|
|
7472
|
-
|
|
7473
|
-
|
|
7474
|
-
const box = new Box(v).transform(new Matrix({
|
|
7342
|
+
if (zoomAmount === Infinity) zoomAmount = Number.MAX_SAFE_INTEGER / 100;
|
|
7343
|
+
point2 = point2 || new Point(width2 / 2 / zoomX + v2.x, height2 / 2 / zoomY + v2.y);
|
|
7344
|
+
const box = new Box(v2).transform(new Matrix({
|
|
7475
7345
|
scale: zoomAmount,
|
|
7476
7346
|
origin: point2
|
|
7477
7347
|
}));
|
|
@@ -7483,8 +7353,7 @@
|
|
|
7483
7353
|
class List extends Array {
|
|
7484
7354
|
constructor(arr = [], ...args) {
|
|
7485
7355
|
super(arr, ...args);
|
|
7486
|
-
if (typeof arr === "number")
|
|
7487
|
-
return this;
|
|
7356
|
+
if (typeof arr === "number") return this;
|
|
7488
7357
|
this.length = 0;
|
|
7489
7358
|
this.push(...arr);
|
|
7490
7359
|
}
|
|
@@ -7508,10 +7377,8 @@
|
|
|
7508
7377
|
const reserved = ["toArray", "constructor", "each"];
|
|
7509
7378
|
List.extend = function(methods2) {
|
|
7510
7379
|
methods2 = methods2.reduce((obj, name) => {
|
|
7511
|
-
if (reserved.includes(name))
|
|
7512
|
-
|
|
7513
|
-
if (name[0] === "_")
|
|
7514
|
-
return obj;
|
|
7380
|
+
if (reserved.includes(name)) return obj;
|
|
7381
|
+
if (name[0] === "_") return obj;
|
|
7515
7382
|
obj[name] = function(...attrs2) {
|
|
7516
7383
|
return this.each(name, ...attrs2);
|
|
7517
7384
|
};
|
|
@@ -7534,10 +7401,8 @@
|
|
|
7534
7401
|
const windowEvents = {};
|
|
7535
7402
|
function getEvents(instance) {
|
|
7536
7403
|
let n = instance.getEventHolder();
|
|
7537
|
-
if (n === globals.window)
|
|
7538
|
-
|
|
7539
|
-
if (!n.events)
|
|
7540
|
-
n.events = {};
|
|
7404
|
+
if (n === globals.window) n = windowEvents;
|
|
7405
|
+
if (!n.events) n.events = {};
|
|
7541
7406
|
return n.events;
|
|
7542
7407
|
}
|
|
7543
7408
|
function getEventTarget(instance) {
|
|
@@ -7545,10 +7410,8 @@
|
|
|
7545
7410
|
}
|
|
7546
7411
|
function clearEvents(instance) {
|
|
7547
7412
|
let n = instance.getEventHolder();
|
|
7548
|
-
if (n === globals.window)
|
|
7549
|
-
|
|
7550
|
-
if (n.events)
|
|
7551
|
-
n.events = {};
|
|
7413
|
+
if (n === globals.window) n = windowEvents;
|
|
7414
|
+
if (n.events) n.events = {};
|
|
7552
7415
|
}
|
|
7553
7416
|
function on(node, events, listener, binding, options) {
|
|
7554
7417
|
const l = listener.bind(binding || node);
|
|
@@ -7574,8 +7437,7 @@
|
|
|
7574
7437
|
const n = getEventTarget(instance);
|
|
7575
7438
|
if (typeof listener === "function") {
|
|
7576
7439
|
listener = listener._svgjsListenerId;
|
|
7577
|
-
if (!listener)
|
|
7578
|
-
return;
|
|
7440
|
+
if (!listener) return;
|
|
7579
7441
|
}
|
|
7580
7442
|
events = Array.isArray(events) ? events : (events || "").split(delimiter);
|
|
7581
7443
|
events.forEach(function(event) {
|
|
@@ -7639,8 +7501,7 @@
|
|
|
7639
7501
|
}
|
|
7640
7502
|
dispatchEvent(event) {
|
|
7641
7503
|
const bag = this.getEventHolder().events;
|
|
7642
|
-
if (!bag)
|
|
7643
|
-
return true;
|
|
7504
|
+
if (!bag) return true;
|
|
7644
7505
|
const events = bag[event.type];
|
|
7645
7506
|
for (const i in events) {
|
|
7646
7507
|
for (const j in events[i]) {
|
|
@@ -7719,16 +7580,14 @@
|
|
|
7719
7580
|
return new this.constructor(this);
|
|
7720
7581
|
}
|
|
7721
7582
|
init(arr) {
|
|
7722
|
-
if (typeof arr === "number")
|
|
7723
|
-
return this;
|
|
7583
|
+
if (typeof arr === "number") return this;
|
|
7724
7584
|
this.length = 0;
|
|
7725
7585
|
this.push(...this.parse(arr));
|
|
7726
7586
|
return this;
|
|
7727
7587
|
}
|
|
7728
7588
|
// Parse whitespace separated string
|
|
7729
7589
|
parse(array2 = []) {
|
|
7730
|
-
if (array2 instanceof Array)
|
|
7731
|
-
return array2;
|
|
7590
|
+
if (array2 instanceof Array) return array2;
|
|
7732
7591
|
return array2.trim().split(delimiter).map(parseFloat);
|
|
7733
7592
|
}
|
|
7734
7593
|
toArray() {
|
|
@@ -7832,8 +7691,7 @@
|
|
|
7832
7691
|
return last;
|
|
7833
7692
|
}, {});
|
|
7834
7693
|
} else if (typeof attr2 === "object" && attr2.constructor === Object) {
|
|
7835
|
-
for (val in attr2)
|
|
7836
|
-
this.attr(val, attr2[val]);
|
|
7694
|
+
for (val in attr2) this.attr(val, attr2[val]);
|
|
7837
7695
|
} else if (val === null) {
|
|
7838
7696
|
this.node.removeAttribute(attr2);
|
|
7839
7697
|
} else if (val == null) {
|
|
@@ -7971,14 +7829,11 @@
|
|
|
7971
7829
|
// Returns the parent element instance
|
|
7972
7830
|
parent(type) {
|
|
7973
7831
|
let parent = this;
|
|
7974
|
-
if (!parent.node.parentNode)
|
|
7975
|
-
return null;
|
|
7832
|
+
if (!parent.node.parentNode) return null;
|
|
7976
7833
|
parent = adopt(parent.node.parentNode);
|
|
7977
|
-
if (!type)
|
|
7978
|
-
return parent;
|
|
7834
|
+
if (!type) return parent;
|
|
7979
7835
|
do {
|
|
7980
|
-
if (typeof type === "string" ? parent.matches(type) : parent instanceof type)
|
|
7981
|
-
return parent;
|
|
7836
|
+
if (typeof type === "string" ? parent.matches(type) : parent instanceof type) return parent;
|
|
7982
7837
|
} while (parent = adopt(parent.node.parentNode));
|
|
7983
7838
|
return parent;
|
|
7984
7839
|
}
|
|
@@ -8066,8 +7921,7 @@
|
|
|
8066
7921
|
if (outerXML) {
|
|
8067
7922
|
const result = xmlOrFn(current);
|
|
8068
7923
|
current = result || current;
|
|
8069
|
-
if (result === false)
|
|
8070
|
-
return "";
|
|
7924
|
+
if (result === false) return "";
|
|
8071
7925
|
}
|
|
8072
7926
|
current.each(function() {
|
|
8073
7927
|
const result = xmlOrFn(this);
|
|
@@ -8172,10 +8026,9 @@
|
|
|
8172
8026
|
// Get referenced element form attribute value
|
|
8173
8027
|
reference(attr2) {
|
|
8174
8028
|
attr2 = this.attr(attr2);
|
|
8175
|
-
if (!attr2)
|
|
8176
|
-
|
|
8177
|
-
|
|
8178
|
-
return m ? makeInstance(m[1]) : null;
|
|
8029
|
+
if (!attr2) return null;
|
|
8030
|
+
const m2 = (attr2 + "").match(reference);
|
|
8031
|
+
return m2 ? makeInstance(m2[1]) : null;
|
|
8179
8032
|
}
|
|
8180
8033
|
// Get parent document
|
|
8181
8034
|
root() {
|
|
@@ -8229,19 +8082,19 @@
|
|
|
8229
8082
|
return a === "color" ? t : t + "-" + a;
|
|
8230
8083
|
}
|
|
8231
8084
|
};
|
|
8232
|
-
["fill", "stroke"].forEach(function(
|
|
8085
|
+
["fill", "stroke"].forEach(function(m2) {
|
|
8233
8086
|
const extension = {};
|
|
8234
8087
|
let i;
|
|
8235
|
-
extension[
|
|
8088
|
+
extension[m2] = function(o) {
|
|
8236
8089
|
if (typeof o === "undefined") {
|
|
8237
|
-
return this.attr(
|
|
8090
|
+
return this.attr(m2);
|
|
8238
8091
|
}
|
|
8239
8092
|
if (typeof o === "string" || o instanceof Color || Color.isRgb(o) || o instanceof Element) {
|
|
8240
|
-
this.attr(
|
|
8093
|
+
this.attr(m2, o);
|
|
8241
8094
|
} else {
|
|
8242
|
-
for (i = sugar[
|
|
8243
|
-
if (o[sugar[
|
|
8244
|
-
this.attr(sugar.prefix(
|
|
8095
|
+
for (i = sugar[m2].length - 1; i >= 0; i--) {
|
|
8096
|
+
if (o[sugar[m2][i]] != null) {
|
|
8097
|
+
this.attr(sugar.prefix(m2, sugar[m2][i]), o[sugar[m2][i]]);
|
|
8245
8098
|
}
|
|
8246
8099
|
}
|
|
8247
8100
|
}
|
|
@@ -8343,13 +8196,12 @@
|
|
|
8343
8196
|
});
|
|
8344
8197
|
registerMethods(["Element", "Runner"], {
|
|
8345
8198
|
// Set font
|
|
8346
|
-
font: function(a,
|
|
8199
|
+
font: function(a, v2) {
|
|
8347
8200
|
if (typeof a === "object") {
|
|
8348
|
-
for (
|
|
8349
|
-
this.font(v, a[v]);
|
|
8201
|
+
for (v2 in a) this.font(v2, a[v2]);
|
|
8350
8202
|
return this;
|
|
8351
8203
|
}
|
|
8352
|
-
return a === "leading" ? this.leading(
|
|
8204
|
+
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);
|
|
8353
8205
|
}
|
|
8354
8206
|
});
|
|
8355
8207
|
const methods = ["click", "dblclick", "mousedown", "mouseup", "mouseover", "mouseout", "mousemove", "mouseenter", "mouseleave", "touchstart", "touchmove", "touchleave", "touchend", "touchcancel"].reduce(function(last, event) {
|
|
@@ -8383,8 +8235,7 @@
|
|
|
8383
8235
|
return matrix;
|
|
8384
8236
|
}
|
|
8385
8237
|
function toParent(parent, i) {
|
|
8386
|
-
if (this === parent)
|
|
8387
|
-
return this;
|
|
8238
|
+
if (this === parent) return this;
|
|
8388
8239
|
const ctm2 = this.screenCTM();
|
|
8389
8240
|
const pCtm = parent.screenCTM().inverse();
|
|
8390
8241
|
this.addTo(parent, i).untransform().transform(pCtm.multiply(ctm2));
|
|
@@ -8549,8 +8400,7 @@
|
|
|
8549
8400
|
}
|
|
8550
8401
|
// custom attr to handle transform
|
|
8551
8402
|
attr(a, b, c) {
|
|
8552
|
-
if (a === "transform")
|
|
8553
|
-
a = "gradientTransform";
|
|
8403
|
+
if (a === "transform") a = "gradientTransform";
|
|
8554
8404
|
return super.attr(a, b, c);
|
|
8555
8405
|
}
|
|
8556
8406
|
bbox() {
|
|
@@ -8599,8 +8449,7 @@
|
|
|
8599
8449
|
}
|
|
8600
8450
|
// custom attr to handle transform
|
|
8601
8451
|
attr(a, b, c) {
|
|
8602
|
-
if (a === "transform")
|
|
8603
|
-
a = "patternTransform";
|
|
8452
|
+
if (a === "transform") a = "patternTransform";
|
|
8604
8453
|
return super.attr(a, b, c);
|
|
8605
8454
|
}
|
|
8606
8455
|
bbox() {
|
|
@@ -8652,8 +8501,7 @@
|
|
|
8652
8501
|
}
|
|
8653
8502
|
// (re)load image
|
|
8654
8503
|
load(url, callback) {
|
|
8655
|
-
if (!url)
|
|
8656
|
-
return this;
|
|
8504
|
+
if (!url) return this;
|
|
8657
8505
|
const img = new globals.window.Image();
|
|
8658
8506
|
on(img, "load", function(e) {
|
|
8659
8507
|
const p = this.parent(Pattern);
|
|
@@ -8732,8 +8580,7 @@
|
|
|
8732
8580
|
} else {
|
|
8733
8581
|
array2 = array2.trim().split(delimiter).map(parseFloat);
|
|
8734
8582
|
}
|
|
8735
|
-
if (array2.length % 2 !== 0)
|
|
8736
|
-
array2.pop();
|
|
8583
|
+
if (array2.length % 2 !== 0) array2.pop();
|
|
8737
8584
|
for (let i = 0, len = array2.length; i < len; i = i + 2) {
|
|
8738
8585
|
points.push([array2[i], array2[i + 1]]);
|
|
8739
8586
|
}
|
|
@@ -8744,10 +8591,8 @@
|
|
|
8744
8591
|
let i;
|
|
8745
8592
|
const box = this.bbox();
|
|
8746
8593
|
for (i = this.length - 1; i >= 0; i--) {
|
|
8747
|
-
if (box.width)
|
|
8748
|
-
|
|
8749
|
-
if (box.height)
|
|
8750
|
-
this[i][1] = (this[i][1] - box.y) * height2 / box.height + box.y;
|
|
8594
|
+
if (box.width) this[i][0] = (this[i][0] - box.x) * width2 / box.width + box.x;
|
|
8595
|
+
if (box.height) this[i][1] = (this[i][1] - box.y) * height2 / box.height + box.y;
|
|
8751
8596
|
}
|
|
8752
8597
|
return this;
|
|
8753
8598
|
}
|
|
@@ -8768,18 +8613,18 @@
|
|
|
8768
8613
|
}
|
|
8769
8614
|
return array2.join(" ");
|
|
8770
8615
|
}
|
|
8771
|
-
transform(
|
|
8772
|
-
return this.clone().transformO(
|
|
8616
|
+
transform(m2) {
|
|
8617
|
+
return this.clone().transformO(m2);
|
|
8773
8618
|
}
|
|
8774
8619
|
// transform points with matrix (similar to Point.transform)
|
|
8775
|
-
transformO(
|
|
8776
|
-
if (!Matrix.isMatrixLike(
|
|
8777
|
-
|
|
8620
|
+
transformO(m2) {
|
|
8621
|
+
if (!Matrix.isMatrixLike(m2)) {
|
|
8622
|
+
m2 = new Matrix(m2);
|
|
8778
8623
|
}
|
|
8779
8624
|
for (let i = this.length; i--; ) {
|
|
8780
8625
|
const [x2, y2] = this[i];
|
|
8781
|
-
this[i][0] =
|
|
8782
|
-
this[i][1] =
|
|
8626
|
+
this[i][0] = m2.a * x2 + m2.c * y2 + m2.e;
|
|
8627
|
+
this[i][1] = m2.b * x2 + m2.d * y2 + m2.f;
|
|
8783
8628
|
}
|
|
8784
8629
|
return this;
|
|
8785
8630
|
}
|
|
@@ -8901,8 +8746,7 @@
|
|
|
8901
8746
|
// Create and attach markers
|
|
8902
8747
|
marker(marker, width2, height2, block) {
|
|
8903
8748
|
let attr2 = ["marker"];
|
|
8904
|
-
if (marker !== "all")
|
|
8905
|
-
attr2.push(marker);
|
|
8749
|
+
if (marker !== "all") attr2.push(marker);
|
|
8906
8750
|
attr2 = attr2.join("-");
|
|
8907
8751
|
marker = arguments[1] instanceof Marker ? arguments[1] : this.defs().marker(width2, height2, block);
|
|
8908
8752
|
return this.attr(attr2, marker);
|
|
@@ -8911,12 +8755,10 @@
|
|
|
8911
8755
|
});
|
|
8912
8756
|
register(Marker, "Marker");
|
|
8913
8757
|
function makeSetterGetter(k, f) {
|
|
8914
|
-
return function(
|
|
8915
|
-
if (
|
|
8916
|
-
|
|
8917
|
-
|
|
8918
|
-
if (f)
|
|
8919
|
-
f.call(this);
|
|
8758
|
+
return function(v2) {
|
|
8759
|
+
if (v2 == null) return this[k];
|
|
8760
|
+
this[k] = v2;
|
|
8761
|
+
if (f) f.call(this);
|
|
8920
8762
|
return this;
|
|
8921
8763
|
};
|
|
8922
8764
|
}
|
|
@@ -9030,15 +8872,11 @@
|
|
|
9030
8872
|
this.duration(duration).overshoot(overshoot);
|
|
9031
8873
|
}
|
|
9032
8874
|
step(current, target, dt, c) {
|
|
9033
|
-
if (typeof current === "string")
|
|
9034
|
-
return current;
|
|
8875
|
+
if (typeof current === "string") return current;
|
|
9035
8876
|
c.done = dt === Infinity;
|
|
9036
|
-
if (dt === Infinity)
|
|
9037
|
-
|
|
9038
|
-
if (dt
|
|
9039
|
-
return current;
|
|
9040
|
-
if (dt > 100)
|
|
9041
|
-
dt = 16;
|
|
8877
|
+
if (dt === Infinity) return target;
|
|
8878
|
+
if (dt === 0) return current;
|
|
8879
|
+
if (dt > 100) dt = 16;
|
|
9042
8880
|
dt /= 1e3;
|
|
9043
8881
|
const velocity = c.velocity || 0;
|
|
9044
8882
|
const acceleration = -this.d * velocity - this.k * (current - target);
|
|
@@ -9058,13 +8896,10 @@
|
|
|
9058
8896
|
this.p(p).i(i).d(d).windup(windup);
|
|
9059
8897
|
}
|
|
9060
8898
|
step(current, target, dt, c) {
|
|
9061
|
-
if (typeof current === "string")
|
|
9062
|
-
return current;
|
|
8899
|
+
if (typeof current === "string") return current;
|
|
9063
8900
|
c.done = dt === Infinity;
|
|
9064
|
-
if (dt === Infinity)
|
|
9065
|
-
|
|
9066
|
-
if (dt === 0)
|
|
9067
|
-
return current;
|
|
8901
|
+
if (dt === Infinity) return target;
|
|
8902
|
+
if (dt === 0) return current;
|
|
9068
8903
|
const p = target - current;
|
|
9069
8904
|
let i = (c.integral || 0) + p * dt;
|
|
9070
8905
|
const d = (p - (c.error || 0)) / dt;
|
|
@@ -9150,10 +8985,8 @@
|
|
|
9150
8985
|
for (let i = 0, il = mlhvqtcsaz.length; i < il; ++i) {
|
|
9151
8986
|
pathHandlers[mlhvqtcsaz[i]] = /* @__PURE__ */ function(i2) {
|
|
9152
8987
|
return function(c, p, p0) {
|
|
9153
|
-
if (i2 === "H")
|
|
9154
|
-
|
|
9155
|
-
else if (i2 === "V")
|
|
9156
|
-
c[0] = c[0] + p.y;
|
|
8988
|
+
if (i2 === "H") c[0] = c[0] + p.x;
|
|
8989
|
+
else if (i2 === "V") c[0] = c[0] + p.y;
|
|
9157
8990
|
else if (i2 === "A") {
|
|
9158
8991
|
c[5] = c[5] + p.x;
|
|
9159
8992
|
c[6] = c[6] + p.y;
|
|
@@ -9189,8 +9022,7 @@
|
|
|
9189
9022
|
return pathLetter;
|
|
9190
9023
|
}
|
|
9191
9024
|
function finalizeNumber(parser2, inNumber) {
|
|
9192
|
-
if (!parser2.inNumber)
|
|
9193
|
-
throw new Error("Parser Error");
|
|
9025
|
+
if (!parser2.inNumber) throw new Error("Parser Error");
|
|
9194
9026
|
parser2.number && parser2.segment.push(parseFloat(parser2.number));
|
|
9195
9027
|
parser2.inNumber = inNumber;
|
|
9196
9028
|
parser2.number = "";
|
|
@@ -9208,8 +9040,7 @@
|
|
|
9208
9040
|
parser2.segments.push(parser2.segment);
|
|
9209
9041
|
}
|
|
9210
9042
|
function isArcFlag(parser2) {
|
|
9211
|
-
if (!parser2.segment.length)
|
|
9212
|
-
return false;
|
|
9043
|
+
if (!parser2.segment.length) return false;
|
|
9213
9044
|
const isArc = parser2.segment[0].toUpperCase() === "A";
|
|
9214
9045
|
const length2 = parser2.segment.length;
|
|
9215
9046
|
return isArc && (length2 === 4 || length2 === 5);
|
|
@@ -9464,8 +9295,7 @@
|
|
|
9464
9295
|
return this;
|
|
9465
9296
|
}
|
|
9466
9297
|
stepper(stepper) {
|
|
9467
|
-
if (stepper == null)
|
|
9468
|
-
return this._stepper;
|
|
9298
|
+
if (stepper == null) return this._stepper;
|
|
9469
9299
|
this._stepper = stepper;
|
|
9470
9300
|
return this;
|
|
9471
9301
|
}
|
|
@@ -9540,8 +9370,8 @@
|
|
|
9540
9370
|
return this;
|
|
9541
9371
|
}
|
|
9542
9372
|
toArray() {
|
|
9543
|
-
const
|
|
9544
|
-
return [
|
|
9373
|
+
const v2 = this;
|
|
9374
|
+
return [v2.scaleX, v2.scaleY, v2.shear, v2.rotate, v2.translateX, v2.translateY, v2.originX, v2.originY];
|
|
9545
9375
|
}
|
|
9546
9376
|
}
|
|
9547
9377
|
TransformBag.defaults = {
|
|
@@ -9803,24 +9633,18 @@
|
|
|
9803
9633
|
}
|
|
9804
9634
|
// Removes the item that was returned from the push
|
|
9805
9635
|
remove(item) {
|
|
9806
|
-
if (item.prev)
|
|
9807
|
-
|
|
9808
|
-
if (item.
|
|
9809
|
-
|
|
9810
|
-
if (item === this._last)
|
|
9811
|
-
this._last = item.prev;
|
|
9812
|
-
if (item === this._first)
|
|
9813
|
-
this._first = item.next;
|
|
9636
|
+
if (item.prev) item.prev.next = item.next;
|
|
9637
|
+
if (item.next) item.next.prev = item.prev;
|
|
9638
|
+
if (item === this._last) this._last = item.prev;
|
|
9639
|
+
if (item === this._first) this._first = item.next;
|
|
9814
9640
|
item.prev = null;
|
|
9815
9641
|
item.next = null;
|
|
9816
9642
|
}
|
|
9817
9643
|
shift() {
|
|
9818
9644
|
const remove2 = this._first;
|
|
9819
|
-
if (!remove2)
|
|
9820
|
-
return null;
|
|
9645
|
+
if (!remove2) return null;
|
|
9821
9646
|
this._first = remove2.next;
|
|
9822
|
-
if (this._first)
|
|
9823
|
-
this._first.prev = null;
|
|
9647
|
+
if (this._first) this._first.prev = null;
|
|
9824
9648
|
this._last = this._first ? this._last : null;
|
|
9825
9649
|
return remove2.value;
|
|
9826
9650
|
}
|
|
@@ -9878,8 +9702,7 @@
|
|
|
9878
9702
|
} else {
|
|
9879
9703
|
Animator.timeouts.push(nextTimeout);
|
|
9880
9704
|
}
|
|
9881
|
-
if (nextTimeout === lastTimeout)
|
|
9882
|
-
break;
|
|
9705
|
+
if (nextTimeout === lastTimeout) break;
|
|
9883
9706
|
}
|
|
9884
9707
|
let nextFrame = null;
|
|
9885
9708
|
const lastFrame = Animator.frames.last();
|
|
@@ -9956,8 +9779,7 @@
|
|
|
9956
9779
|
return this._continue();
|
|
9957
9780
|
}
|
|
9958
9781
|
persist(dtOrForever) {
|
|
9959
|
-
if (dtOrForever == null)
|
|
9960
|
-
return this._persist;
|
|
9782
|
+
if (dtOrForever == null) return this._persist;
|
|
9961
9783
|
this._persist = dtOrForever;
|
|
9962
9784
|
return this;
|
|
9963
9785
|
}
|
|
@@ -9967,8 +9789,7 @@
|
|
|
9967
9789
|
}
|
|
9968
9790
|
reverse(yes) {
|
|
9969
9791
|
const currentSpeed = this.speed();
|
|
9970
|
-
if (yes == null)
|
|
9971
|
-
return this.speed(-currentSpeed);
|
|
9792
|
+
if (yes == null) return this.speed(-currentSpeed);
|
|
9972
9793
|
const positive = Math.abs(currentSpeed);
|
|
9973
9794
|
return this.speed(yes ? -positive : positive);
|
|
9974
9795
|
}
|
|
@@ -10019,14 +9840,12 @@
|
|
|
10019
9840
|
return this.time(this._time + dt);
|
|
10020
9841
|
}
|
|
10021
9842
|
source(fn) {
|
|
10022
|
-
if (fn == null)
|
|
10023
|
-
return this._timeSource;
|
|
9843
|
+
if (fn == null) return this._timeSource;
|
|
10024
9844
|
this._timeSource = fn;
|
|
10025
9845
|
return this;
|
|
10026
9846
|
}
|
|
10027
9847
|
speed(speed) {
|
|
10028
|
-
if (speed == null)
|
|
10029
|
-
return this._speed;
|
|
9848
|
+
if (speed == null) return this._speed;
|
|
10030
9849
|
this._speed = speed;
|
|
10031
9850
|
return this;
|
|
10032
9851
|
}
|
|
@@ -10035,16 +9854,14 @@
|
|
|
10035
9854
|
return this.pause();
|
|
10036
9855
|
}
|
|
10037
9856
|
time(time) {
|
|
10038
|
-
if (time == null)
|
|
10039
|
-
return this._time;
|
|
9857
|
+
if (time == null) return this._time;
|
|
10040
9858
|
this._time = time;
|
|
10041
9859
|
return this._continue(true);
|
|
10042
9860
|
}
|
|
10043
9861
|
// Remove the runner from this timeline
|
|
10044
9862
|
unschedule(runner) {
|
|
10045
9863
|
const index = this._runnerIds.indexOf(runner.id);
|
|
10046
|
-
if (index < 0)
|
|
10047
|
-
return this;
|
|
9864
|
+
if (index < 0) return this;
|
|
10048
9865
|
this._runners.splice(index, 1);
|
|
10049
9866
|
this._runnerIds.splice(index, 1);
|
|
10050
9867
|
runner.timeline(null);
|
|
@@ -10061,18 +9878,15 @@
|
|
|
10061
9878
|
_continue(immediateStep = false) {
|
|
10062
9879
|
Animator.cancelFrame(this._nextFrame);
|
|
10063
9880
|
this._nextFrame = null;
|
|
10064
|
-
if (immediateStep)
|
|
10065
|
-
|
|
10066
|
-
if (this._paused)
|
|
10067
|
-
return this;
|
|
9881
|
+
if (immediateStep) return this._stepImmediate();
|
|
9882
|
+
if (this._paused) return this;
|
|
10068
9883
|
this._nextFrame = Animator.frame(this._step);
|
|
10069
9884
|
return this;
|
|
10070
9885
|
}
|
|
10071
9886
|
_stepFn(immediateStep = false) {
|
|
10072
9887
|
const time = this._timeSource();
|
|
10073
9888
|
let dtSource = time - this._lastSourceTime;
|
|
10074
|
-
if (immediateStep)
|
|
10075
|
-
dtSource = 0;
|
|
9889
|
+
if (immediateStep) dtSource = 0;
|
|
10076
9890
|
const dtTime = this._speed * dtSource + (this._time - this._lastStepTime);
|
|
10077
9891
|
this._lastSourceTime = time;
|
|
10078
9892
|
if (!immediateStep) {
|
|
@@ -10101,8 +9915,7 @@
|
|
|
10101
9915
|
} else if (dtToStart < dt) {
|
|
10102
9916
|
dt = dtToStart;
|
|
10103
9917
|
}
|
|
10104
|
-
if (!runner.active())
|
|
10105
|
-
continue;
|
|
9918
|
+
if (!runner.active()) continue;
|
|
10106
9919
|
const finished = runner.step(dt).done;
|
|
10107
9920
|
if (!finished) {
|
|
10108
9921
|
runnersLeft = true;
|
|
@@ -10191,8 +10004,7 @@
|
|
|
10191
10004
|
};
|
|
10192
10005
|
}
|
|
10193
10006
|
active(enabled) {
|
|
10194
|
-
if (enabled == null)
|
|
10195
|
-
return this.enabled;
|
|
10007
|
+
if (enabled == null) return this.enabled;
|
|
10196
10008
|
this.enabled = enabled;
|
|
10197
10009
|
return this;
|
|
10198
10010
|
}
|
|
@@ -10211,10 +10023,8 @@
|
|
|
10211
10023
|
animate(duration, delay, when) {
|
|
10212
10024
|
const o = Runner.sanitise(duration, delay, when);
|
|
10213
10025
|
const runner = new Runner(o.duration);
|
|
10214
|
-
if (this._timeline)
|
|
10215
|
-
|
|
10216
|
-
if (this._element)
|
|
10217
|
-
runner.element(this._element);
|
|
10026
|
+
if (this._timeline) runner.timeline(this._timeline);
|
|
10027
|
+
if (this._element) runner.element(this._element);
|
|
10218
10028
|
return runner.loop(o).schedule(o.delay, o.when);
|
|
10219
10029
|
}
|
|
10220
10030
|
clearTransform() {
|
|
@@ -10249,8 +10059,7 @@
|
|
|
10249
10059
|
help us make new runners from the current runner
|
|
10250
10060
|
*/
|
|
10251
10061
|
element(element) {
|
|
10252
|
-
if (element == null)
|
|
10253
|
-
return this._element;
|
|
10062
|
+
if (element == null) return this._element;
|
|
10254
10063
|
this._element = element;
|
|
10255
10064
|
element._prepareRunner();
|
|
10256
10065
|
return this;
|
|
@@ -10286,8 +10095,7 @@
|
|
|
10286
10095
|
return this.time(time);
|
|
10287
10096
|
}
|
|
10288
10097
|
persist(dtOrForever) {
|
|
10289
|
-
if (dtOrForever == null)
|
|
10290
|
-
return this._persist;
|
|
10098
|
+
if (dtOrForever == null) return this._persist;
|
|
10291
10099
|
this._persist = dtOrForever;
|
|
10292
10100
|
return this;
|
|
10293
10101
|
}
|
|
@@ -10342,8 +10150,7 @@
|
|
|
10342
10150
|
return this;
|
|
10343
10151
|
}
|
|
10344
10152
|
reset() {
|
|
10345
|
-
if (this._reseted)
|
|
10346
|
-
return this;
|
|
10153
|
+
if (this._reseted) return this;
|
|
10347
10154
|
this.time(0);
|
|
10348
10155
|
this._reseted = true;
|
|
10349
10156
|
return this;
|
|
@@ -10365,8 +10172,7 @@
|
|
|
10365
10172
|
return this;
|
|
10366
10173
|
}
|
|
10367
10174
|
step(dt) {
|
|
10368
|
-
if (!this.enabled)
|
|
10369
|
-
return this;
|
|
10175
|
+
if (!this.enabled) return this;
|
|
10370
10176
|
dt = dt == null ? 16 : dt;
|
|
10371
10177
|
this._time += dt;
|
|
10372
10178
|
const position2 = this.position();
|
|
@@ -10409,8 +10215,7 @@
|
|
|
10409
10215
|
return this;
|
|
10410
10216
|
}
|
|
10411
10217
|
timeline(timeline2) {
|
|
10412
|
-
if (typeof timeline2 === "undefined")
|
|
10413
|
-
return this._timeline;
|
|
10218
|
+
if (typeof timeline2 === "undefined") return this._timeline;
|
|
10414
10219
|
this._timeline = timeline2;
|
|
10415
10220
|
return this;
|
|
10416
10221
|
}
|
|
@@ -10421,8 +10226,7 @@
|
|
|
10421
10226
|
}
|
|
10422
10227
|
// Run each initialise function in the runner if required
|
|
10423
10228
|
_initialise(running) {
|
|
10424
|
-
if (!running && !this._isDeclarative)
|
|
10425
|
-
return;
|
|
10229
|
+
if (!running && !this._isDeclarative) return;
|
|
10426
10230
|
for (let i = 0, len = this._queue.length; i < len; ++i) {
|
|
10427
10231
|
const current = this._queue[i];
|
|
10428
10232
|
const needsIt = this._isDeclarative || !current.initialised && running;
|
|
@@ -10509,8 +10313,7 @@
|
|
|
10509
10313
|
this.ids = [];
|
|
10510
10314
|
}
|
|
10511
10315
|
add(runner) {
|
|
10512
|
-
if (this.runners.includes(runner))
|
|
10513
|
-
return;
|
|
10316
|
+
if (this.runners.includes(runner)) return;
|
|
10514
10317
|
const id = runner.id + 1;
|
|
10515
10318
|
this.runners.push(runner);
|
|
10516
10319
|
this.ids.push(id);
|
|
@@ -10592,12 +10395,12 @@
|
|
|
10592
10395
|
});
|
|
10593
10396
|
const difference = (a, b) => a.filter((x2) => !b.includes(x2));
|
|
10594
10397
|
extend(Runner, {
|
|
10595
|
-
attr(a,
|
|
10596
|
-
return this.styleAttr("attr", a,
|
|
10398
|
+
attr(a, v2) {
|
|
10399
|
+
return this.styleAttr("attr", a, v2);
|
|
10597
10400
|
},
|
|
10598
10401
|
// Add animatable styles
|
|
10599
|
-
css(s,
|
|
10600
|
-
return this.styleAttr("css", s,
|
|
10402
|
+
css(s, v2) {
|
|
10403
|
+
return this.styleAttr("css", s, v2);
|
|
10601
10404
|
},
|
|
10602
10405
|
styleAttr(type, nameOrAttrs, val) {
|
|
10603
10406
|
if (typeof nameOrAttrs === "string") {
|
|
@@ -10606,8 +10409,7 @@
|
|
|
10606
10409
|
});
|
|
10607
10410
|
}
|
|
10608
10411
|
let attrs2 = nameOrAttrs;
|
|
10609
|
-
if (this._tryRetarget(type, attrs2))
|
|
10610
|
-
return this;
|
|
10412
|
+
if (this._tryRetarget(type, attrs2)) return this;
|
|
10611
10413
|
let morpher = new Morphable(this._stepper).to(attrs2);
|
|
10612
10414
|
let keys = Object.keys(attrs2);
|
|
10613
10415
|
this.queue(function() {
|
|
@@ -10634,8 +10436,7 @@
|
|
|
10634
10436
|
return this;
|
|
10635
10437
|
},
|
|
10636
10438
|
zoom(level, point2) {
|
|
10637
|
-
if (this._tryRetarget("zoom", level, point2))
|
|
10638
|
-
return this;
|
|
10439
|
+
if (this._tryRetarget("zoom", level, point2)) return this;
|
|
10639
10440
|
let morpher = new Morphable(this._stepper).to(new SVGNumber(level));
|
|
10640
10441
|
this.queue(function() {
|
|
10641
10442
|
morpher = morpher.from(this.element().zoom());
|
|
@@ -10687,8 +10488,7 @@
|
|
|
10687
10488
|
}
|
|
10688
10489
|
}
|
|
10689
10490
|
function run(pos) {
|
|
10690
|
-
if (!relative)
|
|
10691
|
-
this.clearTransform();
|
|
10491
|
+
if (!relative) this.clearTransform();
|
|
10692
10492
|
const {
|
|
10693
10493
|
x: x2,
|
|
10694
10494
|
y: y2
|
|
@@ -10758,8 +10558,7 @@
|
|
|
10758
10558
|
},
|
|
10759
10559
|
_queueNumberDelta(method, to2) {
|
|
10760
10560
|
to2 = new SVGNumber(to2);
|
|
10761
|
-
if (this._tryRetarget(method, to2))
|
|
10762
|
-
return this;
|
|
10561
|
+
if (this._tryRetarget(method, to2)) return this;
|
|
10763
10562
|
const morpher = new Morphable(this._stepper).to(to2);
|
|
10764
10563
|
let from2 = null;
|
|
10765
10564
|
this.queue(function() {
|
|
@@ -10776,8 +10575,7 @@
|
|
|
10776
10575
|
return this;
|
|
10777
10576
|
},
|
|
10778
10577
|
_queueObject(method, to2) {
|
|
10779
|
-
if (this._tryRetarget(method, to2))
|
|
10780
|
-
return this;
|
|
10578
|
+
if (this._tryRetarget(method, to2)) return this;
|
|
10781
10579
|
const morpher = new Morphable(this._stepper).to(to2);
|
|
10782
10580
|
this.queue(function() {
|
|
10783
10581
|
morpher.from(this.element()[method]());
|
|
@@ -10834,8 +10632,7 @@
|
|
|
10834
10632
|
if (arguments.length === 4) {
|
|
10835
10633
|
return this.plot([a, b, c, d]);
|
|
10836
10634
|
}
|
|
10837
|
-
if (this._tryRetarget("plot", a))
|
|
10838
|
-
return this;
|
|
10635
|
+
if (this._tryRetarget("plot", a)) return this;
|
|
10839
10636
|
const morpher = new Morphable(this._stepper).type(this._element.MorphArray).to(a);
|
|
10840
10637
|
this.queue(function() {
|
|
10841
10638
|
morpher.from(this._element.array());
|
|
@@ -10862,12 +10659,9 @@
|
|
|
10862
10659
|
opacity: arguments[2]
|
|
10863
10660
|
});
|
|
10864
10661
|
}
|
|
10865
|
-
if (o.opacity != null)
|
|
10866
|
-
|
|
10867
|
-
if (o.
|
|
10868
|
-
this.attr("stop-color", o.color);
|
|
10869
|
-
if (o.offset != null)
|
|
10870
|
-
this.attr("offset", o.offset);
|
|
10662
|
+
if (o.opacity != null) this.attr("stop-opacity", o.opacity);
|
|
10663
|
+
if (o.color != null) this.attr("stop-color", o.color);
|
|
10664
|
+
if (o.offset != null) this.attr("offset", o.offset);
|
|
10871
10665
|
return this;
|
|
10872
10666
|
}
|
|
10873
10667
|
});
|
|
@@ -10885,8 +10679,7 @@
|
|
|
10885
10679
|
}
|
|
10886
10680
|
// Creates and returns defs element
|
|
10887
10681
|
defs() {
|
|
10888
|
-
if (!this.isRoot())
|
|
10889
|
-
return this.root().defs();
|
|
10682
|
+
if (!this.isRoot()) return this.root().defs();
|
|
10890
10683
|
return adopt(this.node.querySelector("defs")) || this.put(new Defs());
|
|
10891
10684
|
}
|
|
10892
10685
|
isRoot() {
|
|
@@ -10894,8 +10687,7 @@
|
|
|
10894
10687
|
}
|
|
10895
10688
|
// Add namespaces
|
|
10896
10689
|
namespace() {
|
|
10897
|
-
if (!this.isRoot())
|
|
10898
|
-
return this.root().namespace();
|
|
10690
|
+
if (!this.isRoot()) return this.root().namespace();
|
|
10899
10691
|
return this.attr({
|
|
10900
10692
|
xmlns: svg,
|
|
10901
10693
|
version: "1.1"
|
|
@@ -10910,8 +10702,7 @@
|
|
|
10910
10702
|
// Check if this is a root svg
|
|
10911
10703
|
// If not, call root() from this element
|
|
10912
10704
|
root() {
|
|
10913
|
-
if (this.isRoot())
|
|
10914
|
-
return this;
|
|
10705
|
+
if (this.isRoot()) return this;
|
|
10915
10706
|
return super.root();
|
|
10916
10707
|
}
|
|
10917
10708
|
}
|
|
@@ -11062,8 +10853,7 @@
|
|
|
11062
10853
|
text = "";
|
|
11063
10854
|
for (let i = 0, len = children.length; i < len; ++i) {
|
|
11064
10855
|
if (children[i].nodeName === "textPath") {
|
|
11065
|
-
if (i === 0)
|
|
11066
|
-
firstLine = 1;
|
|
10856
|
+
if (i === 0) firstLine = 1;
|
|
11067
10857
|
continue;
|
|
11068
10858
|
}
|
|
11069
10859
|
if (i !== firstLine && children[i].nodeType !== 3 && adopt(children[i]).dom.newLined === true) {
|
|
@@ -11127,8 +10917,7 @@
|
|
|
11127
10917
|
}
|
|
11128
10918
|
// Set text content
|
|
11129
10919
|
text(text) {
|
|
11130
|
-
if (text == null)
|
|
11131
|
-
return this.node.textContent + (this.dom.newLined ? "\n" : "");
|
|
10920
|
+
if (text == null) return this.node.textContent + (this.dom.newLined ? "\n" : "");
|
|
11132
10921
|
if (typeof text === "function") {
|
|
11133
10922
|
this.clear().build(true);
|
|
11134
10923
|
text.call(this, this);
|
|
@@ -11252,8 +11041,8 @@
|
|
|
11252
11041
|
} catch (e) {
|
|
11253
11042
|
return;
|
|
11254
11043
|
}
|
|
11255
|
-
const
|
|
11256
|
-
const matrix =
|
|
11044
|
+
const m2 = new Matrix(child);
|
|
11045
|
+
const matrix = m2.translate(dx2, dy2).transform(m2.inverse());
|
|
11257
11046
|
const p = new Point(bbox2.x, bbox2.y).transform(matrix);
|
|
11258
11047
|
child.move(p.x, p.y);
|
|
11259
11048
|
});
|
|
@@ -11266,8 +11055,7 @@
|
|
|
11266
11055
|
return this.dmove(0, dy2);
|
|
11267
11056
|
}
|
|
11268
11057
|
function height(height2, box = this.bbox()) {
|
|
11269
|
-
if (height2 == null)
|
|
11270
|
-
return box.height;
|
|
11058
|
+
if (height2 == null) return box.height;
|
|
11271
11059
|
return this.size(box.width, height2, box);
|
|
11272
11060
|
}
|
|
11273
11061
|
function move(x2 = 0, y2 = 0, box = this.bbox()) {
|
|
@@ -11286,18 +11074,15 @@
|
|
|
11286
11074
|
return this;
|
|
11287
11075
|
}
|
|
11288
11076
|
function width(width2, box = this.bbox()) {
|
|
11289
|
-
if (width2 == null)
|
|
11290
|
-
return box.width;
|
|
11077
|
+
if (width2 == null) return box.width;
|
|
11291
11078
|
return this.size(width2, box.height, box);
|
|
11292
11079
|
}
|
|
11293
11080
|
function x(x2, box = this.bbox()) {
|
|
11294
|
-
if (x2 == null)
|
|
11295
|
-
return box.x;
|
|
11081
|
+
if (x2 == null) return box.x;
|
|
11296
11082
|
return this.move(x2, box.y, box);
|
|
11297
11083
|
}
|
|
11298
11084
|
function y(y2, box = this.bbox()) {
|
|
11299
|
-
if (y2 == null)
|
|
11300
|
-
return box.y;
|
|
11085
|
+
if (y2 == null) return box.y;
|
|
11301
11086
|
return this.move(box.x, y2, box);
|
|
11302
11087
|
}
|
|
11303
11088
|
var containerGeometry = {
|
|
@@ -11351,8 +11136,7 @@
|
|
|
11351
11136
|
Element: {
|
|
11352
11137
|
unlink() {
|
|
11353
11138
|
const link = this.linker();
|
|
11354
|
-
if (!link)
|
|
11355
|
-
return this;
|
|
11139
|
+
if (!link) return this;
|
|
11356
11140
|
const parent = link.parent();
|
|
11357
11141
|
if (!parent) {
|
|
11358
11142
|
return this.remove();
|
|
@@ -11436,12 +11220,9 @@
|
|
|
11436
11220
|
opacity: arguments[2]
|
|
11437
11221
|
};
|
|
11438
11222
|
}
|
|
11439
|
-
if (o.opacity != null)
|
|
11440
|
-
|
|
11441
|
-
if (o.
|
|
11442
|
-
this.attr("stop-color", o.color);
|
|
11443
|
-
if (o.offset != null)
|
|
11444
|
-
this.attr("offset", new SVGNumber(o.offset));
|
|
11223
|
+
if (o.opacity != null) this.attr("stop-opacity", o.opacity);
|
|
11224
|
+
if (o.color != null) this.attr("stop-color", o.color);
|
|
11225
|
+
if (o.offset != null) this.attr("offset", new SVGNumber(o.offset));
|
|
11445
11226
|
return this;
|
|
11446
11227
|
}
|
|
11447
11228
|
}
|
|
@@ -11455,10 +11236,8 @@
|
|
|
11455
11236
|
});
|
|
11456
11237
|
register(Stop, "Stop");
|
|
11457
11238
|
function cssRule(selector, rule) {
|
|
11458
|
-
if (!selector)
|
|
11459
|
-
|
|
11460
|
-
if (!rule)
|
|
11461
|
-
return selector;
|
|
11239
|
+
if (!selector) return "";
|
|
11240
|
+
if (!rule) return selector;
|
|
11462
11241
|
let ret = selector + "{";
|
|
11463
11242
|
for (const i in rule) {
|
|
11464
11243
|
ret += unCamelCase(i) + ":" + rule[i] + ";";
|
|
@@ -11622,16 +11401,12 @@
|
|
|
11622
11401
|
x: x2,
|
|
11623
11402
|
y: y2
|
|
11624
11403
|
} = this.attr(["width", "height", "rx", "ry", "x", "y"]);
|
|
11625
|
-
if (rx2 < 0)
|
|
11626
|
-
|
|
11627
|
-
if (ry2 < 0)
|
|
11628
|
-
ry2 = 0;
|
|
11404
|
+
if (rx2 < 0) rx2 = 0;
|
|
11405
|
+
if (ry2 < 0) ry2 = 0;
|
|
11629
11406
|
rx2 = rx2 || ry2;
|
|
11630
11407
|
ry2 = ry2 || rx2;
|
|
11631
|
-
if (rx2 > w / 2)
|
|
11632
|
-
|
|
11633
|
-
if (ry2 > h / 2)
|
|
11634
|
-
ry2 = h / 2;
|
|
11408
|
+
if (rx2 > w / 2) rx2 = w / 2;
|
|
11409
|
+
if (ry2 > h / 2) ry2 = h / 2;
|
|
11635
11410
|
if (rx2 && ry2) {
|
|
11636
11411
|
d = [
|
|
11637
11412
|
["M", rx2 + x2, y2],
|
|
@@ -11795,8 +11570,7 @@
|
|
|
11795
11570
|
}
|
|
11796
11571
|
function mergeOptions(target, source) {
|
|
11797
11572
|
for (const key of Object.keys(source)) {
|
|
11798
|
-
if (source[key] instanceof Object)
|
|
11799
|
-
Object.assign(source[key], mergeOptions(target[key], source[key]));
|
|
11573
|
+
if (source[key] instanceof Object) Object.assign(source[key], mergeOptions(target[key], source[key]));
|
|
11800
11574
|
}
|
|
11801
11575
|
Object.assign(target || {}, source);
|
|
11802
11576
|
return target;
|
|
@@ -11981,7 +11755,7 @@
|
|
|
11981
11755
|
}
|
|
11982
11756
|
async draw(svg2, viewmap) {
|
|
11983
11757
|
const chains = viewmap.chains.filter((c) => c.visibility === ChainVisibility.Visible);
|
|
11984
|
-
const meshes = Array.from(viewmap.meshes).filter((
|
|
11758
|
+
const meshes = Array.from(viewmap.meshes).filter((m2) => m2.drawVisibleContours);
|
|
11985
11759
|
const group = new G({ id: "visible-contours" });
|
|
11986
11760
|
drawChains(group, meshes, chains, this.options);
|
|
11987
11761
|
svg2.add(group);
|
|
@@ -12004,7 +11778,7 @@
|
|
|
12004
11778
|
const chains = viewmap.chains.filter(
|
|
12005
11779
|
(c) => c.visibility === ChainVisibility.Hidden
|
|
12006
11780
|
);
|
|
12007
|
-
const meshes = Array.from(viewmap.meshes).filter((
|
|
11781
|
+
const meshes = Array.from(viewmap.meshes).filter((m2) => m2.drawHiddenContours);
|
|
12008
11782
|
const group = new G({ id: "hidden-contours" });
|
|
12009
11783
|
svg2.add(group);
|
|
12010
11784
|
drawChains(group, meshes, chains, this.options);
|
|
@@ -12092,7 +11866,7 @@
|
|
|
12092
11866
|
const det = _matrix.determinant();
|
|
12093
11867
|
if (det > EPSILON) {
|
|
12094
11868
|
return 1;
|
|
12095
|
-
} else if (det < -
|
|
11869
|
+
} else if (det < -1e-10) {
|
|
12096
11870
|
return -1;
|
|
12097
11871
|
}
|
|
12098
11872
|
return 0;
|
|
@@ -12526,10 +12300,10 @@
|
|
|
12526
12300
|
}
|
|
12527
12301
|
}
|
|
12528
12302
|
}
|
|
12529
|
-
const
|
|
12530
|
-
|
|
12531
|
-
struct.vertices.push(
|
|
12532
|
-
return
|
|
12303
|
+
const v2 = new Vertex();
|
|
12304
|
+
v2.position.copy(position2);
|
|
12305
|
+
struct.vertices.push(v2);
|
|
12306
|
+
return v2;
|
|
12533
12307
|
}
|
|
12534
12308
|
function removeFace(struct, face) {
|
|
12535
12309
|
if (!struct.faces.remove(face)) {
|
|
@@ -12720,8 +12494,7 @@
|
|
|
12720
12494
|
}
|
|
12721
12495
|
const hash1 = i1 + "-" + i2;
|
|
12722
12496
|
let h1 = halfedgeMap.get(hash1);
|
|
12723
|
-
if (h1 == null ? void 0 : h1.face)
|
|
12724
|
-
h1 = void 0;
|
|
12497
|
+
if (h1 == null ? void 0 : h1.face) h1 = void 0;
|
|
12725
12498
|
if (!h1) {
|
|
12726
12499
|
try {
|
|
12727
12500
|
h1 = struct.addEdge(v1, v2);
|
|
@@ -12733,14 +12506,11 @@
|
|
|
12733
12506
|
} catch (e) {
|
|
12734
12507
|
}
|
|
12735
12508
|
}
|
|
12736
|
-
if (h1)
|
|
12737
|
-
|
|
12738
|
-
else
|
|
12739
|
-
break;
|
|
12509
|
+
if (h1) loopHalfedges.push(h1);
|
|
12510
|
+
else break;
|
|
12740
12511
|
}
|
|
12741
12512
|
try {
|
|
12742
|
-
if (loopHalfedges.length < 3)
|
|
12743
|
-
throw "need 3 for face";
|
|
12513
|
+
if (loopHalfedges.length < 3) throw "need 3 for face";
|
|
12744
12514
|
struct.addFace(loopHalfedges);
|
|
12745
12515
|
} catch (e) {
|
|
12746
12516
|
}
|
|
@@ -13013,38 +12783,26 @@
|
|
|
13013
12783
|
const hx = triangleBounds[i + 1];
|
|
13014
12784
|
const lx = cx2 - hx;
|
|
13015
12785
|
const rx2 = cx2 + hx;
|
|
13016
|
-
if (lx < minx)
|
|
13017
|
-
|
|
13018
|
-
if (
|
|
13019
|
-
|
|
13020
|
-
if (cx2 < cminx)
|
|
13021
|
-
cminx = cx2;
|
|
13022
|
-
if (cx2 > cmaxx)
|
|
13023
|
-
cmaxx = cx2;
|
|
12786
|
+
if (lx < minx) minx = lx;
|
|
12787
|
+
if (rx2 > maxx) maxx = rx2;
|
|
12788
|
+
if (cx2 < cminx) cminx = cx2;
|
|
12789
|
+
if (cx2 > cmaxx) cmaxx = cx2;
|
|
13024
12790
|
const cy2 = triangleBounds[i + 2];
|
|
13025
12791
|
const hy = triangleBounds[i + 3];
|
|
13026
12792
|
const ly = cy2 - hy;
|
|
13027
12793
|
const ry2 = cy2 + hy;
|
|
13028
|
-
if (ly < miny)
|
|
13029
|
-
|
|
13030
|
-
if (
|
|
13031
|
-
|
|
13032
|
-
if (cy2 < cminy)
|
|
13033
|
-
cminy = cy2;
|
|
13034
|
-
if (cy2 > cmaxy)
|
|
13035
|
-
cmaxy = cy2;
|
|
12794
|
+
if (ly < miny) miny = ly;
|
|
12795
|
+
if (ry2 > maxy) maxy = ry2;
|
|
12796
|
+
if (cy2 < cminy) cminy = cy2;
|
|
12797
|
+
if (cy2 > cmaxy) cmaxy = cy2;
|
|
13036
12798
|
const cz = triangleBounds[i + 4];
|
|
13037
12799
|
const hz = triangleBounds[i + 5];
|
|
13038
12800
|
const lz = cz - hz;
|
|
13039
12801
|
const rz = cz + hz;
|
|
13040
|
-
if (lz < minz)
|
|
13041
|
-
|
|
13042
|
-
if (
|
|
13043
|
-
|
|
13044
|
-
if (cz < cminz)
|
|
13045
|
-
cminz = cz;
|
|
13046
|
-
if (cz > cmaxz)
|
|
13047
|
-
cmaxz = cz;
|
|
12802
|
+
if (lz < minz) minz = lz;
|
|
12803
|
+
if (rz > maxz) maxz = rz;
|
|
12804
|
+
if (cz < cminz) cminz = cz;
|
|
12805
|
+
if (cz > cmaxz) cmaxz = cz;
|
|
13048
12806
|
}
|
|
13049
12807
|
target[0] = minx;
|
|
13050
12808
|
target[1] = miny;
|
|
@@ -13109,15 +12867,11 @@
|
|
|
13109
12867
|
c = posArr[ci + el];
|
|
13110
12868
|
}
|
|
13111
12869
|
let min = a;
|
|
13112
|
-
if (b < min)
|
|
13113
|
-
|
|
13114
|
-
if (c < min)
|
|
13115
|
-
min = c;
|
|
12870
|
+
if (b < min) min = b;
|
|
12871
|
+
if (c < min) min = c;
|
|
13116
12872
|
let max = a;
|
|
13117
|
-
if (b > max)
|
|
13118
|
-
|
|
13119
|
-
if (c > max)
|
|
13120
|
-
max = c;
|
|
12873
|
+
if (b > max) max = b;
|
|
12874
|
+
if (c > max) max = c;
|
|
13121
12875
|
const halfExtents = (max - min) / 2;
|
|
13122
12876
|
const el2 = el * 2;
|
|
13123
12877
|
triangleBounds[tri6 + el2 + 0] = min + halfExtents;
|
|
@@ -13297,8 +13051,7 @@
|
|
|
13297
13051
|
const triCenter = triangleBounds[c + 2 * a];
|
|
13298
13052
|
const relativeCenter = triCenter - axisLeft;
|
|
13299
13053
|
let binIndex = ~~(relativeCenter / binWidth);
|
|
13300
|
-
if (binIndex >= BIN_COUNT)
|
|
13301
|
-
binIndex = BIN_COUNT - 1;
|
|
13054
|
+
if (binIndex >= BIN_COUNT) binIndex = BIN_COUNT - 1;
|
|
13302
13055
|
const bin = sahBins[binIndex];
|
|
13303
13056
|
bin.count++;
|
|
13304
13057
|
expandByTriangleBounds(c, triangleBounds, bin.bounds);
|
|
@@ -13754,25 +13507,21 @@
|
|
|
13754
13507
|
lineTemp.start = a;
|
|
13755
13508
|
lineTemp.end = b;
|
|
13756
13509
|
const closestPoint1 = lineTemp.closestPointToPoint(center2, true, closestPointTemp);
|
|
13757
|
-
if (closestPoint1.distanceTo(center2) <= radius)
|
|
13758
|
-
return true;
|
|
13510
|
+
if (closestPoint1.distanceTo(center2) <= radius) return true;
|
|
13759
13511
|
lineTemp.start = a;
|
|
13760
13512
|
lineTemp.end = c;
|
|
13761
13513
|
const closestPoint2 = lineTemp.closestPointToPoint(center2, true, closestPointTemp);
|
|
13762
|
-
if (closestPoint2.distanceTo(center2) <= radius)
|
|
13763
|
-
return true;
|
|
13514
|
+
if (closestPoint2.distanceTo(center2) <= radius) return true;
|
|
13764
13515
|
lineTemp.start = b;
|
|
13765
13516
|
lineTemp.end = c;
|
|
13766
13517
|
const closestPoint3 = lineTemp.closestPointToPoint(center2, true, closestPointTemp);
|
|
13767
|
-
if (closestPoint3.distanceTo(center2) <= radius)
|
|
13768
|
-
return true;
|
|
13518
|
+
if (closestPoint3.distanceTo(center2) <= radius) return true;
|
|
13769
13519
|
const plane = triangle3.getPlane(planeTemp);
|
|
13770
13520
|
const dp = Math.abs(plane.distanceToPoint(center2));
|
|
13771
13521
|
if (dp <= radius) {
|
|
13772
13522
|
const pp = plane.projectPoint(center2, projectedPointTemp);
|
|
13773
13523
|
const cp = triangle3.containsPoint(pp);
|
|
13774
|
-
if (cp)
|
|
13775
|
-
return true;
|
|
13524
|
+
if (cp) return true;
|
|
13776
13525
|
}
|
|
13777
13526
|
return false;
|
|
13778
13527
|
};
|
|
@@ -13840,29 +13589,23 @@
|
|
|
13840
13589
|
distSq = point1.distanceToSquared(point2);
|
|
13841
13590
|
if (distSq < closestDistanceSq) {
|
|
13842
13591
|
closestDistanceSq = distSq;
|
|
13843
|
-
if (target1)
|
|
13844
|
-
|
|
13845
|
-
if (target2)
|
|
13846
|
-
target2.copy(point2);
|
|
13592
|
+
if (target1) target1.copy(point1);
|
|
13593
|
+
if (target2) target2.copy(point2);
|
|
13847
13594
|
}
|
|
13848
13595
|
}
|
|
13849
13596
|
this.closestPointToPoint(start, point1);
|
|
13850
13597
|
distSq = start.distanceToSquared(point1);
|
|
13851
13598
|
if (distSq < closestDistanceSq) {
|
|
13852
13599
|
closestDistanceSq = distSq;
|
|
13853
|
-
if (target1)
|
|
13854
|
-
|
|
13855
|
-
if (target2)
|
|
13856
|
-
target2.copy(start);
|
|
13600
|
+
if (target1) target1.copy(point1);
|
|
13601
|
+
if (target2) target2.copy(start);
|
|
13857
13602
|
}
|
|
13858
13603
|
this.closestPointToPoint(end, point1);
|
|
13859
13604
|
distSq = end.distanceToSquared(point1);
|
|
13860
13605
|
if (distSq < closestDistanceSq) {
|
|
13861
13606
|
closestDistanceSq = distSq;
|
|
13862
|
-
if (target1)
|
|
13863
|
-
|
|
13864
|
-
if (target2)
|
|
13865
|
-
target2.copy(end);
|
|
13607
|
+
if (target1) target1.copy(point1);
|
|
13608
|
+
if (target2) target2.copy(end);
|
|
13866
13609
|
}
|
|
13867
13610
|
return Math.sqrt(closestDistanceSq);
|
|
13868
13611
|
};
|
|
@@ -13945,8 +13688,7 @@
|
|
|
13945
13688
|
const sb = satBounds1[i];
|
|
13946
13689
|
const sa = satAxes1[i];
|
|
13947
13690
|
cachedSatBounds.setFromPoints(sa, arr2);
|
|
13948
|
-
if (sb.isSeparated(cachedSatBounds))
|
|
13949
|
-
return false;
|
|
13691
|
+
if (sb.isSeparated(cachedSatBounds)) return false;
|
|
13950
13692
|
}
|
|
13951
13693
|
const satBounds2 = other.satBounds;
|
|
13952
13694
|
const satAxes2 = other.satAxes;
|
|
@@ -13957,8 +13699,7 @@
|
|
|
13957
13699
|
const sb = satBounds2[i];
|
|
13958
13700
|
const sa = satAxes2[i];
|
|
13959
13701
|
cachedSatBounds.setFromPoints(sa, arr1);
|
|
13960
|
-
if (sb.isSeparated(cachedSatBounds))
|
|
13961
|
-
return false;
|
|
13702
|
+
if (sb.isSeparated(cachedSatBounds)) return false;
|
|
13962
13703
|
}
|
|
13963
13704
|
for (let i = 0; i < 4; i++) {
|
|
13964
13705
|
const sa1 = satAxes1[i];
|
|
@@ -13967,8 +13708,7 @@
|
|
|
13967
13708
|
cachedAxis.crossVectors(sa1, sa2);
|
|
13968
13709
|
cachedSatBounds.setFromPoints(cachedAxis, arr1);
|
|
13969
13710
|
cachedSatBounds2.setFromPoints(cachedAxis, arr2);
|
|
13970
|
-
if (cachedSatBounds.isSeparated(cachedSatBounds2))
|
|
13971
|
-
return false;
|
|
13711
|
+
if (cachedSatBounds.isSeparated(cachedSatBounds2)) return false;
|
|
13972
13712
|
}
|
|
13973
13713
|
}
|
|
13974
13714
|
if (target) {
|
|
@@ -14051,10 +13791,8 @@
|
|
|
14051
13791
|
const lineTarget = target1 || target2 ? line1 : null;
|
|
14052
13792
|
if (this.intersectsTriangle(other, lineTarget)) {
|
|
14053
13793
|
if (target1 || target2) {
|
|
14054
|
-
if (target1)
|
|
14055
|
-
|
|
14056
|
-
if (target2)
|
|
14057
|
-
lineTarget.getCenter(target2);
|
|
13794
|
+
if (target1) lineTarget.getCenter(target1);
|
|
13795
|
+
if (target2) lineTarget.getCenter(target2);
|
|
14058
13796
|
}
|
|
14059
13797
|
return 0;
|
|
14060
13798
|
}
|
|
@@ -14067,20 +13805,16 @@
|
|
|
14067
13805
|
dist = otherVec.distanceToSquared(point2);
|
|
14068
13806
|
if (dist < closestDistanceSq) {
|
|
14069
13807
|
closestDistanceSq = dist;
|
|
14070
|
-
if (target1)
|
|
14071
|
-
|
|
14072
|
-
if (target2)
|
|
14073
|
-
target2.copy(otherVec);
|
|
13808
|
+
if (target1) target1.copy(point2);
|
|
13809
|
+
if (target2) target2.copy(otherVec);
|
|
14074
13810
|
}
|
|
14075
13811
|
const thisVec = this[field];
|
|
14076
13812
|
other.closestPointToPoint(thisVec, point2);
|
|
14077
13813
|
dist = thisVec.distanceToSquared(point2);
|
|
14078
13814
|
if (dist < closestDistanceSq) {
|
|
14079
13815
|
closestDistanceSq = dist;
|
|
14080
|
-
if (target1)
|
|
14081
|
-
|
|
14082
|
-
if (target2)
|
|
14083
|
-
target2.copy(point2);
|
|
13816
|
+
if (target1) target1.copy(thisVec);
|
|
13817
|
+
if (target2) target2.copy(point2);
|
|
14084
13818
|
}
|
|
14085
13819
|
}
|
|
14086
13820
|
for (let i = 0; i < 3; i++) {
|
|
@@ -14095,10 +13829,8 @@
|
|
|
14095
13829
|
const dist = point2.distanceToSquared(point22);
|
|
14096
13830
|
if (dist < closestDistanceSq) {
|
|
14097
13831
|
closestDistanceSq = dist;
|
|
14098
|
-
if (target1)
|
|
14099
|
-
|
|
14100
|
-
if (target2)
|
|
14101
|
-
target2.copy(point22);
|
|
13832
|
+
if (target1) target1.copy(point2);
|
|
13833
|
+
if (target2) target2.copy(point22);
|
|
14102
13834
|
}
|
|
14103
13835
|
}
|
|
14104
13836
|
}
|
|
@@ -14117,12 +13849,9 @@
|
|
|
14117
13849
|
this.satBounds = new Array(3).fill().map(() => new SeparatingAxisBounds());
|
|
14118
13850
|
this.alignedSatBounds = new Array(3).fill().map(() => new SeparatingAxisBounds());
|
|
14119
13851
|
this.needsUpdate = false;
|
|
14120
|
-
if (min)
|
|
14121
|
-
|
|
14122
|
-
if (
|
|
14123
|
-
this.max.copy(max);
|
|
14124
|
-
if (matrix)
|
|
14125
|
-
this.matrix.copy(matrix);
|
|
13852
|
+
if (min) this.min.copy(min);
|
|
13853
|
+
if (max) this.max.copy(max);
|
|
13854
|
+
if (matrix) this.matrix.copy(matrix);
|
|
14126
13855
|
}
|
|
14127
13856
|
set(min, max, matrix) {
|
|
14128
13857
|
this.min.copy(min);
|
|
@@ -14147,11 +13876,11 @@
|
|
|
14147
13876
|
for (let y2 = 0; y2 <= 1; y2++) {
|
|
14148
13877
|
for (let z = 0; z <= 1; z++) {
|
|
14149
13878
|
const i = (1 << 0) * x2 | (1 << 1) * y2 | (1 << 2) * z;
|
|
14150
|
-
const
|
|
14151
|
-
|
|
14152
|
-
|
|
14153
|
-
|
|
14154
|
-
|
|
13879
|
+
const v2 = points[i];
|
|
13880
|
+
v2.x = x2 ? max.x : min.x;
|
|
13881
|
+
v2.y = y2 ? max.y : min.y;
|
|
13882
|
+
v2.z = z ? max.z : min.z;
|
|
13883
|
+
v2.applyMatrix4(matrix);
|
|
14155
13884
|
}
|
|
14156
13885
|
}
|
|
14157
13886
|
}
|
|
@@ -14187,22 +13916,18 @@
|
|
|
14187
13916
|
const alignedSatBounds = this.alignedSatBounds;
|
|
14188
13917
|
aabbBounds.min = min.x;
|
|
14189
13918
|
aabbBounds.max = max.x;
|
|
14190
|
-
if (alignedSatBounds[0].isSeparated(aabbBounds))
|
|
14191
|
-
return false;
|
|
13919
|
+
if (alignedSatBounds[0].isSeparated(aabbBounds)) return false;
|
|
14192
13920
|
aabbBounds.min = min.y;
|
|
14193
13921
|
aabbBounds.max = max.y;
|
|
14194
|
-
if (alignedSatBounds[1].isSeparated(aabbBounds))
|
|
14195
|
-
return false;
|
|
13922
|
+
if (alignedSatBounds[1].isSeparated(aabbBounds)) return false;
|
|
14196
13923
|
aabbBounds.min = min.z;
|
|
14197
13924
|
aabbBounds.max = max.z;
|
|
14198
|
-
if (alignedSatBounds[2].isSeparated(aabbBounds))
|
|
14199
|
-
return false;
|
|
13925
|
+
if (alignedSatBounds[2].isSeparated(aabbBounds)) return false;
|
|
14200
13926
|
for (let i = 0; i < 3; i++) {
|
|
14201
13927
|
const axis = satAxes[i];
|
|
14202
13928
|
const sb = satBounds[i];
|
|
14203
13929
|
aabbBounds.setFromBox(axis, box);
|
|
14204
|
-
if (sb.isSeparated(aabbBounds))
|
|
14205
|
-
return false;
|
|
13930
|
+
if (sb.isSeparated(aabbBounds)) return false;
|
|
14206
13931
|
}
|
|
14207
13932
|
return true;
|
|
14208
13933
|
};
|
|
@@ -14233,8 +13958,7 @@
|
|
|
14233
13958
|
const sb = satBounds[i];
|
|
14234
13959
|
const sa = satAxes[i];
|
|
14235
13960
|
cachedSatBounds.setFromPoints(sa, pointsArr);
|
|
14236
|
-
if (sb.isSeparated(cachedSatBounds))
|
|
14237
|
-
return false;
|
|
13961
|
+
if (sb.isSeparated(cachedSatBounds)) return false;
|
|
14238
13962
|
}
|
|
14239
13963
|
const triSatBounds = triangle3.satBounds;
|
|
14240
13964
|
const triSatAxes = triangle3.satAxes;
|
|
@@ -14243,8 +13967,7 @@
|
|
|
14243
13967
|
const sb = triSatBounds[i];
|
|
14244
13968
|
const sa = triSatAxes[i];
|
|
14245
13969
|
cachedSatBounds.setFromPoints(sa, points);
|
|
14246
|
-
if (sb.isSeparated(cachedSatBounds))
|
|
14247
|
-
return false;
|
|
13970
|
+
if (sb.isSeparated(cachedSatBounds)) return false;
|
|
14248
13971
|
}
|
|
14249
13972
|
for (let i = 0; i < 3; i++) {
|
|
14250
13973
|
const sa1 = satAxes[i];
|
|
@@ -14253,8 +13976,7 @@
|
|
|
14253
13976
|
cachedAxis.crossVectors(sa1, sa2);
|
|
14254
13977
|
cachedSatBounds.setFromPoints(cachedAxis, pointsArr);
|
|
14255
13978
|
cachedSatBounds2.setFromPoints(cachedAxis, points);
|
|
14256
|
-
if (cachedSatBounds.isSeparated(cachedSatBounds2))
|
|
14257
|
-
return false;
|
|
13979
|
+
if (cachedSatBounds.isSeparated(cachedSatBounds2)) return false;
|
|
14258
13980
|
}
|
|
14259
13981
|
}
|
|
14260
13982
|
return true;
|
|
@@ -14291,10 +14013,8 @@
|
|
|
14291
14013
|
box.getCenter(point2);
|
|
14292
14014
|
this.closestPointToPoint(point2, point1);
|
|
14293
14015
|
box.closestPointToPoint(point1, point2);
|
|
14294
|
-
if (target1)
|
|
14295
|
-
|
|
14296
|
-
if (target2)
|
|
14297
|
-
target2.copy(point2);
|
|
14016
|
+
if (target1) target1.copy(point1);
|
|
14017
|
+
if (target2) target2.copy(point2);
|
|
14298
14018
|
}
|
|
14299
14019
|
return 0;
|
|
14300
14020
|
}
|
|
@@ -14309,12 +14029,9 @@
|
|
|
14309
14029
|
const dist = p.distanceToSquared(point2);
|
|
14310
14030
|
if (dist < closestDistanceSq) {
|
|
14311
14031
|
closestDistanceSq = dist;
|
|
14312
|
-
if (target1)
|
|
14313
|
-
|
|
14314
|
-
if (
|
|
14315
|
-
target2.copy(point2);
|
|
14316
|
-
if (dist < threshold2)
|
|
14317
|
-
return Math.sqrt(dist);
|
|
14032
|
+
if (target1) target1.copy(p);
|
|
14033
|
+
if (target2) target2.copy(point2);
|
|
14034
|
+
if (dist < threshold2) return Math.sqrt(dist);
|
|
14318
14035
|
}
|
|
14319
14036
|
}
|
|
14320
14037
|
let count = 0;
|
|
@@ -14355,12 +14072,9 @@
|
|
|
14355
14072
|
const dist = point2.distanceToSquared(point1);
|
|
14356
14073
|
if (dist < closestDistanceSq) {
|
|
14357
14074
|
closestDistanceSq = dist;
|
|
14358
|
-
if (target1)
|
|
14359
|
-
|
|
14360
|
-
if (
|
|
14361
|
-
target2.copy(point2);
|
|
14362
|
-
if (dist < threshold2)
|
|
14363
|
-
return Math.sqrt(dist);
|
|
14075
|
+
if (target1) target1.copy(point1);
|
|
14076
|
+
if (target2) target2.copy(point2);
|
|
14077
|
+
if (dist < threshold2) return Math.sqrt(dist);
|
|
14364
14078
|
}
|
|
14365
14079
|
}
|
|
14366
14080
|
}
|
|
@@ -14373,12 +14087,9 @@
|
|
|
14373
14087
|
const dist = point1.distanceToSquared(point2);
|
|
14374
14088
|
if (dist < closestDistanceSq) {
|
|
14375
14089
|
closestDistanceSq = dist;
|
|
14376
|
-
if (target1)
|
|
14377
|
-
|
|
14378
|
-
if (
|
|
14379
|
-
target2.copy(point2);
|
|
14380
|
-
if (dist < threshold2)
|
|
14381
|
-
return Math.sqrt(dist);
|
|
14090
|
+
if (target1) target1.copy(point1);
|
|
14091
|
+
if (target2) target2.copy(point2);
|
|
14092
|
+
if (dist < threshold2) return Math.sqrt(dist);
|
|
14382
14093
|
}
|
|
14383
14094
|
}
|
|
14384
14095
|
}
|
|
@@ -14529,8 +14240,7 @@
|
|
|
14529
14240
|
depth + 1
|
|
14530
14241
|
);
|
|
14531
14242
|
}
|
|
14532
|
-
if (c1StopTraversal)
|
|
14533
|
-
return true;
|
|
14243
|
+
if (c1StopTraversal) return true;
|
|
14534
14244
|
box2 = _box2;
|
|
14535
14245
|
arrayToBox(BOUNDING_DATA_INDEX(c2), float32Array2, box2);
|
|
14536
14246
|
const isC2Leaf = IS_LEAF(c2 * 2, uint16Array2);
|
|
@@ -14552,8 +14262,7 @@
|
|
|
14552
14262
|
depth + 1
|
|
14553
14263
|
);
|
|
14554
14264
|
}
|
|
14555
|
-
if (c2StopTraversal)
|
|
14556
|
-
return true;
|
|
14265
|
+
if (c2StopTraversal) return true;
|
|
14557
14266
|
return false;
|
|
14558
14267
|
}
|
|
14559
14268
|
}
|
|
@@ -14589,13 +14298,10 @@
|
|
|
14589
14298
|
}
|
|
14590
14299
|
}
|
|
14591
14300
|
);
|
|
14592
|
-
if (closestDistanceSq === Infinity)
|
|
14593
|
-
return null;
|
|
14301
|
+
if (closestDistanceSq === Infinity) return null;
|
|
14594
14302
|
const closestDistance = Math.sqrt(closestDistanceSq);
|
|
14595
|
-
if (!target.point)
|
|
14596
|
-
|
|
14597
|
-
else
|
|
14598
|
-
target.point.copy(temp1$2);
|
|
14303
|
+
if (!target.point) target.point = temp1$2.clone();
|
|
14304
|
+
else target.point.copy(temp1$2);
|
|
14599
14305
|
target.distance = closestDistance, target.faceIndex = closestDistanceTriIndex;
|
|
14600
14306
|
return target;
|
|
14601
14307
|
}
|
|
@@ -14616,8 +14322,7 @@
|
|
|
14616
14322
|
} else {
|
|
14617
14323
|
intersect = ray2.intersectTriangle(pA, pB, pC, side !== threepipe.DoubleSide, point2);
|
|
14618
14324
|
}
|
|
14619
|
-
if (intersect === null)
|
|
14620
|
-
return null;
|
|
14325
|
+
if (intersect === null) return null;
|
|
14621
14326
|
const distance = ray2.origin.distanceTo(point2);
|
|
14622
14327
|
return {
|
|
14623
14328
|
distance,
|
|
@@ -14679,8 +14384,7 @@
|
|
|
14679
14384
|
const intersection = checkBufferGeometryIntersection(ray2, position2, normal, uv, uv1, a, b, c, side);
|
|
14680
14385
|
if (intersection) {
|
|
14681
14386
|
intersection.faceIndex = tri;
|
|
14682
|
-
if (intersections)
|
|
14683
|
-
intersections.push(intersection);
|
|
14387
|
+
if (intersections) intersections.push(intersection);
|
|
14684
14388
|
return intersection;
|
|
14685
14389
|
}
|
|
14686
14390
|
return null;
|
|
@@ -14777,18 +14481,12 @@
|
|
|
14777
14481
|
const x2 = posAttr.getX(index);
|
|
14778
14482
|
const y2 = posAttr.getY(index);
|
|
14779
14483
|
const z = posAttr.getZ(index);
|
|
14780
|
-
if (x2 < minx)
|
|
14781
|
-
|
|
14782
|
-
if (
|
|
14783
|
-
|
|
14784
|
-
if (
|
|
14785
|
-
|
|
14786
|
-
if (y2 > maxy)
|
|
14787
|
-
maxy = y2;
|
|
14788
|
-
if (z < minz)
|
|
14789
|
-
minz = z;
|
|
14790
|
-
if (z > maxz)
|
|
14791
|
-
maxz = z;
|
|
14484
|
+
if (x2 < minx) minx = x2;
|
|
14485
|
+
if (x2 > maxx) maxx = x2;
|
|
14486
|
+
if (y2 < miny) miny = y2;
|
|
14487
|
+
if (y2 > maxy) maxy = y2;
|
|
14488
|
+
if (z < minz) minz = z;
|
|
14489
|
+
if (z > maxz) maxz = z;
|
|
14792
14490
|
}
|
|
14793
14491
|
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) {
|
|
14794
14492
|
float32Array2[node32Index + 0] = minx;
|
|
@@ -14872,12 +14570,9 @@
|
|
|
14872
14570
|
tymin = (maxy - oy) * invdiry;
|
|
14873
14571
|
tymax = (miny - oy) * invdiry;
|
|
14874
14572
|
}
|
|
14875
|
-
if (tmin > tymax || tymin > tmax)
|
|
14876
|
-
|
|
14877
|
-
if (
|
|
14878
|
-
tmin = tymin;
|
|
14879
|
-
if (tymax < tmax || isNaN(tmax))
|
|
14880
|
-
tmax = tymax;
|
|
14573
|
+
if (tmin > tymax || tymin > tmax) return false;
|
|
14574
|
+
if (tymin > tmin || isNaN(tmin)) tmin = tymin;
|
|
14575
|
+
if (tymax < tmax || isNaN(tmax)) tmax = tymax;
|
|
14881
14576
|
if (invdirz >= 0) {
|
|
14882
14577
|
tzmin = (minz - oz) * invdirz;
|
|
14883
14578
|
tzmax = (maxz - oz) * invdirz;
|
|
@@ -14885,12 +14580,9 @@
|
|
|
14885
14580
|
tzmin = (maxz - oz) * invdirz;
|
|
14886
14581
|
tzmax = (minz - oz) * invdirz;
|
|
14887
14582
|
}
|
|
14888
|
-
if (tmin > tzmax || tzmin > tmax)
|
|
14889
|
-
|
|
14890
|
-
if (
|
|
14891
|
-
tmax = tzmax;
|
|
14892
|
-
if (tmax < 0)
|
|
14893
|
-
return false;
|
|
14583
|
+
if (tmin > tzmax || tzmin > tmax) return false;
|
|
14584
|
+
if (tzmax < tmax || tmax !== tmax) tmax = tzmax;
|
|
14585
|
+
if (tmax < 0) return false;
|
|
14894
14586
|
return true;
|
|
14895
14587
|
}
|
|
14896
14588
|
function intersectTris_indirect(bvh, side, ray2, offset, count, intersections) {
|
|
@@ -15077,12 +14769,10 @@
|
|
|
15077
14769
|
const right = uint32Array2[nodeIndex32 + 6];
|
|
15078
14770
|
arrayToBox(BOUNDING_DATA_INDEX(left), float32Array2, boundingBox$1);
|
|
15079
14771
|
const leftIntersection = cachedObb.intersectsBox(boundingBox$1) && _intersectsGeometry$1(left, bvh, otherGeometry, geometryToBvh, cachedObb);
|
|
15080
|
-
if (leftIntersection)
|
|
15081
|
-
return true;
|
|
14772
|
+
if (leftIntersection) return true;
|
|
15082
14773
|
arrayToBox(BOUNDING_DATA_INDEX(right), float32Array2, boundingBox$1);
|
|
15083
14774
|
const rightIntersection = cachedObb.intersectsBox(boundingBox$1) && _intersectsGeometry$1(right, bvh, otherGeometry, geometryToBvh, cachedObb);
|
|
15084
|
-
if (rightIntersection)
|
|
15085
|
-
return true;
|
|
14775
|
+
if (rightIntersection) return true;
|
|
15086
14776
|
return false;
|
|
15087
14777
|
}
|
|
15088
14778
|
}
|
|
@@ -15214,10 +14904,8 @@
|
|
|
15214
14904
|
}
|
|
15215
14905
|
target1.distance = closestDistance, target1.faceIndex = closestDistanceTriIndex;
|
|
15216
14906
|
if (target2) {
|
|
15217
|
-
if (!target2.point)
|
|
15218
|
-
|
|
15219
|
-
else
|
|
15220
|
-
target2.point.copy(tempTargetDest2);
|
|
14907
|
+
if (!target2.point) target2.point = tempTargetDest2.clone();
|
|
14908
|
+
else target2.point.copy(tempTargetDest2);
|
|
15221
14909
|
target2.point.applyMatrix4(tempMatrix$1);
|
|
15222
14910
|
tempTargetDest1.applyMatrix4(tempMatrix$1);
|
|
15223
14911
|
target2.distance = tempTargetDest1.sub(target2.point).length();
|
|
@@ -15263,18 +14951,12 @@
|
|
|
15263
14951
|
const x2 = posAttr.getX(index);
|
|
15264
14952
|
const y2 = posAttr.getY(index);
|
|
15265
14953
|
const z = posAttr.getZ(index);
|
|
15266
|
-
if (x2 < minx)
|
|
15267
|
-
|
|
15268
|
-
if (
|
|
15269
|
-
|
|
15270
|
-
if (
|
|
15271
|
-
|
|
15272
|
-
if (y2 > maxy)
|
|
15273
|
-
maxy = y2;
|
|
15274
|
-
if (z < minz)
|
|
15275
|
-
minz = z;
|
|
15276
|
-
if (z > maxz)
|
|
15277
|
-
maxz = z;
|
|
14954
|
+
if (x2 < minx) minx = x2;
|
|
14955
|
+
if (x2 > maxx) maxx = x2;
|
|
14956
|
+
if (y2 < miny) miny = y2;
|
|
14957
|
+
if (y2 > maxy) maxy = y2;
|
|
14958
|
+
if (z < minz) minz = z;
|
|
14959
|
+
if (z > maxz) maxz = z;
|
|
15278
14960
|
}
|
|
15279
14961
|
}
|
|
15280
14962
|
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) {
|
|
@@ -15482,12 +15164,10 @@
|
|
|
15482
15164
|
const right = uint32Array2[nodeIndex32 + 6];
|
|
15483
15165
|
arrayToBox(BOUNDING_DATA_INDEX(left), float32Array2, boundingBox);
|
|
15484
15166
|
const leftIntersection = cachedObb.intersectsBox(boundingBox) && _intersectsGeometry(left, bvh, otherGeometry, geometryToBvh, cachedObb);
|
|
15485
|
-
if (leftIntersection)
|
|
15486
|
-
return true;
|
|
15167
|
+
if (leftIntersection) return true;
|
|
15487
15168
|
arrayToBox(BOUNDING_DATA_INDEX(right), float32Array2, boundingBox);
|
|
15488
15169
|
const rightIntersection = cachedObb.intersectsBox(boundingBox) && _intersectsGeometry(right, bvh, otherGeometry, geometryToBvh, cachedObb);
|
|
15489
|
-
if (rightIntersection)
|
|
15490
|
-
return true;
|
|
15170
|
+
if (rightIntersection) return true;
|
|
15491
15171
|
return false;
|
|
15492
15172
|
}
|
|
15493
15173
|
}
|
|
@@ -15622,10 +15302,8 @@
|
|
|
15622
15302
|
}
|
|
15623
15303
|
target1.distance = closestDistance, target1.faceIndex = closestDistanceTriIndex;
|
|
15624
15304
|
if (target2) {
|
|
15625
|
-
if (!target2.point)
|
|
15626
|
-
|
|
15627
|
-
else
|
|
15628
|
-
target2.point.copy(tempTargetDest2);
|
|
15305
|
+
if (!target2.point) target2.point = tempTargetDest2.clone();
|
|
15306
|
+
else target2.point.copy(tempTargetDest2);
|
|
15629
15307
|
target2.point.applyMatrix4(tempMatrix);
|
|
15630
15308
|
tempTargetDest1.applyMatrix4(tempMatrix);
|
|
15631
15309
|
target2.distance = tempTargetDest1.sub(target2.point).length();
|
|
@@ -15643,7 +15321,12 @@
|
|
|
15643
15321
|
const _rightBox1 = new threepipe.Box3();
|
|
15644
15322
|
const _leftBox2 = new threepipe.Box3();
|
|
15645
15323
|
const _rightBox2 = new threepipe.Box3();
|
|
15324
|
+
let _active = false;
|
|
15646
15325
|
function bvhcast(bvh, otherBvh, matrixToLocal, intersectsRanges) {
|
|
15326
|
+
if (_active) {
|
|
15327
|
+
throw new Error("MeshBVH: Recursive calls to bvhcast not supported.");
|
|
15328
|
+
}
|
|
15329
|
+
_active = true;
|
|
15647
15330
|
const roots = bvh._roots;
|
|
15648
15331
|
const otherRoots = otherBvh._roots;
|
|
15649
15332
|
let result;
|
|
@@ -15683,6 +15366,7 @@
|
|
|
15683
15366
|
break;
|
|
15684
15367
|
}
|
|
15685
15368
|
}
|
|
15369
|
+
_active = false;
|
|
15686
15370
|
return result;
|
|
15687
15371
|
}
|
|
15688
15372
|
function _traverse(node1Index32, node2Index32, matrix2to1, matrix1to2, intersectsRangesFunc, node1IndexByteOffset = 0, node2IndexByteOffset = 0, depth1 = 0, depth2 = 0, currBox = null, reversed = false) {
|
|
@@ -16238,8 +15922,7 @@
|
|
|
16238
15922
|
const origMeshRaycastFunc = threepipe.Mesh.prototype.raycast;
|
|
16239
15923
|
function acceleratedRaycast(raycaster, intersects) {
|
|
16240
15924
|
if (this.geometry.boundsTree) {
|
|
16241
|
-
if (this.material === void 0)
|
|
16242
|
-
return;
|
|
15925
|
+
if (this.material === void 0) return;
|
|
16243
15926
|
tmpInverseMatrix.copy(this.matrixWorld).invert();
|
|
16244
15927
|
ray.copy(raycaster.ray).applyMatrix4(tmpInverseMatrix);
|
|
16245
15928
|
const bvh = this.geometry.boundsTree;
|
|
@@ -16437,8 +16120,7 @@
|
|
|
16437
16120
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
16438
16121
|
if (decorator = decorators[i])
|
|
16439
16122
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
16440
|
-
if (kind && result)
|
|
16441
|
-
__defProp(target, key, result);
|
|
16123
|
+
if (kind && result) __defProp(target, key, result);
|
|
16442
16124
|
return result;
|
|
16443
16125
|
};
|
|
16444
16126
|
exports2.ThreeSVGRendererPlugin = class ThreeSVGRendererPlugin extends threepipe.AViewerPluginSync {
|
|
@@ -16468,8 +16150,7 @@
|
|
|
16468
16150
|
this._rendering = false;
|
|
16469
16151
|
this._viewerListeners = {
|
|
16470
16152
|
postRender: (_) => {
|
|
16471
|
-
if (this.autoRender)
|
|
16472
|
-
this.render();
|
|
16153
|
+
if (this.autoRender) this.render();
|
|
16473
16154
|
}
|
|
16474
16155
|
};
|
|
16475
16156
|
this._onResize = this._onResize.bind(this);
|
|
@@ -16548,40 +16229,32 @@
|
|
|
16548
16229
|
viewer.scene.modelRoot.removeEventListener("objectUpdate", this.updateMeshes);
|
|
16549
16230
|
}
|
|
16550
16231
|
_onMeshDispose(ev) {
|
|
16551
|
-
if (!ev.target)
|
|
16552
|
-
return;
|
|
16232
|
+
if (!ev.target) return;
|
|
16553
16233
|
const mesh = ev.target;
|
|
16554
16234
|
const svgMesh = this._meshes.get(mesh.uuid);
|
|
16555
|
-
if (!svgMesh)
|
|
16556
|
-
return;
|
|
16235
|
+
if (!svgMesh) return;
|
|
16557
16236
|
svgMesh.dispose();
|
|
16558
16237
|
this._meshes.delete(mesh.uuid);
|
|
16559
16238
|
mesh.removeEventListener("dispose", this._onMeshDispose);
|
|
16560
16239
|
mesh.removeEventListener("objectUpdate", this._onMeshUpdate);
|
|
16561
16240
|
}
|
|
16562
16241
|
_onMeshUpdate(ev) {
|
|
16563
|
-
if (!ev.target)
|
|
16564
|
-
return;
|
|
16242
|
+
if (!ev.target) return;
|
|
16565
16243
|
const mesh = ev.target;
|
|
16566
16244
|
const svgMesh = this._meshes.get(mesh.uuid);
|
|
16567
|
-
if (!svgMesh)
|
|
16568
|
-
return;
|
|
16245
|
+
if (!svgMesh) return;
|
|
16569
16246
|
svgMesh.updateObject();
|
|
16570
16247
|
}
|
|
16571
16248
|
_refreshMeshes(root2) {
|
|
16572
|
-
if (!this.autoMakeSvgObjects)
|
|
16573
|
-
|
|
16574
|
-
if (!root2
|
|
16575
|
-
root2 = this._viewer.scene.modelRoot;
|
|
16576
|
-
if (!root2)
|
|
16577
|
-
return [];
|
|
16249
|
+
if (!this.autoMakeSvgObjects) return [];
|
|
16250
|
+
if (!root2 && this._viewer) root2 = this._viewer.scene.modelRoot;
|
|
16251
|
+
if (!root2) return [];
|
|
16578
16252
|
root2.traverse((o) => {
|
|
16579
16253
|
this.makeSVGObject(o);
|
|
16580
16254
|
});
|
|
16581
16255
|
}
|
|
16582
16256
|
makeSVGObject(o) {
|
|
16583
|
-
if (!(o.isMesh && !this._meshes.has(o.uuid)))
|
|
16584
|
-
return;
|
|
16257
|
+
if (!(o.isMesh && !this._meshes.has(o.uuid))) return;
|
|
16585
16258
|
const ud = o.userData;
|
|
16586
16259
|
o.userData = {};
|
|
16587
16260
|
const svgMesh = new SVGMesh(o);
|
|
@@ -16610,12 +16283,9 @@
|
|
|
16610
16283
|
}
|
|
16611
16284
|
}
|
|
16612
16285
|
async render() {
|
|
16613
|
-
if (!this._viewer || !this._viewer.renderEnabled)
|
|
16614
|
-
|
|
16615
|
-
if (this.
|
|
16616
|
-
return;
|
|
16617
|
-
if (this._rendering)
|
|
16618
|
-
return;
|
|
16286
|
+
if (!this._viewer || !this._viewer.renderEnabled) return;
|
|
16287
|
+
if (this.isDisabled()) return;
|
|
16288
|
+
if (this._rendering) return;
|
|
16619
16289
|
this._rendering = true;
|
|
16620
16290
|
this._refreshParams();
|
|
16621
16291
|
this._refreshMeshes();
|
|
@@ -16672,21 +16342,18 @@
|
|
|
16672
16342
|
}
|
|
16673
16343
|
get svgNode() {
|
|
16674
16344
|
var _a;
|
|
16675
|
-
if (!this.svgNodeContainer.children.length)
|
|
16676
|
-
return void 0;
|
|
16345
|
+
if (!this.svgNodeContainer.children.length) return void 0;
|
|
16677
16346
|
if (this.svgNodeContainer.children.length > 1) {
|
|
16678
16347
|
(_a = this._viewer) == null ? void 0 : _a.console.warn("ThreeSVGRenderer: Multiple svg nodes in container, should not be possible");
|
|
16679
16348
|
}
|
|
16680
16349
|
return this.svgNodeContainer.children[0];
|
|
16681
16350
|
}
|
|
16682
16351
|
_refreshParams() {
|
|
16683
|
-
if (this.isDisabled())
|
|
16684
|
-
return;
|
|
16352
|
+
if (this.isDisabled()) return;
|
|
16685
16353
|
if (this._meshesNeedsUpdate) {
|
|
16686
16354
|
this.renderer.viewmap.options.updateMeshes = true;
|
|
16687
16355
|
this._meshesNeedsUpdate = false;
|
|
16688
|
-
} else
|
|
16689
|
-
this.renderer.viewmap.options.updateMeshes = this.alwaysUpdateMeshes;
|
|
16356
|
+
} else this.renderer.viewmap.options.updateMeshes = this.alwaysUpdateMeshes;
|
|
16690
16357
|
this.renderer.viewmap.options.creaseAngle.min = this.creaseAngle.x;
|
|
16691
16358
|
this.renderer.viewmap.options.creaseAngle.max = this.creaseAngle.y;
|
|
16692
16359
|
const passes = this.renderer.drawHandler.passes;
|
|
@@ -16707,8 +16374,7 @@
|
|
|
16707
16374
|
}
|
|
16708
16375
|
}
|
|
16709
16376
|
_onResize() {
|
|
16710
|
-
if (!this._viewer)
|
|
16711
|
-
return;
|
|
16377
|
+
if (!this._viewer) return;
|
|
16712
16378
|
}
|
|
16713
16379
|
};
|
|
16714
16380
|
exports2.ThreeSVGRendererPlugin.PluginType = "ThreeSVGRendererPlugin";
|