@plurid/plurid-engine 0.0.0-13 → 0.0.0-16
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/distribution/index.es.js +268 -190
- package/distribution/index.es.js.map +1 -1
- package/distribution/index.js +266 -188
- package/distribution/index.js.map +1 -1
- package/distribution/modules/general/tree/index.d.ts +1 -2
- package/distribution/modules/interaction/mathematics/quaternion/index.d.ts +3 -4
- package/distribution/modules/interaction/mathematics/transform/general/index.d.ts +28 -0
- package/distribution/modules/interaction/mathematics/transform/matrix3d/index.d.ts +3 -4
- package/distribution/modules/planes/logic/index.d.ts +1 -3
- package/distribution/modules/planes/registrar/object.d.ts +1 -1
- package/distribution/modules/planes/registrar/utilities.d.ts +1 -1
- package/distribution/modules/space/tree/logic.d.ts +10 -3
- package/distribution/modules/space/tree/object.d.ts +1 -2
- package/package.json +17 -17
package/distribution/index.js
CHANGED
|
@@ -39,91 +39,17 @@ const resolveTheme = (theme, type) => {
|
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
const merge = (configuration, target) => {
|
|
42
|
-
|
|
43
|
-
const targetConfiguration = Object.assign(Object.assign({}, pluridData.defaultConfiguration), target);
|
|
42
|
+
const targetConfiguration = Object.assign(Object.assign({}, pluridFunctions.objects.clone(pluridData.defaultConfiguration)), pluridFunctions.objects.clone(target || {}));
|
|
44
43
|
if (!configuration) {
|
|
45
|
-
return
|
|
44
|
+
return targetConfiguration;
|
|
46
45
|
}
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return
|
|
51
|
-
}
|
|
52
|
-
return pluridFunctions.objects.getNested(targetConfiguration, path);
|
|
53
|
-
};
|
|
54
|
-
const layout = configuration && configuration.space && typeof configuration.space.layout === "object" ? configuration.space.layout : targetConfiguration.space.layout;
|
|
55
|
-
const mergedConfiguration = Object.assign(Object.assign({}, targetConfiguration), {
|
|
56
|
-
global: {
|
|
57
|
-
micro: specifiedOrDefault("global.micro", "boolean", configuration),
|
|
58
|
-
transparentUI: specifiedOrDefault("global.transparentUI", "boolean", configuration),
|
|
59
|
-
language: specifiedOrDefault("global.language", "string", configuration),
|
|
60
|
-
render: specifiedOrDefault("global.render", "string", configuration),
|
|
61
|
-
theme: {
|
|
46
|
+
const mergedConfiguration = pluridFunctions.objects.merge(targetConfiguration, configuration, {
|
|
47
|
+
"global.theme": () => {
|
|
48
|
+
var _a, _b;
|
|
49
|
+
return {
|
|
62
50
|
general: resolveTheme((_a = configuration.global) === null || _a === void 0 ? void 0 : _a.theme, "general"),
|
|
63
51
|
interaction: resolveTheme((_b = configuration.global) === null || _b === void 0 ? void 0 : _b.theme, "interaction")
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
elements: Object.assign(Object.assign({}, targetConfiguration.elements), {
|
|
67
|
-
toolbar: {
|
|
68
|
-
show: specifiedOrDefault("elements.toolbar.show", "boolean", configuration),
|
|
69
|
-
opaque: specifiedOrDefault("elements.toolbar.opaque", "boolean", configuration),
|
|
70
|
-
conceal: specifiedOrDefault("elements.toolbar.conceal", "boolean", configuration),
|
|
71
|
-
transformIcons: specifiedOrDefault("elements.toolbar.transformIcons", "boolean", configuration),
|
|
72
|
-
transformButtons: specifiedOrDefault("elements.toolbar.transformButtons", "boolean", configuration),
|
|
73
|
-
drawers: configuration.elements && configuration.elements.toolbar && configuration.elements.toolbar.drawers ? configuration.elements.toolbar.drawers : targetConfiguration.elements.toolbar.drawers,
|
|
74
|
-
toggledDrawers: configuration.elements && configuration.elements.toolbar && configuration.elements.toolbar.toggledDrawers ? configuration.elements.toolbar.toggledDrawers : targetConfiguration.elements.toolbar.toggledDrawers
|
|
75
|
-
},
|
|
76
|
-
viewcube: {
|
|
77
|
-
show: specifiedOrDefault("elements.viewcube.show", "boolean", configuration),
|
|
78
|
-
opaque: specifiedOrDefault("elements.viewcube.opaque", "boolean", configuration),
|
|
79
|
-
conceal: specifiedOrDefault("elements.viewcube.conceal", "boolean", configuration),
|
|
80
|
-
buttons: specifiedOrDefault("elements.viewcube.buttons", "boolean", configuration)
|
|
81
|
-
},
|
|
82
|
-
plane: {
|
|
83
|
-
width: specifiedOrDefault("elements.plane.width", "number", configuration),
|
|
84
|
-
opacity: specifiedOrDefault("elements.plane.opacity", "number", configuration),
|
|
85
|
-
controls: {
|
|
86
|
-
show: specifiedOrDefault("elements.plane.controls.show", "boolean", configuration),
|
|
87
|
-
pathbar: {
|
|
88
|
-
domainURL: specifiedOrDefault("elements.plane.controls.pathbar.domainURL", "boolean", configuration)
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
switch: {
|
|
93
|
-
show: (_e = (_d = (_c = configuration === null || configuration === void 0 ? void 0 : configuration.elements) === null || _c === void 0 ? void 0 : _c.switch) === null || _d === void 0 ? void 0 : _d.show) !== null && _e !== void 0 ? _e : false
|
|
94
|
-
}
|
|
95
|
-
}),
|
|
96
|
-
space: Object.assign(Object.assign({}, targetConfiguration.space), {
|
|
97
|
-
layout: layout,
|
|
98
|
-
camera: specifiedOrDefault("space.camera", "string", configuration),
|
|
99
|
-
perspective: specifiedOrDefault("space.perspective", "number", configuration),
|
|
100
|
-
opaque: specifiedOrDefault("space.opaque", "boolean", configuration),
|
|
101
|
-
fadeInTime: specifiedOrDefault("space.fadeInTime", "number", configuration),
|
|
102
|
-
center: specifiedOrDefault("space.center", "boolean", configuration),
|
|
103
|
-
transformOrigin: {
|
|
104
|
-
show: specifiedOrDefault("space.transformOrigin.show", "boolean", configuration),
|
|
105
|
-
size: specifiedOrDefault("space.transformOrigin.size", "string", configuration)
|
|
106
|
-
},
|
|
107
|
-
transformLocks: {
|
|
108
|
-
rotationX: specifiedOrDefault("space.transformLocks.rotationX", "boolean", configuration),
|
|
109
|
-
rotationY: specifiedOrDefault("space.transformLocks.rotationY", "boolean", configuration),
|
|
110
|
-
translationX: specifiedOrDefault("space.transformLocks.translationX", "boolean", configuration),
|
|
111
|
-
translationY: specifiedOrDefault("space.transformLocks.translationY", "boolean", configuration),
|
|
112
|
-
translationZ: specifiedOrDefault("space.transformLocks.translationZ", "boolean", configuration),
|
|
113
|
-
scale: specifiedOrDefault("space.transformLocks.scale", "boolean", configuration)
|
|
114
|
-
},
|
|
115
|
-
transformMode: specifiedOrDefault("space.transformMode", "string", configuration),
|
|
116
|
-
transformMultimode: specifiedOrDefault("space.transformMultimode", "boolean", configuration),
|
|
117
|
-
transformTouch: specifiedOrDefault("space.transformTouch", "string", configuration),
|
|
118
|
-
firstPerson: specifiedOrDefault("space.firstPerson", "boolean", configuration)
|
|
119
|
-
}),
|
|
120
|
-
network: {
|
|
121
|
-
host: specifiedOrDefault("network.host", "string", configuration),
|
|
122
|
-
protocol: specifiedOrDefault("network.protocol", "string", configuration)
|
|
123
|
-
},
|
|
124
|
-
development: {
|
|
125
|
-
planeDebugger: specifiedOrDefault("development.planeDebugger", "boolean", configuration),
|
|
126
|
-
spaceDebugger: specifiedOrDefault("development.spaceDebugger", "boolean", configuration)
|
|
52
|
+
};
|
|
127
53
|
}
|
|
128
54
|
});
|
|
129
55
|
return mergedConfiguration;
|
|
@@ -327,7 +253,7 @@ const cleanupPath = value => {
|
|
|
327
253
|
};
|
|
328
254
|
|
|
329
255
|
const computePlaneAddress = (plane, route, origin = "origin") => {
|
|
330
|
-
if (origin === "origin" && typeof location !== "undefined") {
|
|
256
|
+
if (origin === "origin" && typeof location !== "undefined" && location.host) {
|
|
331
257
|
origin = location.host;
|
|
332
258
|
}
|
|
333
259
|
const cleanPlane = extractPathname(plane);
|
|
@@ -703,18 +629,6 @@ const resolveRoute = (route, protocol, host) => {
|
|
|
703
629
|
};
|
|
704
630
|
};
|
|
705
631
|
|
|
706
|
-
const createTreePlane = (contextPlane, documentPlane) => {
|
|
707
|
-
const routeDivisions = pluridLinkPathDivider(contextPlane.path);
|
|
708
|
-
const treePlane = Object.assign(Object.assign({}, pluridData.defaultTreePlane), {
|
|
709
|
-
routeDivisions: routeDivisions,
|
|
710
|
-
sourceID: contextPlane.id,
|
|
711
|
-
planeID: pluridFunctions.uuid.generate(),
|
|
712
|
-
route: contextPlane.path,
|
|
713
|
-
show: true
|
|
714
|
-
});
|
|
715
|
-
return treePlane;
|
|
716
|
-
};
|
|
717
|
-
|
|
718
632
|
const updateTreePlane$1 = (tree, page) => {
|
|
719
633
|
const updatedTree = tree.map((treePlane => {
|
|
720
634
|
if (treePlane.planeID === page.planeID) {
|
|
@@ -752,7 +666,6 @@ const updateTreeByPlaneIDWithLinkCoordinates = (tree, planeID, linkCoordinates)
|
|
|
752
666
|
|
|
753
667
|
var index$i = Object.freeze({
|
|
754
668
|
__proto__: null,
|
|
755
|
-
createTreePlane: createTreePlane,
|
|
756
669
|
updateTreePlane: updateTreePlane$1,
|
|
757
670
|
updateTreeByPlaneIDWithLinkCoordinates: updateTreeByPlaneIDWithLinkCoordinates
|
|
758
671
|
});
|
|
@@ -810,10 +723,10 @@ function conjugateQuaternion(quaternion) {
|
|
|
810
723
|
return makeQuaternion(-quaternion.x, -quaternion.y, -quaternion.z, quaternion.w);
|
|
811
724
|
}
|
|
812
725
|
|
|
813
|
-
function computeQuaternionFromEulers(alpha, beta, gamma) {
|
|
814
|
-
const x = beta;
|
|
815
|
-
const y = gamma;
|
|
816
|
-
const z = alpha;
|
|
726
|
+
function computeQuaternionFromEulers(alpha, beta, gamma, radians = true) {
|
|
727
|
+
const x = radians ? beta : degToRad(beta);
|
|
728
|
+
const y = radians ? gamma : degToRad(gamma);
|
|
729
|
+
const z = radians ? alpha : degToRad(alpha);
|
|
817
730
|
const cX = Math.cos(x / 2);
|
|
818
731
|
const cY = Math.cos(y / 2);
|
|
819
732
|
const cZ = Math.cos(z / 2);
|
|
@@ -830,39 +743,29 @@ function computeQuaternionFromEulers(alpha, beta, gamma) {
|
|
|
830
743
|
function quaternionFromAxisAngle(x, y, z, angle) {
|
|
831
744
|
const q = zeroQuaternion();
|
|
832
745
|
const halfAngle = angle / 2;
|
|
833
|
-
|
|
834
|
-
q.
|
|
835
|
-
q.
|
|
746
|
+
const sine = Math.sin(halfAngle);
|
|
747
|
+
q.x = x * sine;
|
|
748
|
+
q.y = y * sine;
|
|
749
|
+
q.z = z * sine;
|
|
836
750
|
q.w = Math.cos(halfAngle);
|
|
837
751
|
return q;
|
|
838
752
|
}
|
|
839
753
|
|
|
840
754
|
function quaternionMultiply(quaternionArray) {
|
|
841
|
-
const
|
|
842
|
-
const
|
|
843
|
-
x: temporaryQuaternion.x,
|
|
844
|
-
y: temporaryQuaternion.y,
|
|
845
|
-
z: temporaryQuaternion.z,
|
|
846
|
-
w: temporaryQuaternion.w
|
|
847
|
-
};
|
|
755
|
+
const firstQuaternion = quaternionArray[0];
|
|
756
|
+
const valueQuaternion = Object.assign({}, firstQuaternion);
|
|
848
757
|
for (let i = 1; i < quaternionArray.length; i++) {
|
|
849
|
-
const
|
|
850
|
-
const
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
copyQuaternion.x = x;
|
|
861
|
-
copyQuaternion.y = y;
|
|
862
|
-
copyQuaternion.z = z;
|
|
863
|
-
copyQuaternion.w = w;
|
|
864
|
-
}
|
|
865
|
-
return copyQuaternion;
|
|
758
|
+
const nextQuaternion = quaternionArray[i];
|
|
759
|
+
const w = valueQuaternion.w * nextQuaternion.w - valueQuaternion.x * nextQuaternion.x - valueQuaternion.y * nextQuaternion.y - valueQuaternion.z * nextQuaternion.z;
|
|
760
|
+
const x = valueQuaternion.x * nextQuaternion.w + valueQuaternion.w * nextQuaternion.x + valueQuaternion.y * nextQuaternion.z - valueQuaternion.z * nextQuaternion.y;
|
|
761
|
+
const y = valueQuaternion.y * nextQuaternion.w + valueQuaternion.w * nextQuaternion.y + valueQuaternion.z * nextQuaternion.x - valueQuaternion.x * nextQuaternion.z;
|
|
762
|
+
const z = valueQuaternion.z * nextQuaternion.w + valueQuaternion.w * nextQuaternion.z + valueQuaternion.x * nextQuaternion.y - valueQuaternion.y * nextQuaternion.x;
|
|
763
|
+
valueQuaternion.x = x;
|
|
764
|
+
valueQuaternion.y = y;
|
|
765
|
+
valueQuaternion.z = z;
|
|
766
|
+
valueQuaternion.w = w;
|
|
767
|
+
}
|
|
768
|
+
return valueQuaternion;
|
|
866
769
|
}
|
|
867
770
|
|
|
868
771
|
function rotatePointViaQuaternion(pointRotate, quaternion) {
|
|
@@ -872,13 +775,8 @@ function rotatePointViaQuaternion(pointRotate, quaternion) {
|
|
|
872
775
|
z: pointRotate[2],
|
|
873
776
|
w: 0
|
|
874
777
|
};
|
|
875
|
-
const
|
|
876
|
-
return
|
|
877
|
-
x: rotatedPoint.x,
|
|
878
|
-
y: rotatedPoint.y,
|
|
879
|
-
z: rotatedPoint.z,
|
|
880
|
-
w: rotatedPoint.w
|
|
881
|
-
};
|
|
778
|
+
const rotatedPointQuaternion = quaternionMultiply([ quaternion, temporaryQuaternion, conjugateQuaternion(quaternion) ]);
|
|
779
|
+
return rotatedPointQuaternion;
|
|
882
780
|
}
|
|
883
781
|
|
|
884
782
|
function makeRotationMatrixFromQuaternion(quaternion) {
|
|
@@ -925,7 +823,7 @@ function translateMatrix$1(x, y, z) {
|
|
|
925
823
|
return [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, x, y, z, 1 ];
|
|
926
824
|
}
|
|
927
825
|
|
|
928
|
-
function scaleMatrix(s) {
|
|
826
|
+
function scaleMatrix$1(s) {
|
|
929
827
|
return [ s, 0, 0, 0, 0, s, 0, 0, 0, 0, s, 0, 0, 0, 0, 1 ];
|
|
930
828
|
}
|
|
931
829
|
|
|
@@ -998,12 +896,17 @@ var index$e = Object.freeze({
|
|
|
998
896
|
__proto__: null,
|
|
999
897
|
rotateMatrix: rotateMatrix,
|
|
1000
898
|
translateMatrix: translateMatrix$1,
|
|
1001
|
-
scaleMatrix: scaleMatrix,
|
|
899
|
+
scaleMatrix: scaleMatrix$1,
|
|
1002
900
|
multiplyMatrices: multiplyMatrices$1,
|
|
1003
901
|
multiplyArrayOfMatrices: multiplyArrayOfMatrices,
|
|
1004
902
|
matrixArrayToCSSMatrix: matrixArrayToCSSMatrix
|
|
1005
903
|
});
|
|
1006
904
|
|
|
905
|
+
const getInitialMatrix = () => {
|
|
906
|
+
const matrix = [ [ 1, 0, 0, 0 ], [ 0, 1, 0, 0 ], [ 0, 0, 1, 0 ], [ 0, 0, 0, 1 ] ];
|
|
907
|
+
return matrix;
|
|
908
|
+
};
|
|
909
|
+
|
|
1007
910
|
const multiplyMatrices = (m1, m2) => {
|
|
1008
911
|
const result = [];
|
|
1009
912
|
for (let i = 0; i < m1.length; i++) {
|
|
@@ -1019,6 +922,21 @@ const multiplyMatrices = (m1, m2) => {
|
|
|
1019
922
|
return result;
|
|
1020
923
|
};
|
|
1021
924
|
|
|
925
|
+
const multiplyMatricesArray = matrices => {
|
|
926
|
+
if (matrices.length < 2) {
|
|
927
|
+
throw new Error("invalid number of matrices");
|
|
928
|
+
}
|
|
929
|
+
const first = matrices[0];
|
|
930
|
+
let result = first;
|
|
931
|
+
for (const [index, matrix] of matrices.entries()) {
|
|
932
|
+
if (index === 0) {
|
|
933
|
+
continue;
|
|
934
|
+
}
|
|
935
|
+
result = multiplyMatrices(result, matrix);
|
|
936
|
+
}
|
|
937
|
+
return result;
|
|
938
|
+
};
|
|
939
|
+
|
|
1022
940
|
const arrayToMatrix = array => {
|
|
1023
941
|
const matrix = [];
|
|
1024
942
|
for (let i = 0; i < array.length; i += 4) {
|
|
@@ -1034,6 +952,11 @@ const arrayToMatrix = array => {
|
|
|
1034
952
|
|
|
1035
953
|
const matrixToArray = matrix => matrix.flat();
|
|
1036
954
|
|
|
955
|
+
const matrix3DToMatrix = value => {
|
|
956
|
+
const values = value.replace("matrix3d(", "").replace(")", "").split(",").map((val => parseFloat(val)));
|
|
957
|
+
return arrayToMatrix(values);
|
|
958
|
+
};
|
|
959
|
+
|
|
1037
960
|
const printMatrix = (matrix, name) => {
|
|
1038
961
|
const normalize = value => {
|
|
1039
962
|
if (value === 1 || value === 0) {
|
|
@@ -1081,16 +1004,113 @@ const translateMatrix = (x = 0, y = 0, z = 0) => {
|
|
|
1081
1004
|
return m;
|
|
1082
1005
|
};
|
|
1083
1006
|
|
|
1007
|
+
const scaleMatrix = s => [ [ s, 0, 0, 0 ], [ 0, s, 0, 0 ], [ 0, 0, s, 0 ], [ 0, 0, 0, 1 ] ];
|
|
1008
|
+
|
|
1009
|
+
function rotationMatrixFromQuaternion(quaternion) {
|
|
1010
|
+
const num = quaternion.x * 2;
|
|
1011
|
+
const num2 = quaternion.y * 2;
|
|
1012
|
+
const num3 = quaternion.z * 2;
|
|
1013
|
+
const num4 = quaternion.x * num;
|
|
1014
|
+
const num5 = quaternion.y * num2;
|
|
1015
|
+
const num6 = quaternion.z * num3;
|
|
1016
|
+
const num7 = quaternion.x * num2;
|
|
1017
|
+
const num8 = quaternion.x * num3;
|
|
1018
|
+
const num9 = quaternion.y * num3;
|
|
1019
|
+
const num10 = quaternion.w * num;
|
|
1020
|
+
const num11 = quaternion.w * num2;
|
|
1021
|
+
const num12 = quaternion.w * num3;
|
|
1022
|
+
return [ [ 1 - (num5 + num6), num7 - num12, num8 + num11, 0 ], [ num7 + num12, 1 - (num4 + num6), num9 - num10, 0 ], [ num8 - num11, num9 + num10, 1 - (num4 + num5), 0 ], [ 0, 0, 0, 1 ] ];
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
const matrixToCSSMatrix = matrix => {
|
|
1026
|
+
const value = matrix.flat().join(",");
|
|
1027
|
+
return `matrix3d(${value})`;
|
|
1028
|
+
};
|
|
1029
|
+
|
|
1030
|
+
const identityMatrix = () => {
|
|
1031
|
+
const matrix = [ [ 1, 0, 0, 0 ], [ 0, 1, 0, 0 ], [ 0, 0, 1, 0 ], [ 0, 0, 0, 1 ] ];
|
|
1032
|
+
return matrix;
|
|
1033
|
+
};
|
|
1034
|
+
|
|
1035
|
+
const inverseMatrix = matrix => {
|
|
1036
|
+
const cols = 4;
|
|
1037
|
+
const rows = 4;
|
|
1038
|
+
const A = [ ...matrix ];
|
|
1039
|
+
const B = identityMatrix();
|
|
1040
|
+
let r;
|
|
1041
|
+
let s;
|
|
1042
|
+
let f;
|
|
1043
|
+
let temp;
|
|
1044
|
+
for (let c = 0; c < cols; c++) {
|
|
1045
|
+
let ABig = Math.abs(A[c][c]);
|
|
1046
|
+
let rBig = c;
|
|
1047
|
+
r = c + 1;
|
|
1048
|
+
while (r < rows) {
|
|
1049
|
+
if (Math.abs(A[r][c]) > ABig) {
|
|
1050
|
+
ABig = Math.abs(A[r][c]);
|
|
1051
|
+
rBig = r;
|
|
1052
|
+
}
|
|
1053
|
+
r++;
|
|
1054
|
+
}
|
|
1055
|
+
if (ABig === 0) {
|
|
1056
|
+
throw Error("Cannot calculate inverse, determinant is zero");
|
|
1057
|
+
}
|
|
1058
|
+
r = rBig;
|
|
1059
|
+
if (r !== c) {
|
|
1060
|
+
temp = A[c];
|
|
1061
|
+
A[c] = A[r];
|
|
1062
|
+
A[r] = temp;
|
|
1063
|
+
temp = B[c];
|
|
1064
|
+
B[c] = B[r];
|
|
1065
|
+
B[r] = temp;
|
|
1066
|
+
}
|
|
1067
|
+
const Ac = A[c];
|
|
1068
|
+
const Bc = B[c];
|
|
1069
|
+
for (r = 0; r < rows; r++) {
|
|
1070
|
+
const Ar = A[r];
|
|
1071
|
+
const Br = B[r];
|
|
1072
|
+
if (r !== c) {
|
|
1073
|
+
if (Ar[c] !== 0) {
|
|
1074
|
+
f = -Ar[c] / Ac[c];
|
|
1075
|
+
for (s = c; s < cols; s++) {
|
|
1076
|
+
Ar[s] = Ar[s] + f * Ac[s];
|
|
1077
|
+
}
|
|
1078
|
+
for (s = 0; s < cols; s++) {
|
|
1079
|
+
Br[s] = Br[s] + f * Bc[s];
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
} else {
|
|
1083
|
+
f = Ac[c];
|
|
1084
|
+
for (s = c; s < cols; s++) {
|
|
1085
|
+
Ar[s] = Ar[s] / f;
|
|
1086
|
+
}
|
|
1087
|
+
for (s = 0; s < cols; s++) {
|
|
1088
|
+
Br[s] = Br[s] / f;
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1093
|
+
return B;
|
|
1094
|
+
};
|
|
1095
|
+
|
|
1084
1096
|
var index$d = Object.freeze({
|
|
1085
1097
|
__proto__: null,
|
|
1098
|
+
getInitialMatrix: getInitialMatrix,
|
|
1086
1099
|
multiplyMatrices: multiplyMatrices,
|
|
1100
|
+
multiplyMatricesArray: multiplyMatricesArray,
|
|
1087
1101
|
arrayToMatrix: arrayToMatrix,
|
|
1088
1102
|
matrixToArray: matrixToArray,
|
|
1103
|
+
matrix3DToMatrix: matrix3DToMatrix,
|
|
1089
1104
|
printMatrix: printMatrix,
|
|
1090
1105
|
rotateXMatrix: rotateXMatrix,
|
|
1091
1106
|
rotateYMatrix: rotateYMatrix,
|
|
1092
1107
|
rotateZMatrix: rotateZMatrix,
|
|
1093
|
-
translateMatrix: translateMatrix
|
|
1108
|
+
translateMatrix: translateMatrix,
|
|
1109
|
+
scaleMatrix: scaleMatrix,
|
|
1110
|
+
rotationMatrixFromQuaternion: rotationMatrixFromQuaternion,
|
|
1111
|
+
matrixToCSSMatrix: matrixToCSSMatrix,
|
|
1112
|
+
identityMatrix: identityMatrix,
|
|
1113
|
+
inverseMatrix: inverseMatrix
|
|
1094
1114
|
});
|
|
1095
1115
|
|
|
1096
1116
|
function getMatrixValues(matrix3d) {
|
|
@@ -1223,7 +1243,7 @@ function rotatePlurid(matrix3d, direction = "", angleIncrement = .07) {
|
|
|
1223
1243
|
const scale = getTransformScale(matrix3d).scale;
|
|
1224
1244
|
let valRotationMatrix = rotateMatrix(rotateX, rotateY, rotateZ);
|
|
1225
1245
|
const valTranslationMatrix = translateMatrix$1(translateX, translateY, translateZ);
|
|
1226
|
-
const valScalationMatrix = scaleMatrix(scale);
|
|
1246
|
+
const valScalationMatrix = scaleMatrix$1(scale);
|
|
1227
1247
|
if (direction === "left") {
|
|
1228
1248
|
rotateY -= angleIncrement;
|
|
1229
1249
|
valRotationMatrix = rotateMatrix(rotateX, rotateY);
|
|
@@ -1256,7 +1276,7 @@ function translatePlurid(matrix3d, direction = "", linearIncrement = 50) {
|
|
|
1256
1276
|
const scale = getTransformScale(matrix3d).scale;
|
|
1257
1277
|
const valRotationMatrix = rotateMatrix(rotateX, rotateY, rotateZ);
|
|
1258
1278
|
let valTranslationMatrix = translateMatrix$1(translateX, translateY, translateZ);
|
|
1259
|
-
const valScalationMatrix = scaleMatrix(scale);
|
|
1279
|
+
const valScalationMatrix = scaleMatrix$1(scale);
|
|
1260
1280
|
scale < .5 ? linearIncrement = 50 : linearIncrement = 30;
|
|
1261
1281
|
if (direction === "left") {
|
|
1262
1282
|
translateX += linearIncrement;
|
|
@@ -1290,20 +1310,20 @@ function scalePlurid(matrix3d, direction = "", scaleIncrement = .05) {
|
|
|
1290
1310
|
let scale = getTransformScale(matrix3d).scale;
|
|
1291
1311
|
const valRotationMatrix = rotateMatrix(rotateX, rotateY, rotateZ);
|
|
1292
1312
|
const valTranslationMatrix = translateMatrix$1(translateX, translateY, translateZ);
|
|
1293
|
-
let valScalationMatrix = scaleMatrix(scale);
|
|
1313
|
+
let valScalationMatrix = scaleMatrix$1(scale);
|
|
1294
1314
|
if (direction === "up") {
|
|
1295
1315
|
scale -= scaleIncrement;
|
|
1296
1316
|
if (scale < .1) {
|
|
1297
1317
|
scale = .1;
|
|
1298
1318
|
}
|
|
1299
|
-
valScalationMatrix = scaleMatrix(scale);
|
|
1319
|
+
valScalationMatrix = scaleMatrix$1(scale);
|
|
1300
1320
|
}
|
|
1301
1321
|
if (direction === "down") {
|
|
1302
1322
|
scale += scaleIncrement;
|
|
1303
1323
|
if (scale > 4) {
|
|
1304
1324
|
scale = 4;
|
|
1305
1325
|
}
|
|
1306
|
-
valScalationMatrix = scaleMatrix(scale);
|
|
1326
|
+
valScalationMatrix = scaleMatrix$1(scale);
|
|
1307
1327
|
}
|
|
1308
1328
|
const transformedMatrix3d = setTransform(valRotationMatrix, valTranslationMatrix, valScalationMatrix);
|
|
1309
1329
|
return transformedMatrix3d;
|
|
@@ -1362,26 +1382,6 @@ const resolvePluridRoutePlaneData = plane => {
|
|
|
1362
1382
|
return plane;
|
|
1363
1383
|
};
|
|
1364
1384
|
|
|
1365
|
-
const createInternalStatePlane = plane => {
|
|
1366
|
-
const planeData = resolvePluridPlaneData(plane);
|
|
1367
|
-
const statePlane = {
|
|
1368
|
-
id: pluridFunctions.uuid.generate(),
|
|
1369
|
-
path: planeData.route
|
|
1370
|
-
};
|
|
1371
|
-
return statePlane;
|
|
1372
|
-
};
|
|
1373
|
-
|
|
1374
|
-
const createInternalContextPlane = plane => {
|
|
1375
|
-
const planeData = resolvePluridPlaneData(plane);
|
|
1376
|
-
const {route: route, component: component} = planeData;
|
|
1377
|
-
const contextPlane = {
|
|
1378
|
-
id: pluridFunctions.uuid.generate(),
|
|
1379
|
-
path: route,
|
|
1380
|
-
component: component
|
|
1381
|
-
};
|
|
1382
|
-
return contextPlane;
|
|
1383
|
-
};
|
|
1384
|
-
|
|
1385
1385
|
const getPluridPlaneIDByData = element => {
|
|
1386
1386
|
if (!element) {
|
|
1387
1387
|
return "";
|
|
@@ -1399,7 +1399,7 @@ class IsoMatcher {
|
|
|
1399
1399
|
this.planesIndex = new Map;
|
|
1400
1400
|
this.routesKeys = [];
|
|
1401
1401
|
this.planesKeys = [];
|
|
1402
|
-
if (origin === "origin" && typeof location !== "undefined") {
|
|
1402
|
+
if (origin === "origin" && typeof location !== "undefined" && location.host) {
|
|
1403
1403
|
this.origin = location.host;
|
|
1404
1404
|
} else {
|
|
1405
1405
|
this.origin = origin;
|
|
@@ -1678,10 +1678,10 @@ var index$9 = Object.freeze({
|
|
|
1678
1678
|
});
|
|
1679
1679
|
|
|
1680
1680
|
class PluridPlanesRegistrar {
|
|
1681
|
-
constructor(planes) {
|
|
1681
|
+
constructor(planes, origin = "origin") {
|
|
1682
1682
|
this.isoMatcher = new IsoMatcher({
|
|
1683
1683
|
planes: planes
|
|
1684
|
-
});
|
|
1684
|
+
}, origin);
|
|
1685
1685
|
}
|
|
1686
1686
|
register(planes) {
|
|
1687
1687
|
this.isoMatcher.index({
|
|
@@ -1732,7 +1732,7 @@ class PluridPlanesRegistrar {
|
|
|
1732
1732
|
}
|
|
1733
1733
|
}
|
|
1734
1734
|
|
|
1735
|
-
const registerPlanes = (planes, planesRegistrar) => {
|
|
1735
|
+
const registerPlanes = (planes, planesRegistrar, origin = "origin") => {
|
|
1736
1736
|
if (!planes) {
|
|
1737
1737
|
return;
|
|
1738
1738
|
}
|
|
@@ -1744,7 +1744,7 @@ const registerPlanes = (planes, planesRegistrar) => {
|
|
|
1744
1744
|
return;
|
|
1745
1745
|
}
|
|
1746
1746
|
if (typeof window.__pluridPlanesRegistrar__ === "undefined") {
|
|
1747
|
-
const pluridPlanesRegistrar = new PluridPlanesRegistrar;
|
|
1747
|
+
const pluridPlanesRegistrar = new PluridPlanesRegistrar([], origin);
|
|
1748
1748
|
window.__pluridPlanesRegistrar__ = pluridPlanesRegistrar;
|
|
1749
1749
|
window.__pluridPlanesRegistrar__.register(planes);
|
|
1750
1750
|
return;
|
|
@@ -1793,8 +1793,6 @@ var index$8 = Object.freeze({
|
|
|
1793
1793
|
__proto__: null,
|
|
1794
1794
|
resolvePluridPlaneData: resolvePluridPlaneData,
|
|
1795
1795
|
resolvePluridRoutePlaneData: resolvePluridRoutePlaneData,
|
|
1796
|
-
createInternalStatePlane: createInternalStatePlane,
|
|
1797
|
-
createInternalContextPlane: createInternalContextPlane,
|
|
1798
1796
|
getPluridPlaneIDByData: getPluridPlaneIDByData,
|
|
1799
1797
|
registerPlanes: registerPlanes,
|
|
1800
1798
|
getPlanesRegistrar: getPlanesRegistrar,
|
|
@@ -2139,7 +2137,7 @@ const resolveViewItem = (planes, view, configuration, origin = "origin") => {
|
|
|
2139
2137
|
}
|
|
2140
2138
|
const isoMatcher = new IsoMatcher({
|
|
2141
2139
|
planes: pluridPlanes
|
|
2142
|
-
});
|
|
2140
|
+
}, origin);
|
|
2143
2141
|
const match = isoMatcher.match(viewData);
|
|
2144
2142
|
if (match) {
|
|
2145
2143
|
const route = match.match.value;
|
|
@@ -2290,14 +2288,14 @@ const assignPagesFromView = (planes, view) => {
|
|
|
2290
2288
|
return tree;
|
|
2291
2289
|
};
|
|
2292
2290
|
|
|
2293
|
-
const updateTreePlane = (tree,
|
|
2291
|
+
const updateTreePlane = (tree, updatedPlane) => {
|
|
2294
2292
|
const updatedTree = tree.map((treePlane => {
|
|
2295
|
-
if (treePlane.planeID ===
|
|
2296
|
-
return
|
|
2293
|
+
if (treePlane.planeID === updatedPlane.planeID) {
|
|
2294
|
+
return updatedPlane;
|
|
2297
2295
|
}
|
|
2298
2296
|
if (treePlane.children) {
|
|
2299
|
-
const
|
|
2300
|
-
treePlane.children =
|
|
2297
|
+
const children = updateTreePlane(treePlane.children, updatedPlane);
|
|
2298
|
+
treePlane.children = children;
|
|
2301
2299
|
return treePlane;
|
|
2302
2300
|
}
|
|
2303
2301
|
return treePlane;
|
|
@@ -2305,7 +2303,7 @@ const updateTreePlane = (tree, updatedPage) => {
|
|
|
2305
2303
|
return updatedTree;
|
|
2306
2304
|
};
|
|
2307
2305
|
|
|
2308
|
-
const updateTreeWithNewPlane = (planeRoute, parentPlaneID, linkCoordinates, tree, planesRegistry, configuration) => {
|
|
2306
|
+
const updateTreeWithNewPlane = (planeRoute, parentPlaneID, linkCoordinates, tree, planesRegistry, configuration, hostname = "origin") => {
|
|
2309
2307
|
const parentPlane = getTreePlaneByPlaneID(tree, parentPlaneID);
|
|
2310
2308
|
if (!parentPlane) {
|
|
2311
2309
|
return {
|
|
@@ -2314,7 +2312,7 @@ const updateTreeWithNewPlane = (planeRoute, parentPlaneID, linkCoordinates, tree
|
|
|
2314
2312
|
};
|
|
2315
2313
|
}
|
|
2316
2314
|
const location = computePluridPlaneLocation(linkCoordinates, parentPlane);
|
|
2317
|
-
const treePlane = resolveViewItem(planesRegistry, planeRoute, configuration);
|
|
2315
|
+
const treePlane = resolveViewItem(planesRegistry, planeRoute, configuration, hostname);
|
|
2318
2316
|
if (!treePlane) {
|
|
2319
2317
|
return {
|
|
2320
2318
|
pluridPlaneID: "",
|
|
@@ -2348,6 +2346,24 @@ const updateTreeWithNewPlane = (planeRoute, parentPlaneID, linkCoordinates, tree
|
|
|
2348
2346
|
};
|
|
2349
2347
|
};
|
|
2350
2348
|
|
|
2349
|
+
const updatePlaneLocation = (tree, parentPlaneID, planeID, linkCoordinates) => {
|
|
2350
|
+
const parentPlane = getTreePlaneByPlaneID(tree, parentPlaneID);
|
|
2351
|
+
const plane = getTreePlaneByPlaneID(tree, planeID);
|
|
2352
|
+
if (!parentPlane || !plane) {
|
|
2353
|
+
return tree;
|
|
2354
|
+
}
|
|
2355
|
+
const location = computePluridPlaneLocation(linkCoordinates, parentPlane);
|
|
2356
|
+
plane.location = {
|
|
2357
|
+
translateX: location.x,
|
|
2358
|
+
translateY: location.y,
|
|
2359
|
+
translateZ: location.z,
|
|
2360
|
+
rotateX: 0,
|
|
2361
|
+
rotateY: parentPlane.location.rotateY + pluridData.PLANE_DEFAULT_ANGLE
|
|
2362
|
+
};
|
|
2363
|
+
const updatedTree = updateTreePlane(tree, plane);
|
|
2364
|
+
return updatedTree;
|
|
2365
|
+
};
|
|
2366
|
+
|
|
2351
2367
|
const updateTreeWithNewPage = (tree, treePageParentPlaneID, pagePath, pageID, linkCoordinates, parameters) => {
|
|
2352
2368
|
const treePageParent = getTreePlaneByPlaneID(tree, treePageParentPlaneID);
|
|
2353
2369
|
if (treePageParent) {
|
|
@@ -2462,21 +2478,35 @@ const toggleChildren = children => {
|
|
|
2462
2478
|
return updatedChildren;
|
|
2463
2479
|
};
|
|
2464
2480
|
|
|
2465
|
-
const
|
|
2481
|
+
const toggleAllChildren = (tree, show) => {
|
|
2482
|
+
for (const plane of tree) {
|
|
2483
|
+
if (plane.children) {
|
|
2484
|
+
plane.children = toggleAllChildren(plane.children, show);
|
|
2485
|
+
}
|
|
2486
|
+
plane.show = show;
|
|
2487
|
+
}
|
|
2488
|
+
return tree;
|
|
2489
|
+
};
|
|
2490
|
+
|
|
2491
|
+
const togglePlaneFromTree = (tree, pluridPlaneID, forceShow) => {
|
|
2466
2492
|
const updatedTree = [];
|
|
2467
2493
|
let updatedPlane;
|
|
2468
2494
|
for (const plane of tree) {
|
|
2469
2495
|
if (plane.planeID === pluridPlaneID) {
|
|
2496
|
+
const show = forceShow !== null && forceShow !== void 0 ? forceShow : !plane.show;
|
|
2470
2497
|
const treeUpdatedPlane = Object.assign(Object.assign({}, plane), {
|
|
2471
|
-
show:
|
|
2472
|
-
children: []
|
|
2498
|
+
show: show
|
|
2473
2499
|
});
|
|
2500
|
+
if (treeUpdatedPlane.children) {
|
|
2501
|
+
const children = toggleAllChildren(treeUpdatedPlane.children, show);
|
|
2502
|
+
treeUpdatedPlane.children = children;
|
|
2503
|
+
}
|
|
2474
2504
|
updatedTree.push(treeUpdatedPlane);
|
|
2475
2505
|
updatedPlane = Object.assign({}, treeUpdatedPlane);
|
|
2476
2506
|
continue;
|
|
2477
2507
|
}
|
|
2478
2508
|
if (plane.children) {
|
|
2479
|
-
const {updatedTree: childrenUpdatedTree, updatedPlane: childrenUpdatedPlane} = togglePlaneFromTree(plane.children, pluridPlaneID);
|
|
2509
|
+
const {updatedTree: childrenUpdatedTree, updatedPlane: childrenUpdatedPlane} = togglePlaneFromTree(plane.children, pluridPlaneID, forceShow);
|
|
2480
2510
|
plane.children = [ ...childrenUpdatedTree ];
|
|
2481
2511
|
updatedTree.push(plane);
|
|
2482
2512
|
if (childrenUpdatedPlane) {
|
|
@@ -2492,6 +2522,46 @@ const togglePlaneFromTree = (tree, pluridPlaneID) => {
|
|
|
2492
2522
|
};
|
|
2493
2523
|
};
|
|
2494
2524
|
|
|
2525
|
+
const getTreePlaneByID = (stateTree, id) => {
|
|
2526
|
+
if (!id) {
|
|
2527
|
+
return;
|
|
2528
|
+
}
|
|
2529
|
+
for (const plane of stateTree) {
|
|
2530
|
+
if (plane.planeID === id) {
|
|
2531
|
+
return plane;
|
|
2532
|
+
}
|
|
2533
|
+
if (plane.children) {
|
|
2534
|
+
const found = getTreePlaneByID(plane.children, id);
|
|
2535
|
+
if (found) {
|
|
2536
|
+
return found;
|
|
2537
|
+
}
|
|
2538
|
+
}
|
|
2539
|
+
}
|
|
2540
|
+
return;
|
|
2541
|
+
};
|
|
2542
|
+
|
|
2543
|
+
const removeRootFromTree = (tree, pluridPlaneID) => {
|
|
2544
|
+
const updatedTree = tree.filter((plane => plane.planeID !== pluridPlaneID));
|
|
2545
|
+
return {
|
|
2546
|
+
updatedTree: updatedTree
|
|
2547
|
+
};
|
|
2548
|
+
};
|
|
2549
|
+
|
|
2550
|
+
const removePlaneFromTree = (tree, pluridPlaneID) => {
|
|
2551
|
+
const updatedTree = [];
|
|
2552
|
+
for (const plane of tree) {
|
|
2553
|
+
if (plane.planeID === pluridPlaneID) {
|
|
2554
|
+
continue;
|
|
2555
|
+
}
|
|
2556
|
+
if (plane.children) {
|
|
2557
|
+
const children = removePlaneFromTree(plane.children, pluridPlaneID);
|
|
2558
|
+
plane.children = children;
|
|
2559
|
+
}
|
|
2560
|
+
updatedTree.push(plane);
|
|
2561
|
+
}
|
|
2562
|
+
return updatedTree;
|
|
2563
|
+
};
|
|
2564
|
+
|
|
2495
2565
|
var logic = Object.freeze({
|
|
2496
2566
|
__proto__: null,
|
|
2497
2567
|
resolveViewItem: resolveViewItem,
|
|
@@ -2501,10 +2571,15 @@ var logic = Object.freeze({
|
|
|
2501
2571
|
assignPagesFromView: assignPagesFromView,
|
|
2502
2572
|
updateTreePlane: updateTreePlane,
|
|
2503
2573
|
updateTreeWithNewPlane: updateTreeWithNewPlane,
|
|
2574
|
+
updatePlaneLocation: updatePlaneLocation,
|
|
2504
2575
|
updateTreeWithNewPage: updateTreeWithNewPage,
|
|
2505
2576
|
removePageFromTree: removePageFromTree,
|
|
2506
2577
|
toggleChildren: toggleChildren,
|
|
2507
|
-
|
|
2578
|
+
toggleAllChildren: toggleAllChildren,
|
|
2579
|
+
togglePlaneFromTree: togglePlaneFromTree,
|
|
2580
|
+
getTreePlaneByID: getTreePlaneByID,
|
|
2581
|
+
removeRootFromTree: removeRootFromTree,
|
|
2582
|
+
removePlaneFromTree: removePlaneFromTree
|
|
2508
2583
|
});
|
|
2509
2584
|
|
|
2510
2585
|
class Tree {
|
|
@@ -2590,7 +2665,7 @@ const resolveSpace = (view, configuration, planesRegistrar, currentState, localS
|
|
|
2590
2665
|
view: view
|
|
2591
2666
|
}, hostname);
|
|
2592
2667
|
const computedTree = spaceTree.compute();
|
|
2593
|
-
const stateSpace = Object.assign(Object.assign(Object.assign(Object.assign(
|
|
2668
|
+
const stateSpace = Object.assign(Object.assign(Object.assign(Object.assign({
|
|
2594
2669
|
loading: true,
|
|
2595
2670
|
animatedTransform: false,
|
|
2596
2671
|
transformTime: 450,
|
|
@@ -2620,12 +2695,10 @@ const resolveSpace = (view, configuration, planesRegistrar, currentState, localS
|
|
|
2620
2695
|
z: 0
|
|
2621
2696
|
}
|
|
2622
2697
|
},
|
|
2623
|
-
culledView: []
|
|
2624
|
-
}, precomputedState === null || precomputedState === void 0 ? void 0 : precomputedState.space), contextState === null || contextState === void 0 ? void 0 : contextState.space), localState === null || localState === void 0 ? void 0 : localState.space), currentState === null || currentState === void 0 ? void 0 : currentState.space), {
|
|
2698
|
+
culledView: [],
|
|
2625
2699
|
view: view,
|
|
2626
|
-
initialTree: computedTree,
|
|
2627
2700
|
tree: computedTree
|
|
2628
|
-
});
|
|
2701
|
+
}, precomputedState === null || precomputedState === void 0 ? void 0 : precomputedState.space), contextState === null || contextState === void 0 ? void 0 : contextState.space), localState === null || localState === void 0 ? void 0 : localState.space), currentState === null || currentState === void 0 ? void 0 : currentState.space);
|
|
2629
2702
|
if (currentState) {
|
|
2630
2703
|
stateSpace.translationX = currentState.space.translationX;
|
|
2631
2704
|
stateSpace.translationY = currentState.space.translationY;
|
|
@@ -2674,8 +2747,13 @@ const resolveThemes = (configuration, precomputedState) => {
|
|
|
2674
2747
|
};
|
|
2675
2748
|
|
|
2676
2749
|
const compute = (view, configuration, planesRegistrar, currentState, localState, precomputedState, contextState, hostname = "origin") => {
|
|
2677
|
-
|
|
2678
|
-
const
|
|
2750
|
+
let stateConfiguration = merge(configuration);
|
|
2751
|
+
const configurations = [ precomputedState === null || precomputedState === void 0 ? void 0 : precomputedState.configuration, contextState === null || contextState === void 0 ? void 0 : contextState.configuration, localState === null || localState === void 0 ? void 0 : localState.configuration, currentState === null || currentState === void 0 ? void 0 : currentState.configuration ];
|
|
2752
|
+
for (const configuration of configurations) {
|
|
2753
|
+
if (configuration) {
|
|
2754
|
+
stateConfiguration = merge(configuration);
|
|
2755
|
+
}
|
|
2756
|
+
}
|
|
2679
2757
|
const stateSpace = resolveSpace(view, stateConfiguration, planesRegistrar, currentState, localState, precomputedState, contextState, hostname);
|
|
2680
2758
|
const stateThemes = resolveThemes(stateConfiguration, precomputedState);
|
|
2681
2759
|
const state = {
|