@plurid/plurid-engine 0.0.0-15 → 0.0.0-18
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 +1204 -1180
- package/distribution/index.es.js.map +1 -1
- package/distribution/index.js +1205 -1181
- package/distribution/index.js.map +1 -1
- package/distribution/modules/space/tree/logic.d.ts +2 -2
- package/distribution/modules/space/tree/object.d.ts +3 -0
- package/package.json +14 -14
package/distribution/index.js
CHANGED
|
@@ -60,1337 +60,1337 @@ var index$k = Object.freeze({
|
|
|
60
60
|
merge: merge
|
|
61
61
|
});
|
|
62
62
|
|
|
63
|
-
const
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
63
|
+
const extractPathname = location => {
|
|
64
|
+
const queryIndex = location.indexOf("?");
|
|
65
|
+
const noQueryPath = queryIndex === -1 ? location : location.substring(0, queryIndex);
|
|
66
|
+
const fragmentIndex = noQueryPath.indexOf("#:~:");
|
|
67
|
+
const noFragmentPath = fragmentIndex === -1 ? noQueryPath : noQueryPath.substring(0, fragmentIndex);
|
|
68
|
+
return noFragmentPath;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const extractParametersAndMatch = (location, route) => {
|
|
72
|
+
const routeElements = splitPath(route);
|
|
73
|
+
const parameters = [];
|
|
74
|
+
routeElements.forEach((routeElement => {
|
|
75
|
+
if (routeElement[0] === ":") {
|
|
76
|
+
parameters.push(routeElement);
|
|
77
|
+
} else {
|
|
78
|
+
parameters.push("");
|
|
72
79
|
}
|
|
73
|
-
return treePlane;
|
|
74
80
|
}));
|
|
75
|
-
|
|
81
|
+
const {locationElements: locationElements, comparingPath: comparingPath} = computeComparingPath(location, parameters);
|
|
82
|
+
if (comparingPath !== route) {
|
|
83
|
+
return {
|
|
84
|
+
match: false,
|
|
85
|
+
parameters: {},
|
|
86
|
+
elements: locationElements
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
const parametersValues = extractParametersValues(parameters, locationElements);
|
|
90
|
+
return {
|
|
91
|
+
match: true,
|
|
92
|
+
parameters: parametersValues,
|
|
93
|
+
elements: locationElements
|
|
94
|
+
};
|
|
76
95
|
};
|
|
77
96
|
|
|
78
|
-
const
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
return updatedPlane;
|
|
85
|
-
}
|
|
86
|
-
if (treePlane.children) {
|
|
87
|
-
const updatedChildren = updateTreeByPlaneIDWithLinkCoordinates(treePlane.children, planeID, linkCoordinates);
|
|
88
|
-
const updatedPlane = Object.assign(Object.assign({}, treePlane), {
|
|
89
|
-
children: updatedChildren
|
|
90
|
-
});
|
|
91
|
-
return updatedPlane;
|
|
97
|
+
const extractParametersValues = (parameters, pathElements) => {
|
|
98
|
+
const parametersValues = {};
|
|
99
|
+
parameters.forEach(((parameter, index) => {
|
|
100
|
+
if (parameter) {
|
|
101
|
+
const parameterKey = parameter.slice(1);
|
|
102
|
+
parametersValues[parameterKey] = pathElements[index];
|
|
92
103
|
}
|
|
93
|
-
return treePlane;
|
|
94
104
|
}));
|
|
95
|
-
return
|
|
105
|
+
return parametersValues;
|
|
96
106
|
};
|
|
97
107
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
108
|
+
const computeComparingPath = (path, parameters) => {
|
|
109
|
+
const pathname = extractPathname(path);
|
|
110
|
+
const locationElements = splitPath(pathname);
|
|
111
|
+
const comparingPathElements = [ ...locationElements ];
|
|
112
|
+
for (const index of locationElements.keys()) {
|
|
113
|
+
if (parameters[index]) {
|
|
114
|
+
comparingPathElements[index] = parameters[index];
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
const comparingPath = comparingPathElements.join("/");
|
|
118
|
+
return {
|
|
119
|
+
locationElements: locationElements,
|
|
120
|
+
comparingPath: comparingPath
|
|
121
|
+
};
|
|
122
|
+
};
|
|
103
123
|
|
|
104
|
-
|
|
105
|
-
__proto__: null,
|
|
106
|
-
configuration: index$k,
|
|
107
|
-
tree: index$j
|
|
108
|
-
});
|
|
124
|
+
const splitPath = path => path.split("/").filter((i => i !== ""));
|
|
109
125
|
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
const
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
126
|
+
const extractQuery = path => {
|
|
127
|
+
const fragmentIndex = path.indexOf("#:~:");
|
|
128
|
+
const noFragmentPath = fragmentIndex === -1 ? path : path.substring(0, fragmentIndex);
|
|
129
|
+
const querySplit = noFragmentPath.split("?");
|
|
130
|
+
if (querySplit.length === 2) {
|
|
131
|
+
const queryValues = {};
|
|
132
|
+
const query = querySplit[1];
|
|
133
|
+
const queryItems = query.split("&");
|
|
134
|
+
for (const item of queryItems) {
|
|
135
|
+
const queryValue = item.split("=");
|
|
136
|
+
const id = queryValue[0];
|
|
137
|
+
const value = decodeURIComponent(queryValue[1]);
|
|
138
|
+
queryValues[id] = value;
|
|
139
|
+
}
|
|
140
|
+
return queryValues;
|
|
141
|
+
} else {
|
|
142
|
+
return {};
|
|
118
143
|
}
|
|
119
|
-
|
|
120
|
-
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
const extractFragments = location => {
|
|
147
|
+
if (!location) {
|
|
148
|
+
return {
|
|
149
|
+
texts: [],
|
|
150
|
+
elements: []
|
|
151
|
+
};
|
|
121
152
|
}
|
|
122
|
-
|
|
123
|
-
|
|
153
|
+
const split = location.split("#:~:");
|
|
154
|
+
const fragmentsValues = split[1];
|
|
155
|
+
if (!fragmentsValues) {
|
|
156
|
+
return {
|
|
157
|
+
texts: [],
|
|
158
|
+
elements: []
|
|
159
|
+
};
|
|
124
160
|
}
|
|
125
|
-
|
|
126
|
-
|
|
161
|
+
const fragmentItems = fragmentsValues.split("&");
|
|
162
|
+
const textFragments = [];
|
|
163
|
+
const elementFragments = [];
|
|
164
|
+
for (const item of fragmentItems) {
|
|
165
|
+
const parsedFragment = parseFragment(item);
|
|
166
|
+
if (parsedFragment) {
|
|
167
|
+
switch (parsedFragment.type) {
|
|
168
|
+
case "text":
|
|
169
|
+
textFragments.push(parsedFragment);
|
|
170
|
+
break;
|
|
171
|
+
|
|
172
|
+
case "element":
|
|
173
|
+
elementFragments.push(parsedFragment);
|
|
174
|
+
break;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
127
177
|
}
|
|
128
|
-
return
|
|
178
|
+
return {
|
|
179
|
+
texts: textFragments,
|
|
180
|
+
elements: elementFragments
|
|
181
|
+
};
|
|
129
182
|
};
|
|
130
183
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
184
|
+
const parseFragment = fragment => {
|
|
185
|
+
const fragmentData = fragment.split("=");
|
|
186
|
+
const fragmentType = fragmentData[0];
|
|
187
|
+
const fragmentValues = fragmentData[1];
|
|
188
|
+
switch (fragmentType.toLowerCase()) {
|
|
189
|
+
case "text":
|
|
190
|
+
{
|
|
191
|
+
const textValues = fragmentValues.split(",");
|
|
192
|
+
const textStart = textValues[0];
|
|
193
|
+
const textEnd = textValues[1];
|
|
194
|
+
const textOccurence = extractOccurence(textValues[2]);
|
|
195
|
+
if (!textStart) {
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
return {
|
|
199
|
+
type: "text",
|
|
200
|
+
start: textStart,
|
|
201
|
+
end: textEnd || "",
|
|
202
|
+
occurence: textOccurence
|
|
203
|
+
};
|
|
204
|
+
}
|
|
137
205
|
|
|
138
|
-
|
|
206
|
+
case "element":
|
|
207
|
+
{
|
|
208
|
+
const elementValues = fragmentValues.split(",");
|
|
209
|
+
const elementID = elementValues[0];
|
|
210
|
+
const elementOccurence = extractOccurence(elementValues[1]);
|
|
211
|
+
if (!elementID) {
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
return {
|
|
215
|
+
type: "element",
|
|
216
|
+
id: elementID,
|
|
217
|
+
occurence: elementOccurence
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
return undefined;
|
|
222
|
+
};
|
|
139
223
|
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
224
|
+
const extractOccurence = occurence => {
|
|
225
|
+
if (!occurence) {
|
|
226
|
+
return 0;
|
|
227
|
+
}
|
|
228
|
+
const occurenceMatch = occurence.match(/\[(\d*)\]/);
|
|
229
|
+
const occurenceValue = occurenceMatch ? parseInt(occurenceMatch[1]) : 0;
|
|
230
|
+
return occurenceValue;
|
|
231
|
+
};
|
|
146
232
|
|
|
147
|
-
const
|
|
233
|
+
const stringInsertInitial = (value, insert) => {
|
|
234
|
+
if (!value.startsWith(insert)) {
|
|
235
|
+
value = insert + value;
|
|
236
|
+
}
|
|
237
|
+
return value;
|
|
238
|
+
};
|
|
148
239
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
240
|
+
const stringRemoveTrailing = (value, trail) => {
|
|
241
|
+
if (value.endsWith(trail)) {
|
|
242
|
+
value = value.slice(0, value.length - trail.length);
|
|
243
|
+
}
|
|
244
|
+
return value;
|
|
245
|
+
};
|
|
152
246
|
|
|
153
|
-
|
|
154
|
-
return makeQuaternion(-quaternion.x, -quaternion.y, -quaternion.z, quaternion.w);
|
|
155
|
-
}
|
|
247
|
+
const PATH_SEPARATOR = "/";
|
|
156
248
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
const cY = Math.cos(y / 2);
|
|
163
|
-
const cZ = Math.cos(z / 2);
|
|
164
|
-
const sX = Math.sin(x / 2);
|
|
165
|
-
const sY = Math.sin(y / 2);
|
|
166
|
-
const sZ = Math.sin(z / 2);
|
|
167
|
-
const xQ = sX * cY * cZ - cX * sY * sZ;
|
|
168
|
-
const yQ = cX * sY * cZ + sX * cY * sZ;
|
|
169
|
-
const zQ = cX * cY * sZ + sX * sY * cZ;
|
|
170
|
-
const wQ = cX * cY * cZ - sX * sY * sZ;
|
|
171
|
-
return makeQuaternion(xQ, yQ, zQ, wQ);
|
|
172
|
-
}
|
|
249
|
+
const cleanupPath = value => {
|
|
250
|
+
value = stringInsertInitial(value, PATH_SEPARATOR);
|
|
251
|
+
value = stringRemoveTrailing(value, PATH_SEPARATOR);
|
|
252
|
+
return value;
|
|
253
|
+
};
|
|
173
254
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
const sine = Math.sin(halfAngle);
|
|
178
|
-
q.x = x * sine;
|
|
179
|
-
q.y = y * sine;
|
|
180
|
-
q.z = z * sine;
|
|
181
|
-
q.w = Math.cos(halfAngle);
|
|
182
|
-
return q;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
function quaternionMultiply(quaternionArray) {
|
|
186
|
-
const firstQuaternion = quaternionArray[0];
|
|
187
|
-
const valueQuaternion = Object.assign({}, firstQuaternion);
|
|
188
|
-
for (let i = 1; i < quaternionArray.length; i++) {
|
|
189
|
-
const nextQuaternion = quaternionArray[i];
|
|
190
|
-
const w = valueQuaternion.w * nextQuaternion.w - valueQuaternion.x * nextQuaternion.x - valueQuaternion.y * nextQuaternion.y - valueQuaternion.z * nextQuaternion.z;
|
|
191
|
-
const x = valueQuaternion.x * nextQuaternion.w + valueQuaternion.w * nextQuaternion.x + valueQuaternion.y * nextQuaternion.z - valueQuaternion.z * nextQuaternion.y;
|
|
192
|
-
const y = valueQuaternion.y * nextQuaternion.w + valueQuaternion.w * nextQuaternion.y + valueQuaternion.z * nextQuaternion.x - valueQuaternion.x * nextQuaternion.z;
|
|
193
|
-
const z = valueQuaternion.z * nextQuaternion.w + valueQuaternion.w * nextQuaternion.z + valueQuaternion.x * nextQuaternion.y - valueQuaternion.y * nextQuaternion.x;
|
|
194
|
-
valueQuaternion.x = x;
|
|
195
|
-
valueQuaternion.y = y;
|
|
196
|
-
valueQuaternion.z = z;
|
|
197
|
-
valueQuaternion.w = w;
|
|
255
|
+
const computePlaneAddress = (plane, route, origin = "origin") => {
|
|
256
|
+
if (origin === "origin" && typeof location !== "undefined" && location.host) {
|
|
257
|
+
origin = location.host;
|
|
198
258
|
}
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
const
|
|
210
|
-
|
|
211
|
-
|
|
259
|
+
const cleanPlane = extractPathname(plane);
|
|
260
|
+
const planeAddressType = checkPlaneAddressType(cleanPlane);
|
|
261
|
+
switch (planeAddressType) {
|
|
262
|
+
case "http":
|
|
263
|
+
case "https":
|
|
264
|
+
case "pttp":
|
|
265
|
+
return cleanPlane;
|
|
266
|
+
}
|
|
267
|
+
origin = stringRemoveTrailing(origin, "/");
|
|
268
|
+
const absolutePlane = isAbsolutePlane(plane);
|
|
269
|
+
const path = route && route !== "/" ? absolutePlane ? cleanupPath(cleanPlane) : cleanupPath(route) + cleanupPath(cleanPlane) : cleanupPath(cleanPlane);
|
|
270
|
+
const planeAddress = pluridData.protocols.plurid + origin + path;
|
|
271
|
+
return planeAddress;
|
|
272
|
+
};
|
|
212
273
|
|
|
213
|
-
|
|
214
|
-
const num = quaternion.x * 2;
|
|
215
|
-
const num2 = quaternion.y * 2;
|
|
216
|
-
const num3 = quaternion.z * 2;
|
|
217
|
-
const num4 = quaternion.x * num;
|
|
218
|
-
const num5 = quaternion.y * num2;
|
|
219
|
-
const num6 = quaternion.z * num3;
|
|
220
|
-
const num7 = quaternion.x * num2;
|
|
221
|
-
const num8 = quaternion.x * num3;
|
|
222
|
-
const num9 = quaternion.y * num3;
|
|
223
|
-
const num10 = quaternion.w * num;
|
|
224
|
-
const num11 = quaternion.w * num2;
|
|
225
|
-
const num12 = quaternion.w * num3;
|
|
226
|
-
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 ];
|
|
227
|
-
}
|
|
274
|
+
const isAbsolutePlane = value => value[0] === "/";
|
|
228
275
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
});
|
|
276
|
+
const checkPlaneAddressType = value => {
|
|
277
|
+
value = value.toLowerCase().trim();
|
|
278
|
+
if (value.startsWith(pluridData.protocols.plurid)) {
|
|
279
|
+
return "pttp";
|
|
280
|
+
}
|
|
281
|
+
if (value.startsWith(pluridData.protocols.https)) {
|
|
282
|
+
return pluridData.HTTPS_PROTOCOL;
|
|
283
|
+
}
|
|
284
|
+
if (value.startsWith(pluridData.protocols.http)) {
|
|
285
|
+
return pluridData.HTTP_PROTOCOL;
|
|
286
|
+
}
|
|
287
|
+
return "relative";
|
|
288
|
+
};
|
|
243
289
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
return rotationMatrix;
|
|
251
|
-
}
|
|
290
|
+
const removeTrailingSlash = value => {
|
|
291
|
+
if (value.endsWith("/") && value.length > 1) {
|
|
292
|
+
return value.slice(0, value.length - 1);
|
|
293
|
+
}
|
|
294
|
+
return value;
|
|
295
|
+
};
|
|
252
296
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
297
|
+
const cleanPathValue = value => {
|
|
298
|
+
const queryStart = value.indexOf("?");
|
|
299
|
+
if (queryStart < 0) {
|
|
300
|
+
return removeTrailingSlash(value);
|
|
301
|
+
}
|
|
302
|
+
return removeTrailingSlash(value.substring(0, queryStart));
|
|
303
|
+
};
|
|
256
304
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
305
|
+
const checkParameterLength = (parameter, length, compareType) => {
|
|
306
|
+
const parameterLength = parameter.length;
|
|
307
|
+
switch (compareType) {
|
|
308
|
+
case pluridData.compareTypes.equal:
|
|
309
|
+
return parameterLength === length;
|
|
260
310
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
const a00 = matrixA[0];
|
|
264
|
-
const a01 = matrixA[1];
|
|
265
|
-
const a02 = matrixA[2];
|
|
266
|
-
const a03 = matrixA[3];
|
|
267
|
-
const a10 = matrixA[4];
|
|
268
|
-
const a11 = matrixA[5];
|
|
269
|
-
const a12 = matrixA[6];
|
|
270
|
-
const a13 = matrixA[7];
|
|
271
|
-
const a20 = matrixA[8];
|
|
272
|
-
const a21 = matrixA[9];
|
|
273
|
-
const a22 = matrixA[10];
|
|
274
|
-
const a23 = matrixA[11];
|
|
275
|
-
const a30 = matrixA[12];
|
|
276
|
-
const a31 = matrixA[13];
|
|
277
|
-
const a32 = matrixA[14];
|
|
278
|
-
const a33 = matrixA[15];
|
|
279
|
-
let b0 = matrixB[0];
|
|
280
|
-
let b1 = matrixB[1];
|
|
281
|
-
let b2 = matrixB[2];
|
|
282
|
-
let b3 = matrixB[3];
|
|
283
|
-
result[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
|
|
284
|
-
result[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
|
|
285
|
-
result[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
|
|
286
|
-
result[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
|
|
287
|
-
b0 = matrixB[4];
|
|
288
|
-
b1 = matrixB[5];
|
|
289
|
-
b2 = matrixB[6];
|
|
290
|
-
b3 = matrixB[7];
|
|
291
|
-
result[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
|
|
292
|
-
result[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
|
|
293
|
-
result[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
|
|
294
|
-
result[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
|
|
295
|
-
b0 = matrixB[8];
|
|
296
|
-
b1 = matrixB[9];
|
|
297
|
-
b2 = matrixB[10];
|
|
298
|
-
b3 = matrixB[11];
|
|
299
|
-
result[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
|
|
300
|
-
result[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
|
|
301
|
-
result[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
|
|
302
|
-
result[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
|
|
303
|
-
b0 = matrixB[12];
|
|
304
|
-
b1 = matrixB[13];
|
|
305
|
-
b2 = matrixB[14];
|
|
306
|
-
b3 = matrixB[15];
|
|
307
|
-
result[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
|
|
308
|
-
result[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
|
|
309
|
-
result[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
|
|
310
|
-
result[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
|
|
311
|
-
return result;
|
|
312
|
-
}
|
|
311
|
+
case pluridData.compareTypes.equalLessThan:
|
|
312
|
+
return parameterLength <= length;
|
|
313
313
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
for (let i = 1; i < matrices.length; i++) {
|
|
317
|
-
inputMatrix = multiplyMatrices$1(inputMatrix, matrices[i]);
|
|
318
|
-
}
|
|
319
|
-
return inputMatrix;
|
|
320
|
-
}
|
|
314
|
+
case pluridData.compareTypes.lessThan:
|
|
315
|
+
return parameterLength < length;
|
|
321
316
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
}
|
|
317
|
+
case pluridData.compareTypes.equalGreaterThan:
|
|
318
|
+
return parameterLength >= length;
|
|
325
319
|
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
rotateMatrix: rotateMatrix,
|
|
329
|
-
translateMatrix: translateMatrix$1,
|
|
330
|
-
scaleMatrix: scaleMatrix$1,
|
|
331
|
-
multiplyMatrices: multiplyMatrices$1,
|
|
332
|
-
multiplyArrayOfMatrices: multiplyArrayOfMatrices,
|
|
333
|
-
matrixArrayToCSSMatrix: matrixArrayToCSSMatrix
|
|
334
|
-
});
|
|
320
|
+
case pluridData.compareTypes.greaterThan:
|
|
321
|
+
return parameterLength > length;
|
|
335
322
|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
323
|
+
default:
|
|
324
|
+
return parameterLength <= length;
|
|
325
|
+
}
|
|
339
326
|
};
|
|
340
327
|
|
|
341
|
-
const
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
328
|
+
const checkValidPath = (validationParameters, parameters) => {
|
|
329
|
+
if (validationParameters) {
|
|
330
|
+
for (const [parameterKey, parameterData] of Object.entries(validationParameters)) {
|
|
331
|
+
const {length: length, lengthType: lengthType, startsWith: startsWith, endsWith: endsWith, includes: includes} = parameterData;
|
|
332
|
+
const paramaterValue = parameters[parameterKey];
|
|
333
|
+
if (!paramaterValue) {
|
|
334
|
+
return false;
|
|
335
|
+
}
|
|
336
|
+
if (startsWith && !paramaterValue.startsWith(startsWith)) {
|
|
337
|
+
return false;
|
|
338
|
+
}
|
|
339
|
+
if (endsWith && !paramaterValue.endsWith(endsWith)) {
|
|
340
|
+
return false;
|
|
341
|
+
}
|
|
342
|
+
if (includes && !includes.includes(paramaterValue)) {
|
|
343
|
+
return false;
|
|
344
|
+
}
|
|
345
|
+
if (length) {
|
|
346
|
+
const validLength = checkParameterLength(paramaterValue, length, lengthType);
|
|
347
|
+
return validLength;
|
|
349
348
|
}
|
|
350
|
-
result[i][j] = sum;
|
|
351
349
|
}
|
|
352
350
|
}
|
|
353
|
-
return
|
|
351
|
+
return true;
|
|
354
352
|
};
|
|
355
353
|
|
|
356
|
-
const
|
|
357
|
-
if (
|
|
358
|
-
|
|
354
|
+
const cleanPathElement = path => {
|
|
355
|
+
if (path[0] === "/") {
|
|
356
|
+
return path.slice(1);
|
|
359
357
|
}
|
|
360
|
-
|
|
361
|
-
let result = first;
|
|
362
|
-
for (const [index, matrix] of matrices.entries()) {
|
|
363
|
-
if (index === 0) {
|
|
364
|
-
continue;
|
|
365
|
-
}
|
|
366
|
-
result = multiplyMatrices(result, matrix);
|
|
367
|
-
}
|
|
368
|
-
return result;
|
|
369
|
-
};
|
|
370
|
-
|
|
371
|
-
const arrayToMatrix = array => {
|
|
372
|
-
const matrix = [];
|
|
373
|
-
for (let i = 0; i < array.length; i += 4) {
|
|
374
|
-
const row = [];
|
|
375
|
-
row.push(array[i]);
|
|
376
|
-
row.push(array[i + 1]);
|
|
377
|
-
row.push(array[i + 2]);
|
|
378
|
-
row.push(array[i + 3]);
|
|
379
|
-
matrix.push(row);
|
|
380
|
-
}
|
|
381
|
-
return matrix;
|
|
358
|
+
return path;
|
|
382
359
|
};
|
|
383
360
|
|
|
384
|
-
|
|
361
|
+
var index$j = Object.freeze({
|
|
362
|
+
__proto__: null,
|
|
363
|
+
cleanPathElement: cleanPathElement
|
|
364
|
+
});
|
|
385
365
|
|
|
386
|
-
const
|
|
387
|
-
const
|
|
388
|
-
|
|
366
|
+
const mapPathsToRoutes = (paths, view) => {
|
|
367
|
+
const routes = [];
|
|
368
|
+
for (const [key, path] of Object.entries(paths)) {
|
|
369
|
+
const pathView = view[key];
|
|
370
|
+
if (pathView) {
|
|
371
|
+
const route = {
|
|
372
|
+
value: ""
|
|
373
|
+
};
|
|
374
|
+
routes.push(route);
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
return routes;
|
|
389
378
|
};
|
|
390
379
|
|
|
391
|
-
const
|
|
392
|
-
const
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
380
|
+
const pluridLinkPathDivider = route => {
|
|
381
|
+
const windowProtocol = typeof window === "undefined" ? "http" : window.location.protocol.replace(":", "");
|
|
382
|
+
const windowHost = typeof window === "undefined" ? "localhost:63000" : window.location.host;
|
|
383
|
+
const split = route.split("://").filter((value => value !== "")).map((value => cleanPathElement(value)));
|
|
384
|
+
let protocol = windowProtocol;
|
|
385
|
+
const host = {
|
|
386
|
+
value: windowHost,
|
|
387
|
+
controlled: false
|
|
388
|
+
};
|
|
389
|
+
const path = {
|
|
390
|
+
value: "",
|
|
391
|
+
parameters: {},
|
|
392
|
+
query: {}
|
|
393
|
+
};
|
|
394
|
+
const space = {
|
|
395
|
+
value: "",
|
|
396
|
+
parameters: {},
|
|
397
|
+
query: {}
|
|
398
|
+
};
|
|
399
|
+
const universe = {
|
|
400
|
+
value: "",
|
|
401
|
+
parameters: {},
|
|
402
|
+
query: {}
|
|
403
|
+
};
|
|
404
|
+
const cluster = {
|
|
405
|
+
value: "",
|
|
406
|
+
parameters: {},
|
|
407
|
+
query: {}
|
|
408
|
+
};
|
|
409
|
+
const plane = {
|
|
410
|
+
value: "",
|
|
411
|
+
parameters: {},
|
|
412
|
+
query: {},
|
|
413
|
+
fragments: {
|
|
414
|
+
texts: [],
|
|
415
|
+
elements: []
|
|
398
416
|
}
|
|
399
|
-
return value.toFixed(2) + " ";
|
|
400
417
|
};
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
418
|
+
const valid = false;
|
|
419
|
+
if (split.length === 0 || split.length > 7) {
|
|
420
|
+
const url = {
|
|
421
|
+
protocol: {
|
|
422
|
+
value: protocol,
|
|
423
|
+
secure: true
|
|
424
|
+
},
|
|
425
|
+
host: host,
|
|
426
|
+
path: path,
|
|
427
|
+
space: space,
|
|
428
|
+
universe: universe,
|
|
429
|
+
cluster: cluster,
|
|
430
|
+
plane: plane,
|
|
431
|
+
valid: valid
|
|
432
|
+
};
|
|
433
|
+
return url;
|
|
404
434
|
}
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
435
|
+
if (route.startsWith("/://")) {
|
|
436
|
+
const routeSplit = split.slice(1);
|
|
437
|
+
switch (routeSplit.length) {
|
|
438
|
+
case 1:
|
|
439
|
+
path.value = routeSplit[0];
|
|
440
|
+
break;
|
|
408
441
|
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
442
|
+
case 5:
|
|
443
|
+
path.value = routeSplit[0];
|
|
444
|
+
space.value = routeSplit[1];
|
|
445
|
+
universe.value = routeSplit[2];
|
|
446
|
+
cluster.value = routeSplit[3];
|
|
447
|
+
plane.value = routeSplit[4];
|
|
448
|
+
break;
|
|
449
|
+
}
|
|
450
|
+
const url = {
|
|
451
|
+
protocol: {
|
|
452
|
+
value: protocol,
|
|
453
|
+
secure: true
|
|
454
|
+
},
|
|
455
|
+
host: host,
|
|
456
|
+
path: path,
|
|
457
|
+
space: space,
|
|
458
|
+
universe: universe,
|
|
459
|
+
cluster: cluster,
|
|
460
|
+
plane: plane,
|
|
461
|
+
valid: true
|
|
462
|
+
};
|
|
463
|
+
return url;
|
|
464
|
+
}
|
|
465
|
+
if (split[0] !== "http" && split[0] !== "https" && split[0] !== "chrome-extension") {
|
|
466
|
+
switch (split.length) {
|
|
467
|
+
case 1:
|
|
468
|
+
plane.value = split[0];
|
|
469
|
+
break;
|
|
416
470
|
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
const m = [ [ x, 0, z, 0 ], [ 0, 1, 0, 0 ], [ y, 0, x, 0 ], [ 0, 0, 0, 1 ] ];
|
|
422
|
-
return m;
|
|
423
|
-
};
|
|
471
|
+
case 2:
|
|
472
|
+
cluster.value = split[0];
|
|
473
|
+
plane.value = split[1];
|
|
474
|
+
break;
|
|
424
475
|
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
return m;
|
|
431
|
-
};
|
|
476
|
+
case 3:
|
|
477
|
+
universe.value = split[0];
|
|
478
|
+
cluster.value = split[1];
|
|
479
|
+
plane.value = split[2];
|
|
480
|
+
break;
|
|
432
481
|
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
482
|
+
case 4:
|
|
483
|
+
space.value = split[0];
|
|
484
|
+
universe.value = split[1];
|
|
485
|
+
cluster.value = split[2];
|
|
486
|
+
plane.value = split[3];
|
|
487
|
+
break;
|
|
437
488
|
|
|
438
|
-
|
|
489
|
+
case 5:
|
|
490
|
+
path.value = split[0];
|
|
491
|
+
space.value = split[1];
|
|
492
|
+
universe.value = split[2];
|
|
493
|
+
cluster.value = split[3];
|
|
494
|
+
plane.value = split[4];
|
|
495
|
+
break;
|
|
439
496
|
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
const num8 = quaternion.x * num3;
|
|
449
|
-
const num9 = quaternion.y * num3;
|
|
450
|
-
const num10 = quaternion.w * num;
|
|
451
|
-
const num11 = quaternion.w * num2;
|
|
452
|
-
const num12 = quaternion.w * num3;
|
|
453
|
-
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 ] ];
|
|
454
|
-
}
|
|
497
|
+
case 6:
|
|
498
|
+
host.value = split[0];
|
|
499
|
+
path.value = split[1];
|
|
500
|
+
space.value = split[2];
|
|
501
|
+
universe.value = split[3];
|
|
502
|
+
cluster.value = split[4];
|
|
503
|
+
plane.value = split[5];
|
|
504
|
+
break;
|
|
455
505
|
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
506
|
+
default:
|
|
507
|
+
const url = {
|
|
508
|
+
protocol: {
|
|
509
|
+
value: protocol,
|
|
510
|
+
secure: true
|
|
511
|
+
},
|
|
512
|
+
host: host,
|
|
513
|
+
path: path,
|
|
514
|
+
space: space,
|
|
515
|
+
universe: universe,
|
|
516
|
+
cluster: cluster,
|
|
517
|
+
plane: plane,
|
|
518
|
+
valid: valid
|
|
519
|
+
};
|
|
520
|
+
return url;
|
|
521
|
+
}
|
|
522
|
+
} else {
|
|
523
|
+
switch (split.length) {
|
|
524
|
+
case 3:
|
|
525
|
+
protocol = split[0];
|
|
526
|
+
host.value = split[1];
|
|
527
|
+
path.value = split[2];
|
|
528
|
+
break;
|
|
460
529
|
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
530
|
+
case 7:
|
|
531
|
+
protocol = split[0];
|
|
532
|
+
host.value = split[1];
|
|
533
|
+
path.value = split[2];
|
|
534
|
+
space.value = split[3];
|
|
535
|
+
universe.value = split[4];
|
|
536
|
+
cluster.value = split[5];
|
|
537
|
+
plane.value = split[6];
|
|
538
|
+
break;
|
|
465
539
|
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
ABig = Math.abs(A[r][c]);
|
|
482
|
-
rBig = r;
|
|
483
|
-
}
|
|
484
|
-
r++;
|
|
540
|
+
default:
|
|
541
|
+
const url = {
|
|
542
|
+
protocol: {
|
|
543
|
+
value: protocol,
|
|
544
|
+
secure: true
|
|
545
|
+
},
|
|
546
|
+
host: host,
|
|
547
|
+
path: path,
|
|
548
|
+
space: space,
|
|
549
|
+
universe: universe,
|
|
550
|
+
cluster: cluster,
|
|
551
|
+
plane: plane,
|
|
552
|
+
valid: valid
|
|
553
|
+
};
|
|
554
|
+
return url;
|
|
485
555
|
}
|
|
486
|
-
|
|
487
|
-
|
|
556
|
+
}
|
|
557
|
+
const url = {
|
|
558
|
+
protocol: {
|
|
559
|
+
value: protocol,
|
|
560
|
+
secure: true
|
|
561
|
+
},
|
|
562
|
+
host: host,
|
|
563
|
+
path: path,
|
|
564
|
+
space: space,
|
|
565
|
+
universe: universe,
|
|
566
|
+
cluster: cluster,
|
|
567
|
+
plane: plane,
|
|
568
|
+
valid: true
|
|
569
|
+
};
|
|
570
|
+
return url;
|
|
571
|
+
};
|
|
572
|
+
|
|
573
|
+
const resolveRoute = (route, protocol, host) => {
|
|
574
|
+
const windowProtocol = typeof window === "undefined" ? protocol || "http" : window.location.protocol.replace(":", "");
|
|
575
|
+
const windowHost = typeof window === "undefined" ? host || "localhost:63000" : window.location.host;
|
|
576
|
+
const divisions = pluridLinkPathDivider(route);
|
|
577
|
+
const defaultPathname = typeof window !== "undefined" ? window.location.pathname === "/" ? "p" : window.location.pathname.slice(1) : divisions.path.value ? divisions.path.value : "p";
|
|
578
|
+
const protocolDivision = divisions.protocol.value || windowProtocol;
|
|
579
|
+
const hostDivision = divisions.host.value ? divisions.host : {
|
|
580
|
+
value: windowHost,
|
|
581
|
+
controlled: true
|
|
582
|
+
};
|
|
583
|
+
const path = divisions.path.value ? divisions.path : {
|
|
584
|
+
value: defaultPathname,
|
|
585
|
+
parameters: {},
|
|
586
|
+
query: {}
|
|
587
|
+
};
|
|
588
|
+
const space = divisions.space.value ? divisions.space : {
|
|
589
|
+
value: "s",
|
|
590
|
+
parameters: {},
|
|
591
|
+
query: {}
|
|
592
|
+
};
|
|
593
|
+
const universe = divisions.universe.value ? divisions.universe : {
|
|
594
|
+
value: "u",
|
|
595
|
+
parameters: {},
|
|
596
|
+
query: {}
|
|
597
|
+
};
|
|
598
|
+
const cluster = divisions.cluster.value ? divisions.cluster : {
|
|
599
|
+
value: "c",
|
|
600
|
+
parameters: {},
|
|
601
|
+
query: {}
|
|
602
|
+
};
|
|
603
|
+
const plane = divisions.plane;
|
|
604
|
+
const separator = "://";
|
|
605
|
+
if (!plane.value && route !== "/") {
|
|
606
|
+
const resolvers = [ protocolDivision, hostDivision.value, path.value ];
|
|
607
|
+
const absoluteRoute = resolvers.join(separator);
|
|
608
|
+
return {
|
|
609
|
+
protocol: protocolDivision,
|
|
610
|
+
host: hostDivision,
|
|
611
|
+
path: path,
|
|
612
|
+
space: space,
|
|
613
|
+
universe: universe,
|
|
614
|
+
cluster: cluster,
|
|
615
|
+
plane: plane,
|
|
616
|
+
route: absoluteRoute
|
|
617
|
+
};
|
|
618
|
+
}
|
|
619
|
+
[ protocolDivision, hostDivision.value, path.value, space.value, universe.value, cluster.value, cleanPathElement(plane.value) ];
|
|
620
|
+
return {
|
|
621
|
+
protocol: "",
|
|
622
|
+
host: "",
|
|
623
|
+
path: path,
|
|
624
|
+
space: "",
|
|
625
|
+
universe: "",
|
|
626
|
+
cluster: "",
|
|
627
|
+
plane: "",
|
|
628
|
+
route: route
|
|
629
|
+
};
|
|
630
|
+
};
|
|
631
|
+
|
|
632
|
+
const updateTreePlane$1 = (tree, page) => {
|
|
633
|
+
const updatedTree = tree.map((treePlane => {
|
|
634
|
+
if (treePlane.planeID === page.planeID) {
|
|
635
|
+
return Object.assign({}, page);
|
|
488
636
|
}
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
A[r] = temp;
|
|
494
|
-
temp = B[c];
|
|
495
|
-
B[c] = B[r];
|
|
496
|
-
B[r] = temp;
|
|
637
|
+
if (treePlane.children) {
|
|
638
|
+
return Object.assign(Object.assign({}, treePlane), {
|
|
639
|
+
children: updateTreePlane$1(treePlane.children, page)
|
|
640
|
+
});
|
|
497
641
|
}
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
Br[s] = Br[s] + f * Bc[s];
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
} else {
|
|
514
|
-
f = Ac[c];
|
|
515
|
-
for (s = c; s < cols; s++) {
|
|
516
|
-
Ar[s] = Ar[s] / f;
|
|
517
|
-
}
|
|
518
|
-
for (s = 0; s < cols; s++) {
|
|
519
|
-
Br[s] = Br[s] / f;
|
|
520
|
-
}
|
|
521
|
-
}
|
|
642
|
+
return treePlane;
|
|
643
|
+
}));
|
|
644
|
+
return updatedTree;
|
|
645
|
+
};
|
|
646
|
+
|
|
647
|
+
const updateTreeByPlaneIDWithLinkCoordinates = (tree, planeID, linkCoordinates) => {
|
|
648
|
+
const updatedTree = tree.map((treePlane => {
|
|
649
|
+
if (treePlane.planeID === planeID) {
|
|
650
|
+
const updatedPlane = Object.assign(Object.assign({}, treePlane), {
|
|
651
|
+
linkCoordinates: linkCoordinates
|
|
652
|
+
});
|
|
653
|
+
return updatedPlane;
|
|
522
654
|
}
|
|
523
|
-
|
|
524
|
-
|
|
655
|
+
if (treePlane.children) {
|
|
656
|
+
const updatedChildren = updateTreeByPlaneIDWithLinkCoordinates(treePlane.children, planeID, linkCoordinates);
|
|
657
|
+
const updatedPlane = Object.assign(Object.assign({}, treePlane), {
|
|
658
|
+
children: updatedChildren
|
|
659
|
+
});
|
|
660
|
+
return updatedPlane;
|
|
661
|
+
}
|
|
662
|
+
return treePlane;
|
|
663
|
+
}));
|
|
664
|
+
return updatedTree;
|
|
525
665
|
};
|
|
526
666
|
|
|
527
|
-
var index$
|
|
667
|
+
var index$i = Object.freeze({
|
|
528
668
|
__proto__: null,
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
multiplyMatricesArray: multiplyMatricesArray,
|
|
532
|
-
arrayToMatrix: arrayToMatrix,
|
|
533
|
-
matrixToArray: matrixToArray,
|
|
534
|
-
matrix3DToMatrix: matrix3DToMatrix,
|
|
535
|
-
printMatrix: printMatrix,
|
|
536
|
-
rotateXMatrix: rotateXMatrix,
|
|
537
|
-
rotateYMatrix: rotateYMatrix,
|
|
538
|
-
rotateZMatrix: rotateZMatrix,
|
|
539
|
-
translateMatrix: translateMatrix,
|
|
540
|
-
scaleMatrix: scaleMatrix,
|
|
541
|
-
rotationMatrixFromQuaternion: rotationMatrixFromQuaternion,
|
|
542
|
-
matrixToCSSMatrix: matrixToCSSMatrix,
|
|
543
|
-
identityMatrix: identityMatrix,
|
|
544
|
-
inverseMatrix: inverseMatrix
|
|
669
|
+
updateTreePlane: updateTreePlane$1,
|
|
670
|
+
updateTreeByPlaneIDWithLinkCoordinates: updateTreeByPlaneIDWithLinkCoordinates
|
|
545
671
|
});
|
|
546
672
|
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
673
|
+
var index$h = Object.freeze({
|
|
674
|
+
__proto__: null,
|
|
675
|
+
configuration: index$k,
|
|
676
|
+
tree: index$i
|
|
677
|
+
});
|
|
678
|
+
|
|
679
|
+
const getWheelDirection = (deltas, ABSTHRESHOLD = 10, THRESHOLD = 0) => {
|
|
680
|
+
let direction = "left";
|
|
681
|
+
const wheelDeltaX = deltas.deltaX;
|
|
682
|
+
const wheelDeltaY = deltas.deltaY;
|
|
683
|
+
const absWheelDeltaX = Math.abs(wheelDeltaX);
|
|
684
|
+
const absWheelDeltaY = Math.abs(wheelDeltaY);
|
|
685
|
+
if (wheelDeltaX > THRESHOLD && absWheelDeltaY < ABSTHRESHOLD && absWheelDeltaX > absWheelDeltaY) {
|
|
686
|
+
direction = "left";
|
|
552
687
|
}
|
|
553
|
-
|
|
688
|
+
if (wheelDeltaX < THRESHOLD && absWheelDeltaY < ABSTHRESHOLD && absWheelDeltaX > absWheelDeltaY) {
|
|
689
|
+
direction = "right";
|
|
690
|
+
}
|
|
691
|
+
if (wheelDeltaY > THRESHOLD && absWheelDeltaX < ABSTHRESHOLD && absWheelDeltaY > absWheelDeltaX) {
|
|
692
|
+
direction = "up";
|
|
693
|
+
}
|
|
694
|
+
if (wheelDeltaY < THRESHOLD && absWheelDeltaX < ABSTHRESHOLD && absWheelDeltaY > absWheelDeltaX) {
|
|
695
|
+
direction = "down";
|
|
696
|
+
}
|
|
697
|
+
return direction;
|
|
698
|
+
};
|
|
699
|
+
|
|
700
|
+
var index$g = Object.freeze({
|
|
701
|
+
__proto__: null,
|
|
702
|
+
getWheelDirection: getWheelDirection
|
|
703
|
+
});
|
|
704
|
+
|
|
705
|
+
const degToRad = deg => deg * .01745329252;
|
|
706
|
+
|
|
707
|
+
const radToDeg = rad => rad * 57.2957795131;
|
|
708
|
+
|
|
709
|
+
const makeQuaternion = (x, y, z, w) => ({
|
|
710
|
+
x: x,
|
|
711
|
+
y: y,
|
|
712
|
+
z: z,
|
|
713
|
+
w: w
|
|
714
|
+
});
|
|
715
|
+
|
|
716
|
+
const zeroQuaternion = () => makeQuaternion(0, 0, 0, 0);
|
|
717
|
+
|
|
718
|
+
function inverseQuaternion(quaternion) {
|
|
719
|
+
return makeQuaternion(quaternion.x, quaternion.y, quaternion.z, -quaternion.w);
|
|
554
720
|
}
|
|
555
721
|
|
|
556
|
-
function
|
|
557
|
-
|
|
558
|
-
const scale = getScalationValue(matrix3d);
|
|
559
|
-
if (valuesMatrix.length === 16) {
|
|
560
|
-
for (let i = 0; i < 11; i++) {
|
|
561
|
-
valuesMatrix[i] /= scale;
|
|
562
|
-
}
|
|
563
|
-
} else if (valuesMatrix.length === 6) {
|
|
564
|
-
for (let i = 0; i < 4; i++) {
|
|
565
|
-
valuesMatrix[i] /= scale;
|
|
566
|
-
}
|
|
567
|
-
}
|
|
568
|
-
const rotationMatrix = valuesMatrix;
|
|
569
|
-
return rotationMatrix;
|
|
722
|
+
function conjugateQuaternion(quaternion) {
|
|
723
|
+
return makeQuaternion(-quaternion.x, -quaternion.y, -quaternion.z, quaternion.w);
|
|
570
724
|
}
|
|
571
725
|
|
|
572
|
-
function
|
|
573
|
-
const
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
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);
|
|
730
|
+
const cX = Math.cos(x / 2);
|
|
731
|
+
const cY = Math.cos(y / 2);
|
|
732
|
+
const cZ = Math.cos(z / 2);
|
|
733
|
+
const sX = Math.sin(x / 2);
|
|
734
|
+
const sY = Math.sin(y / 2);
|
|
735
|
+
const sZ = Math.sin(z / 2);
|
|
736
|
+
const xQ = sX * cY * cZ - cX * sY * sZ;
|
|
737
|
+
const yQ = cX * sY * cZ + sX * cY * sZ;
|
|
738
|
+
const zQ = cX * cY * sZ + sX * sY * cZ;
|
|
739
|
+
const wQ = cX * cY * cZ - sX * sY * sZ;
|
|
740
|
+
return makeQuaternion(xQ, yQ, zQ, wQ);
|
|
581
741
|
}
|
|
582
742
|
|
|
583
|
-
function
|
|
584
|
-
const
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
}
|
|
593
|
-
scale = parseFloat(Math.sqrt(scale).toPrecision(4));
|
|
594
|
-
} else if (valuesMatrix.length === 6) {
|
|
595
|
-
temp = valuesMatrix[0] * valuesMatrix[0] + valuesMatrix[1] * valuesMatrix[1];
|
|
596
|
-
scale = parseFloat(Math.sqrt(temp).toPrecision(4));
|
|
597
|
-
}
|
|
598
|
-
return scale;
|
|
743
|
+
function quaternionFromAxisAngle(x, y, z, angle) {
|
|
744
|
+
const q = zeroQuaternion();
|
|
745
|
+
const halfAngle = angle / 2;
|
|
746
|
+
const sine = Math.sin(halfAngle);
|
|
747
|
+
q.x = x * sine;
|
|
748
|
+
q.y = y * sine;
|
|
749
|
+
q.z = z * sine;
|
|
750
|
+
q.w = Math.cos(halfAngle);
|
|
751
|
+
return q;
|
|
599
752
|
}
|
|
600
753
|
|
|
601
|
-
function
|
|
602
|
-
const
|
|
603
|
-
|
|
754
|
+
function quaternionMultiply(quaternionArray) {
|
|
755
|
+
const firstQuaternion = quaternionArray[0];
|
|
756
|
+
const valueQuaternion = Object.assign({}, firstQuaternion);
|
|
757
|
+
for (let i = 1; i < quaternionArray.length; i++) {
|
|
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;
|
|
604
769
|
}
|
|
605
770
|
|
|
606
|
-
function
|
|
607
|
-
const
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
const cosa = values[0];
|
|
613
|
-
const sina = values[1];
|
|
614
|
-
if (cosa === 1 && sina === 0) {
|
|
615
|
-
rotateX = Math.asin(sina);
|
|
616
|
-
rotateY = Math.acos(cosa);
|
|
617
|
-
}
|
|
618
|
-
}
|
|
619
|
-
if (values.length === 16) {
|
|
620
|
-
const cosaX1 = values[5];
|
|
621
|
-
const sinaX3 = values[9];
|
|
622
|
-
if (sinaX3 <= 0) {
|
|
623
|
-
rotateX = Math.acos(cosaX1);
|
|
624
|
-
}
|
|
625
|
-
if (sinaX3 > 0) {
|
|
626
|
-
rotateX = 2 * pi - Math.acos(cosaX1);
|
|
627
|
-
}
|
|
628
|
-
const cosaY1 = values[0];
|
|
629
|
-
const sinaY2 = values[2];
|
|
630
|
-
if (sinaY2 <= 0) {
|
|
631
|
-
rotateY = Math.acos(cosaY1);
|
|
632
|
-
}
|
|
633
|
-
if (sinaY2 > 0) {
|
|
634
|
-
rotateY = 2 * pi - Math.acos(cosaY1);
|
|
635
|
-
}
|
|
636
|
-
rotateX = Math.atan2(values[9], values[5]);
|
|
637
|
-
rotateY = Math.atan2(values[2], values[0]);
|
|
638
|
-
}
|
|
639
|
-
return {
|
|
640
|
-
rotateX: rotateX,
|
|
641
|
-
rotateY: rotateY,
|
|
642
|
-
rotateZ: 0
|
|
771
|
+
function rotatePointViaQuaternion(pointRotate, quaternion) {
|
|
772
|
+
const temporaryQuaternion = {
|
|
773
|
+
x: pointRotate[0],
|
|
774
|
+
y: pointRotate[1],
|
|
775
|
+
z: pointRotate[2],
|
|
776
|
+
w: 0
|
|
643
777
|
};
|
|
778
|
+
const rotatedPointQuaternion = quaternionMultiply([ quaternion, temporaryQuaternion, conjugateQuaternion(quaternion) ]);
|
|
779
|
+
return rotatedPointQuaternion;
|
|
644
780
|
}
|
|
645
781
|
|
|
646
|
-
function
|
|
647
|
-
const
|
|
648
|
-
const
|
|
649
|
-
const
|
|
650
|
-
const
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
782
|
+
function makeRotationMatrixFromQuaternion(quaternion) {
|
|
783
|
+
const num = quaternion.x * 2;
|
|
784
|
+
const num2 = quaternion.y * 2;
|
|
785
|
+
const num3 = quaternion.z * 2;
|
|
786
|
+
const num4 = quaternion.x * num;
|
|
787
|
+
const num5 = quaternion.y * num2;
|
|
788
|
+
const num6 = quaternion.z * num3;
|
|
789
|
+
const num7 = quaternion.x * num2;
|
|
790
|
+
const num8 = quaternion.x * num3;
|
|
791
|
+
const num9 = quaternion.y * num3;
|
|
792
|
+
const num10 = quaternion.w * num;
|
|
793
|
+
const num11 = quaternion.w * num2;
|
|
794
|
+
const num12 = quaternion.w * num3;
|
|
795
|
+
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 ];
|
|
656
796
|
}
|
|
657
797
|
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
798
|
+
var index$f = Object.freeze({
|
|
799
|
+
__proto__: null,
|
|
800
|
+
degToRad: degToRad,
|
|
801
|
+
radToDeg: radToDeg,
|
|
802
|
+
makeQuaternion: makeQuaternion,
|
|
803
|
+
zeroQuaternion: zeroQuaternion,
|
|
804
|
+
inverseQuaternion: inverseQuaternion,
|
|
805
|
+
conjugateQuaternion: conjugateQuaternion,
|
|
806
|
+
computeQuaternionFromEulers: computeQuaternionFromEulers,
|
|
807
|
+
quaternionFromAxisAngle: quaternionFromAxisAngle,
|
|
808
|
+
quaternionMultiply: quaternionMultiply,
|
|
809
|
+
rotatePointViaQuaternion: rotatePointViaQuaternion,
|
|
810
|
+
makeRotationMatrixFromQuaternion: makeRotationMatrixFromQuaternion
|
|
811
|
+
});
|
|
812
|
+
|
|
813
|
+
function rotateMatrix(xAngle, yAngle, zAngle = 0) {
|
|
814
|
+
const xQuaternion = computeQuaternionFromEulers(0, xAngle, 0);
|
|
815
|
+
const yQuaternion = computeQuaternionFromEulers(0, 0, yAngle);
|
|
816
|
+
const zQuaternion = computeQuaternionFromEulers(zAngle, 0, 0);
|
|
817
|
+
const quartenionMultiplication = quaternionMultiply([ yQuaternion, xQuaternion, zQuaternion ]);
|
|
818
|
+
const rotationMatrix = makeRotationMatrixFromQuaternion(quartenionMultiplication);
|
|
819
|
+
return rotationMatrix;
|
|
663
820
|
}
|
|
664
821
|
|
|
665
|
-
function
|
|
666
|
-
|
|
667
|
-
const rotateX = transformRotate.rotateX;
|
|
668
|
-
let rotateY = transformRotate.rotateY;
|
|
669
|
-
const rotateZ = transformRotate.rotateZ;
|
|
670
|
-
const transformTranslate = getTransformTranslate(matrix3d);
|
|
671
|
-
const translateX = transformTranslate.translateX;
|
|
672
|
-
const translateY = transformTranslate.translateY;
|
|
673
|
-
const translateZ = transformTranslate.translateZ;
|
|
674
|
-
const scale = getTransformScale(matrix3d).scale;
|
|
675
|
-
let valRotationMatrix = rotateMatrix(rotateX, rotateY, rotateZ);
|
|
676
|
-
const valTranslationMatrix = translateMatrix$1(translateX, translateY, translateZ);
|
|
677
|
-
const valScalationMatrix = scaleMatrix$1(scale);
|
|
678
|
-
if (direction === "left") {
|
|
679
|
-
rotateY -= angleIncrement;
|
|
680
|
-
valRotationMatrix = rotateMatrix(rotateX, rotateY);
|
|
681
|
-
}
|
|
682
|
-
if (direction === "right") {
|
|
683
|
-
rotateY += angleIncrement;
|
|
684
|
-
valRotationMatrix = rotateMatrix(rotateX, rotateY);
|
|
685
|
-
}
|
|
686
|
-
if (direction === "up") {
|
|
687
|
-
rotateY -= angleIncrement;
|
|
688
|
-
valRotationMatrix = rotateMatrix(rotateX, rotateY);
|
|
689
|
-
}
|
|
690
|
-
if (direction === "down") {
|
|
691
|
-
rotateY += angleIncrement;
|
|
692
|
-
valRotationMatrix = rotateMatrix(rotateX, rotateY);
|
|
693
|
-
}
|
|
694
|
-
const transformedMatrix3d = setTransform(valRotationMatrix, valTranslationMatrix, valScalationMatrix);
|
|
695
|
-
return transformedMatrix3d;
|
|
822
|
+
function translateMatrix$1(x, y, z) {
|
|
823
|
+
return [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, x, y, z, 1 ];
|
|
696
824
|
}
|
|
697
825
|
|
|
698
|
-
function
|
|
699
|
-
|
|
700
|
-
const rotateX = transformRotate.rotateX;
|
|
701
|
-
const rotateY = transformRotate.rotateY;
|
|
702
|
-
const rotateZ = transformRotate.rotateZ;
|
|
703
|
-
const transformTranslate = getTransformTranslate(matrix3d);
|
|
704
|
-
let translateX = transformTranslate.translateX;
|
|
705
|
-
let translateY = transformTranslate.translateY;
|
|
706
|
-
const translateZ = transformTranslate.translateZ;
|
|
707
|
-
const scale = getTransformScale(matrix3d).scale;
|
|
708
|
-
const valRotationMatrix = rotateMatrix(rotateX, rotateY, rotateZ);
|
|
709
|
-
let valTranslationMatrix = translateMatrix$1(translateX, translateY, translateZ);
|
|
710
|
-
const valScalationMatrix = scaleMatrix$1(scale);
|
|
711
|
-
scale < .5 ? linearIncrement = 50 : linearIncrement = 30;
|
|
712
|
-
if (direction === "left") {
|
|
713
|
-
translateX += linearIncrement;
|
|
714
|
-
valTranslationMatrix = translateMatrix$1(translateX, translateY, translateZ);
|
|
715
|
-
}
|
|
716
|
-
if (direction === "right") {
|
|
717
|
-
translateX -= linearIncrement;
|
|
718
|
-
valTranslationMatrix = translateMatrix$1(translateX, translateY, translateZ);
|
|
719
|
-
}
|
|
720
|
-
if (direction === "up") {
|
|
721
|
-
translateY += linearIncrement;
|
|
722
|
-
valTranslationMatrix = translateMatrix$1(translateX, translateY, translateZ);
|
|
723
|
-
}
|
|
724
|
-
if (direction === "down") {
|
|
725
|
-
translateY -= linearIncrement;
|
|
726
|
-
valTranslationMatrix = translateMatrix$1(translateX, translateY, translateZ);
|
|
727
|
-
}
|
|
728
|
-
const transformedMatrix3d = setTransform(valRotationMatrix, valTranslationMatrix, valScalationMatrix);
|
|
729
|
-
return transformedMatrix3d;
|
|
826
|
+
function scaleMatrix$1(s) {
|
|
827
|
+
return [ s, 0, 0, 0, 0, s, 0, 0, 0, 0, s, 0, 0, 0, 0, 1 ];
|
|
730
828
|
}
|
|
731
829
|
|
|
732
|
-
function
|
|
733
|
-
const
|
|
734
|
-
const
|
|
735
|
-
const
|
|
736
|
-
const
|
|
737
|
-
const
|
|
738
|
-
const
|
|
739
|
-
const
|
|
740
|
-
const
|
|
741
|
-
|
|
742
|
-
const
|
|
743
|
-
const
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
830
|
+
function multiplyMatrices$1(matrixA, matrixB) {
|
|
831
|
+
const result = [];
|
|
832
|
+
const a00 = matrixA[0];
|
|
833
|
+
const a01 = matrixA[1];
|
|
834
|
+
const a02 = matrixA[2];
|
|
835
|
+
const a03 = matrixA[3];
|
|
836
|
+
const a10 = matrixA[4];
|
|
837
|
+
const a11 = matrixA[5];
|
|
838
|
+
const a12 = matrixA[6];
|
|
839
|
+
const a13 = matrixA[7];
|
|
840
|
+
const a20 = matrixA[8];
|
|
841
|
+
const a21 = matrixA[9];
|
|
842
|
+
const a22 = matrixA[10];
|
|
843
|
+
const a23 = matrixA[11];
|
|
844
|
+
const a30 = matrixA[12];
|
|
845
|
+
const a31 = matrixA[13];
|
|
846
|
+
const a32 = matrixA[14];
|
|
847
|
+
const a33 = matrixA[15];
|
|
848
|
+
let b0 = matrixB[0];
|
|
849
|
+
let b1 = matrixB[1];
|
|
850
|
+
let b2 = matrixB[2];
|
|
851
|
+
let b3 = matrixB[3];
|
|
852
|
+
result[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
|
|
853
|
+
result[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
|
|
854
|
+
result[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
|
|
855
|
+
result[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
|
|
856
|
+
b0 = matrixB[4];
|
|
857
|
+
b1 = matrixB[5];
|
|
858
|
+
b2 = matrixB[6];
|
|
859
|
+
b3 = matrixB[7];
|
|
860
|
+
result[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
|
|
861
|
+
result[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
|
|
862
|
+
result[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
|
|
863
|
+
result[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
|
|
864
|
+
b0 = matrixB[8];
|
|
865
|
+
b1 = matrixB[9];
|
|
866
|
+
b2 = matrixB[10];
|
|
867
|
+
b3 = matrixB[11];
|
|
868
|
+
result[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
|
|
869
|
+
result[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
|
|
870
|
+
result[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
|
|
871
|
+
result[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
|
|
872
|
+
b0 = matrixB[12];
|
|
873
|
+
b1 = matrixB[13];
|
|
874
|
+
b2 = matrixB[14];
|
|
875
|
+
b3 = matrixB[15];
|
|
876
|
+
result[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
|
|
877
|
+
result[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
|
|
878
|
+
result[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
|
|
879
|
+
result[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
|
|
880
|
+
return result;
|
|
761
881
|
}
|
|
762
882
|
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
getTransformRotate: getTransformRotate,
|
|
771
|
-
getTransformTranslate: getTransformTranslate,
|
|
772
|
-
getTransformScale: getTransformScale,
|
|
773
|
-
rotatePlurid: rotatePlurid,
|
|
774
|
-
translatePlurid: translatePlurid,
|
|
775
|
-
scalePlurid: scalePlurid
|
|
776
|
-
});
|
|
883
|
+
function multiplyArrayOfMatrices(matrices) {
|
|
884
|
+
let inputMatrix = matrices[0];
|
|
885
|
+
for (let i = 1; i < matrices.length; i++) {
|
|
886
|
+
inputMatrix = multiplyMatrices$1(inputMatrix, matrices[i]);
|
|
887
|
+
}
|
|
888
|
+
return inputMatrix;
|
|
889
|
+
}
|
|
777
890
|
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
matrix3d: index$d
|
|
782
|
-
});
|
|
891
|
+
function matrixArrayToCSSMatrix(array) {
|
|
892
|
+
return "matrix3d(" + array.join(",") + ")";
|
|
893
|
+
}
|
|
783
894
|
|
|
784
|
-
var index$
|
|
895
|
+
var index$e = Object.freeze({
|
|
785
896
|
__proto__: null,
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
897
|
+
rotateMatrix: rotateMatrix,
|
|
898
|
+
translateMatrix: translateMatrix$1,
|
|
899
|
+
scaleMatrix: scaleMatrix$1,
|
|
900
|
+
multiplyMatrices: multiplyMatrices$1,
|
|
901
|
+
multiplyArrayOfMatrices: multiplyArrayOfMatrices,
|
|
902
|
+
matrixArrayToCSSMatrix: matrixArrayToCSSMatrix
|
|
790
903
|
});
|
|
791
904
|
|
|
792
|
-
const
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
if (Array.isArray(plane)) {
|
|
796
|
-
const [route, component, options] = plane;
|
|
797
|
-
return Object.assign({
|
|
798
|
-
route: route,
|
|
799
|
-
component: component
|
|
800
|
-
}, options);
|
|
801
|
-
}
|
|
802
|
-
return plane;
|
|
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;
|
|
803
908
|
};
|
|
804
909
|
|
|
805
|
-
const
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
910
|
+
const multiplyMatrices = (m1, m2) => {
|
|
911
|
+
const result = [];
|
|
912
|
+
for (let i = 0; i < m1.length; i++) {
|
|
913
|
+
result[i] = [];
|
|
914
|
+
for (let j = 0; j < m2[0].length; j++) {
|
|
915
|
+
let sum = 0;
|
|
916
|
+
for (let k = 0; k < m1[0].length; k++) {
|
|
917
|
+
sum += m1[i][k] * m2[k][j];
|
|
918
|
+
}
|
|
919
|
+
result[i][j] = sum;
|
|
920
|
+
}
|
|
812
921
|
}
|
|
813
|
-
return
|
|
922
|
+
return result;
|
|
814
923
|
};
|
|
815
924
|
|
|
816
|
-
const
|
|
817
|
-
if (
|
|
818
|
-
|
|
925
|
+
const multiplyMatricesArray = matrices => {
|
|
926
|
+
if (matrices.length < 2) {
|
|
927
|
+
throw new Error("invalid number of matrices");
|
|
819
928
|
}
|
|
820
|
-
const
|
|
821
|
-
|
|
822
|
-
|
|
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);
|
|
823
936
|
}
|
|
824
|
-
return
|
|
825
|
-
};
|
|
826
|
-
|
|
827
|
-
const extractPathname = location => {
|
|
828
|
-
const queryIndex = location.indexOf("?");
|
|
829
|
-
const noQueryPath = queryIndex === -1 ? location : location.substring(0, queryIndex);
|
|
830
|
-
const fragmentIndex = noQueryPath.indexOf("#:~:");
|
|
831
|
-
const noFragmentPath = fragmentIndex === -1 ? noQueryPath : noQueryPath.substring(0, fragmentIndex);
|
|
832
|
-
return noFragmentPath;
|
|
937
|
+
return result;
|
|
833
938
|
};
|
|
834
939
|
|
|
835
|
-
const
|
|
836
|
-
const
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
}));
|
|
845
|
-
const {locationElements: locationElements, comparingPath: comparingPath} = computeComparingPath(location, parameters);
|
|
846
|
-
if (comparingPath !== route) {
|
|
847
|
-
return {
|
|
848
|
-
match: false,
|
|
849
|
-
parameters: {},
|
|
850
|
-
elements: locationElements
|
|
851
|
-
};
|
|
940
|
+
const arrayToMatrix = array => {
|
|
941
|
+
const matrix = [];
|
|
942
|
+
for (let i = 0; i < array.length; i += 4) {
|
|
943
|
+
const row = [];
|
|
944
|
+
row.push(array[i]);
|
|
945
|
+
row.push(array[i + 1]);
|
|
946
|
+
row.push(array[i + 2]);
|
|
947
|
+
row.push(array[i + 3]);
|
|
948
|
+
matrix.push(row);
|
|
852
949
|
}
|
|
853
|
-
|
|
854
|
-
return {
|
|
855
|
-
match: true,
|
|
856
|
-
parameters: parametersValues,
|
|
857
|
-
elements: locationElements
|
|
858
|
-
};
|
|
950
|
+
return matrix;
|
|
859
951
|
};
|
|
860
952
|
|
|
861
|
-
const
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
parametersValues[parameterKey] = pathElements[index];
|
|
867
|
-
}
|
|
868
|
-
}));
|
|
869
|
-
return parametersValues;
|
|
953
|
+
const matrixToArray = matrix => matrix.flat();
|
|
954
|
+
|
|
955
|
+
const matrix3DToMatrix = value => {
|
|
956
|
+
const values = value.replace("matrix3d(", "").replace(")", "").split(",").map((val => parseFloat(val)));
|
|
957
|
+
return arrayToMatrix(values);
|
|
870
958
|
};
|
|
871
959
|
|
|
872
|
-
const
|
|
873
|
-
const
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
for (const index of locationElements.keys()) {
|
|
877
|
-
if (parameters[index]) {
|
|
878
|
-
comparingPathElements[index] = parameters[index];
|
|
960
|
+
const printMatrix = (matrix, name) => {
|
|
961
|
+
const normalize = value => {
|
|
962
|
+
if (value === 1 || value === 0) {
|
|
963
|
+
return value + " ";
|
|
879
964
|
}
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
comparingPath: comparingPath
|
|
965
|
+
if (value > 0) {
|
|
966
|
+
return value.toFixed(2) + " ";
|
|
967
|
+
}
|
|
968
|
+
return value.toFixed(2) + " ";
|
|
885
969
|
};
|
|
970
|
+
console.log("matrix", name + ":");
|
|
971
|
+
for (const row of matrix) {
|
|
972
|
+
console.log(normalize(row[0]), normalize(row[1]), normalize(row[2]), normalize(row[3]));
|
|
973
|
+
}
|
|
974
|
+
console.log(`matrix3d(${matrix.flat().join(",")})`);
|
|
975
|
+
console.log();
|
|
886
976
|
};
|
|
887
977
|
|
|
888
|
-
const
|
|
978
|
+
const rotateXMatrix = angle => {
|
|
979
|
+
const x = Math.cos(angle);
|
|
980
|
+
const y = -1 * Math.sin(angle);
|
|
981
|
+
const z = Math.sin(angle);
|
|
982
|
+
const m = [ [ 1, 0, 0, 0 ], [ 0, x, y, 0 ], [ 0, z, x, 0 ], [ 0, 0, 0, 1 ] ];
|
|
983
|
+
return m;
|
|
984
|
+
};
|
|
889
985
|
|
|
890
|
-
const
|
|
891
|
-
const
|
|
892
|
-
const
|
|
893
|
-
const
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
const query = querySplit[1];
|
|
897
|
-
const queryItems = query.split("&");
|
|
898
|
-
for (const item of queryItems) {
|
|
899
|
-
const queryValue = item.split("=");
|
|
900
|
-
const id = queryValue[0];
|
|
901
|
-
const value = decodeURIComponent(queryValue[1]);
|
|
902
|
-
queryValues[id] = value;
|
|
903
|
-
}
|
|
904
|
-
return queryValues;
|
|
905
|
-
} else {
|
|
906
|
-
return {};
|
|
907
|
-
}
|
|
986
|
+
const rotateYMatrix = angle => {
|
|
987
|
+
const x = Math.cos(angle);
|
|
988
|
+
const y = -1 * Math.sin(angle);
|
|
989
|
+
const z = Math.sin(angle);
|
|
990
|
+
const m = [ [ x, 0, z, 0 ], [ 0, 1, 0, 0 ], [ y, 0, x, 0 ], [ 0, 0, 0, 1 ] ];
|
|
991
|
+
return m;
|
|
908
992
|
};
|
|
909
993
|
|
|
910
|
-
const
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
const split = location.split("#:~:");
|
|
918
|
-
const fragmentsValues = split[1];
|
|
919
|
-
if (!fragmentsValues) {
|
|
920
|
-
return {
|
|
921
|
-
texts: [],
|
|
922
|
-
elements: []
|
|
923
|
-
};
|
|
924
|
-
}
|
|
925
|
-
const fragmentItems = fragmentsValues.split("&");
|
|
926
|
-
const textFragments = [];
|
|
927
|
-
const elementFragments = [];
|
|
928
|
-
for (const item of fragmentItems) {
|
|
929
|
-
const parsedFragment = parseFragment(item);
|
|
930
|
-
if (parsedFragment) {
|
|
931
|
-
switch (parsedFragment.type) {
|
|
932
|
-
case "text":
|
|
933
|
-
textFragments.push(parsedFragment);
|
|
934
|
-
break;
|
|
994
|
+
const rotateZMatrix = angle => {
|
|
995
|
+
const x = Math.cos(angle);
|
|
996
|
+
const y = -1 * Math.sin(angle);
|
|
997
|
+
const z = Math.sin(angle);
|
|
998
|
+
const m = [ [ x, y, 0, 0 ], [ z, x, 0, 0 ], [ 0, 0, 1, 0 ], [ 0, 0, 0, 1 ] ];
|
|
999
|
+
return m;
|
|
1000
|
+
};
|
|
935
1001
|
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
}
|
|
940
|
-
}
|
|
941
|
-
}
|
|
942
|
-
return {
|
|
943
|
-
texts: textFragments,
|
|
944
|
-
elements: elementFragments
|
|
945
|
-
};
|
|
1002
|
+
const translateMatrix = (x = 0, y = 0, z = 0) => {
|
|
1003
|
+
const m = [ [ 1, 0, 0, 0 ], [ 0, 1, 0, 0 ], [ 0, 0, 1, 0 ], [ x, y, z, 1 ] ];
|
|
1004
|
+
return m;
|
|
946
1005
|
};
|
|
947
1006
|
|
|
948
|
-
const
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
const
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
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;
|
|
961
1052
|
}
|
|
962
|
-
|
|
963
|
-
type: "text",
|
|
964
|
-
start: textStart,
|
|
965
|
-
end: textEnd || "",
|
|
966
|
-
occurence: textOccurence
|
|
967
|
-
};
|
|
1053
|
+
r++;
|
|
968
1054
|
}
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
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
|
+
}
|
|
977
1090
|
}
|
|
978
|
-
return {
|
|
979
|
-
type: "element",
|
|
980
|
-
id: elementID,
|
|
981
|
-
occurence: elementOccurence
|
|
982
|
-
};
|
|
983
1091
|
}
|
|
984
1092
|
}
|
|
985
|
-
return
|
|
1093
|
+
return B;
|
|
986
1094
|
};
|
|
987
1095
|
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
1096
|
+
var index$d = Object.freeze({
|
|
1097
|
+
__proto__: null,
|
|
1098
|
+
getInitialMatrix: getInitialMatrix,
|
|
1099
|
+
multiplyMatrices: multiplyMatrices,
|
|
1100
|
+
multiplyMatricesArray: multiplyMatricesArray,
|
|
1101
|
+
arrayToMatrix: arrayToMatrix,
|
|
1102
|
+
matrixToArray: matrixToArray,
|
|
1103
|
+
matrix3DToMatrix: matrix3DToMatrix,
|
|
1104
|
+
printMatrix: printMatrix,
|
|
1105
|
+
rotateXMatrix: rotateXMatrix,
|
|
1106
|
+
rotateYMatrix: rotateYMatrix,
|
|
1107
|
+
rotateZMatrix: rotateZMatrix,
|
|
1108
|
+
translateMatrix: translateMatrix,
|
|
1109
|
+
scaleMatrix: scaleMatrix,
|
|
1110
|
+
rotationMatrixFromQuaternion: rotationMatrixFromQuaternion,
|
|
1111
|
+
matrixToCSSMatrix: matrixToCSSMatrix,
|
|
1112
|
+
identityMatrix: identityMatrix,
|
|
1113
|
+
inverseMatrix: inverseMatrix
|
|
1114
|
+
});
|
|
1115
|
+
|
|
1116
|
+
function getMatrixValues(matrix3d) {
|
|
1117
|
+
const matrixValues = matrix3d.split("(")[1].split(")")[0].split(",");
|
|
1118
|
+
const matrixValuesInt = [];
|
|
1119
|
+
for (let i = 0; i < matrixValues.length; i++) {
|
|
1120
|
+
matrixValuesInt[i] = parseFloat(matrixValues[i]);
|
|
991
1121
|
}
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
return occurenceValue;
|
|
995
|
-
};
|
|
1122
|
+
return matrixValuesInt;
|
|
1123
|
+
}
|
|
996
1124
|
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1125
|
+
function getRotationMatrix(matrix3d) {
|
|
1126
|
+
const valuesMatrix = getMatrixValues(matrix3d);
|
|
1127
|
+
const scale = getScalationValue(matrix3d);
|
|
1128
|
+
if (valuesMatrix.length === 16) {
|
|
1129
|
+
for (let i = 0; i < 11; i++) {
|
|
1130
|
+
valuesMatrix[i] /= scale;
|
|
1131
|
+
}
|
|
1132
|
+
} else if (valuesMatrix.length === 6) {
|
|
1133
|
+
for (let i = 0; i < 4; i++) {
|
|
1134
|
+
valuesMatrix[i] /= scale;
|
|
1135
|
+
}
|
|
1000
1136
|
}
|
|
1001
|
-
|
|
1002
|
-
|
|
1137
|
+
const rotationMatrix = valuesMatrix;
|
|
1138
|
+
return rotationMatrix;
|
|
1139
|
+
}
|
|
1003
1140
|
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1141
|
+
function getTranslationMatrix(matrix3d) {
|
|
1142
|
+
const valuesMatrix = getMatrixValues(matrix3d);
|
|
1143
|
+
let translationMatrix;
|
|
1144
|
+
if (valuesMatrix.length === 16) {
|
|
1145
|
+
translationMatrix = getMatrixValues(matrix3d).slice(12, 15);
|
|
1146
|
+
} else if (valuesMatrix.length === 6) {
|
|
1147
|
+
translationMatrix = getMatrixValues(matrix3d).slice(4);
|
|
1007
1148
|
}
|
|
1008
|
-
return
|
|
1009
|
-
}
|
|
1149
|
+
return translationMatrix;
|
|
1150
|
+
}
|
|
1010
1151
|
|
|
1011
|
-
|
|
1152
|
+
function getScalationValue(matrix3d) {
|
|
1153
|
+
const valuesMatrix = getMatrixValues(matrix3d);
|
|
1154
|
+
let temp = 0;
|
|
1155
|
+
let scale;
|
|
1156
|
+
if (valuesMatrix.length === 16) {
|
|
1157
|
+
const scaleMatrix = getMatrixValues(matrix3d).slice(0, 4);
|
|
1158
|
+
scale = 0;
|
|
1159
|
+
for (const el of scaleMatrix) {
|
|
1160
|
+
scale += parseFloat(el) * parseFloat(el);
|
|
1161
|
+
}
|
|
1162
|
+
scale = parseFloat(Math.sqrt(scale).toPrecision(4));
|
|
1163
|
+
} else if (valuesMatrix.length === 6) {
|
|
1164
|
+
temp = valuesMatrix[0] * valuesMatrix[0] + valuesMatrix[1] * valuesMatrix[1];
|
|
1165
|
+
scale = parseFloat(Math.sqrt(temp).toPrecision(4));
|
|
1166
|
+
}
|
|
1167
|
+
return scale;
|
|
1168
|
+
}
|
|
1012
1169
|
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
};
|
|
1170
|
+
function setTransform(rotationMatrix, translationMatrix, scalationMatrix) {
|
|
1171
|
+
const transformMatrix = multiplyArrayOfMatrices([ translationMatrix, rotationMatrix, scalationMatrix ]);
|
|
1172
|
+
return matrixArrayToCSSMatrix(transformMatrix);
|
|
1173
|
+
}
|
|
1018
1174
|
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1175
|
+
function getTransformRotate(matrix3d) {
|
|
1176
|
+
const pi = Math.PI;
|
|
1177
|
+
const values = getRotationMatrix(matrix3d);
|
|
1178
|
+
let rotateX = 0;
|
|
1179
|
+
let rotateY = 0;
|
|
1180
|
+
if (values.length === 6) {
|
|
1181
|
+
const cosa = values[0];
|
|
1182
|
+
const sina = values[1];
|
|
1183
|
+
if (cosa === 1 && sina === 0) {
|
|
1184
|
+
rotateX = Math.asin(sina);
|
|
1185
|
+
rotateY = Math.acos(cosa);
|
|
1186
|
+
}
|
|
1030
1187
|
}
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
}
|
|
1188
|
+
if (values.length === 16) {
|
|
1189
|
+
const cosaX1 = values[5];
|
|
1190
|
+
const sinaX3 = values[9];
|
|
1191
|
+
if (sinaX3 <= 0) {
|
|
1192
|
+
rotateX = Math.acos(cosaX1);
|
|
1193
|
+
}
|
|
1194
|
+
if (sinaX3 > 0) {
|
|
1195
|
+
rotateX = 2 * pi - Math.acos(cosaX1);
|
|
1196
|
+
}
|
|
1197
|
+
const cosaY1 = values[0];
|
|
1198
|
+
const sinaY2 = values[2];
|
|
1199
|
+
if (sinaY2 <= 0) {
|
|
1200
|
+
rotateY = Math.acos(cosaY1);
|
|
1201
|
+
}
|
|
1202
|
+
if (sinaY2 > 0) {
|
|
1203
|
+
rotateY = 2 * pi - Math.acos(cosaY1);
|
|
1204
|
+
}
|
|
1205
|
+
rotateX = Math.atan2(values[9], values[5]);
|
|
1206
|
+
rotateY = Math.atan2(values[2], values[0]);
|
|
1207
|
+
}
|
|
1208
|
+
return {
|
|
1209
|
+
rotateX: rotateX,
|
|
1210
|
+
rotateY: rotateY,
|
|
1211
|
+
rotateZ: 0
|
|
1212
|
+
};
|
|
1213
|
+
}
|
|
1037
1214
|
|
|
1038
|
-
|
|
1215
|
+
function getTransformTranslate(matrix3d) {
|
|
1216
|
+
const values = getTranslationMatrix(matrix3d);
|
|
1217
|
+
const translateX = values[0];
|
|
1218
|
+
const translateY = values[1];
|
|
1219
|
+
const translateZ = values[2];
|
|
1220
|
+
return {
|
|
1221
|
+
translateX: translateX,
|
|
1222
|
+
translateY: translateY,
|
|
1223
|
+
translateZ: translateZ
|
|
1224
|
+
};
|
|
1225
|
+
}
|
|
1039
1226
|
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
}
|
|
1045
|
-
|
|
1046
|
-
|
|
1227
|
+
function getTransformScale(matrix3d) {
|
|
1228
|
+
const scale = getScalationValue(matrix3d);
|
|
1229
|
+
return {
|
|
1230
|
+
scale: scale
|
|
1231
|
+
};
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
function rotatePlurid(matrix3d, direction = "", angleIncrement = .07) {
|
|
1235
|
+
const transformRotate = getTransformRotate(matrix3d);
|
|
1236
|
+
const rotateX = transformRotate.rotateX;
|
|
1237
|
+
let rotateY = transformRotate.rotateY;
|
|
1238
|
+
const rotateZ = transformRotate.rotateZ;
|
|
1239
|
+
const transformTranslate = getTransformTranslate(matrix3d);
|
|
1240
|
+
const translateX = transformTranslate.translateX;
|
|
1241
|
+
const translateY = transformTranslate.translateY;
|
|
1242
|
+
const translateZ = transformTranslate.translateZ;
|
|
1243
|
+
const scale = getTransformScale(matrix3d).scale;
|
|
1244
|
+
let valRotationMatrix = rotateMatrix(rotateX, rotateY, rotateZ);
|
|
1245
|
+
const valTranslationMatrix = translateMatrix$1(translateX, translateY, translateZ);
|
|
1246
|
+
const valScalationMatrix = scaleMatrix$1(scale);
|
|
1247
|
+
if (direction === "left") {
|
|
1248
|
+
rotateY -= angleIncrement;
|
|
1249
|
+
valRotationMatrix = rotateMatrix(rotateX, rotateY);
|
|
1047
1250
|
}
|
|
1048
|
-
if (
|
|
1049
|
-
|
|
1251
|
+
if (direction === "right") {
|
|
1252
|
+
rotateY += angleIncrement;
|
|
1253
|
+
valRotationMatrix = rotateMatrix(rotateX, rotateY);
|
|
1050
1254
|
}
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
const removeTrailingSlash = value => {
|
|
1055
|
-
if (value.endsWith("/") && value.length > 1) {
|
|
1056
|
-
return value.slice(0, value.length - 1);
|
|
1255
|
+
if (direction === "up") {
|
|
1256
|
+
rotateY -= angleIncrement;
|
|
1257
|
+
valRotationMatrix = rotateMatrix(rotateX, rotateY);
|
|
1057
1258
|
}
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
const cleanPathValue = value => {
|
|
1062
|
-
const queryStart = value.indexOf("?");
|
|
1063
|
-
if (queryStart < 0) {
|
|
1064
|
-
return removeTrailingSlash(value);
|
|
1259
|
+
if (direction === "down") {
|
|
1260
|
+
rotateY += angleIncrement;
|
|
1261
|
+
valRotationMatrix = rotateMatrix(rotateX, rotateY);
|
|
1065
1262
|
}
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
const checkParameterLength = (parameter, length, compareType) => {
|
|
1070
|
-
const parameterLength = parameter.length;
|
|
1071
|
-
switch (compareType) {
|
|
1072
|
-
case pluridData.compareTypes.equal:
|
|
1073
|
-
return parameterLength === length;
|
|
1074
|
-
|
|
1075
|
-
case pluridData.compareTypes.equalLessThan:
|
|
1076
|
-
return parameterLength <= length;
|
|
1077
|
-
|
|
1078
|
-
case pluridData.compareTypes.lessThan:
|
|
1079
|
-
return parameterLength < length;
|
|
1080
|
-
|
|
1081
|
-
case pluridData.compareTypes.equalGreaterThan:
|
|
1082
|
-
return parameterLength >= length;
|
|
1083
|
-
|
|
1084
|
-
case pluridData.compareTypes.greaterThan:
|
|
1085
|
-
return parameterLength > length;
|
|
1263
|
+
const transformedMatrix3d = setTransform(valRotationMatrix, valTranslationMatrix, valScalationMatrix);
|
|
1264
|
+
return transformedMatrix3d;
|
|
1265
|
+
}
|
|
1086
1266
|
|
|
1087
|
-
|
|
1088
|
-
|
|
1267
|
+
function translatePlurid(matrix3d, direction = "", linearIncrement = 50) {
|
|
1268
|
+
const transformRotate = getTransformRotate(matrix3d);
|
|
1269
|
+
const rotateX = transformRotate.rotateX;
|
|
1270
|
+
const rotateY = transformRotate.rotateY;
|
|
1271
|
+
const rotateZ = transformRotate.rotateZ;
|
|
1272
|
+
const transformTranslate = getTransformTranslate(matrix3d);
|
|
1273
|
+
let translateX = transformTranslate.translateX;
|
|
1274
|
+
let translateY = transformTranslate.translateY;
|
|
1275
|
+
const translateZ = transformTranslate.translateZ;
|
|
1276
|
+
const scale = getTransformScale(matrix3d).scale;
|
|
1277
|
+
const valRotationMatrix = rotateMatrix(rotateX, rotateY, rotateZ);
|
|
1278
|
+
let valTranslationMatrix = translateMatrix$1(translateX, translateY, translateZ);
|
|
1279
|
+
const valScalationMatrix = scaleMatrix$1(scale);
|
|
1280
|
+
scale < .5 ? linearIncrement = 50 : linearIncrement = 30;
|
|
1281
|
+
if (direction === "left") {
|
|
1282
|
+
translateX += linearIncrement;
|
|
1283
|
+
valTranslationMatrix = translateMatrix$1(translateX, translateY, translateZ);
|
|
1089
1284
|
}
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
if (validationParameters) {
|
|
1094
|
-
for (const [parameterKey, parameterData] of Object.entries(validationParameters)) {
|
|
1095
|
-
const {length: length, lengthType: lengthType, startsWith: startsWith, endsWith: endsWith, includes: includes} = parameterData;
|
|
1096
|
-
const paramaterValue = parameters[parameterKey];
|
|
1097
|
-
if (!paramaterValue) {
|
|
1098
|
-
return false;
|
|
1099
|
-
}
|
|
1100
|
-
if (startsWith && !paramaterValue.startsWith(startsWith)) {
|
|
1101
|
-
return false;
|
|
1102
|
-
}
|
|
1103
|
-
if (endsWith && !paramaterValue.endsWith(endsWith)) {
|
|
1104
|
-
return false;
|
|
1105
|
-
}
|
|
1106
|
-
if (includes && !includes.includes(paramaterValue)) {
|
|
1107
|
-
return false;
|
|
1108
|
-
}
|
|
1109
|
-
if (length) {
|
|
1110
|
-
const validLength = checkParameterLength(paramaterValue, length, lengthType);
|
|
1111
|
-
return validLength;
|
|
1112
|
-
}
|
|
1113
|
-
}
|
|
1285
|
+
if (direction === "right") {
|
|
1286
|
+
translateX -= linearIncrement;
|
|
1287
|
+
valTranslationMatrix = translateMatrix$1(translateX, translateY, translateZ);
|
|
1114
1288
|
}
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
const cleanPathElement = path => {
|
|
1119
|
-
if (path[0] === "/") {
|
|
1120
|
-
return path.slice(1);
|
|
1289
|
+
if (direction === "up") {
|
|
1290
|
+
translateY += linearIncrement;
|
|
1291
|
+
valTranslationMatrix = translateMatrix$1(translateX, translateY, translateZ);
|
|
1121
1292
|
}
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
var index$a = Object.freeze({
|
|
1126
|
-
__proto__: null,
|
|
1127
|
-
cleanPathElement: cleanPathElement
|
|
1128
|
-
});
|
|
1129
|
-
|
|
1130
|
-
const mapPathsToRoutes = (paths, view) => {
|
|
1131
|
-
const routes = [];
|
|
1132
|
-
for (const [key, path] of Object.entries(paths)) {
|
|
1133
|
-
const pathView = view[key];
|
|
1134
|
-
if (pathView) {
|
|
1135
|
-
const route = {
|
|
1136
|
-
value: ""
|
|
1137
|
-
};
|
|
1138
|
-
routes.push(route);
|
|
1139
|
-
}
|
|
1293
|
+
if (direction === "down") {
|
|
1294
|
+
translateY -= linearIncrement;
|
|
1295
|
+
valTranslationMatrix = translateMatrix$1(translateX, translateY, translateZ);
|
|
1140
1296
|
}
|
|
1141
|
-
|
|
1142
|
-
|
|
1297
|
+
const transformedMatrix3d = setTransform(valRotationMatrix, valTranslationMatrix, valScalationMatrix);
|
|
1298
|
+
return transformedMatrix3d;
|
|
1299
|
+
}
|
|
1143
1300
|
|
|
1144
|
-
|
|
1145
|
-
const
|
|
1146
|
-
const
|
|
1147
|
-
const
|
|
1148
|
-
|
|
1149
|
-
const
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
const universe = {
|
|
1164
|
-
value: "",
|
|
1165
|
-
parameters: {},
|
|
1166
|
-
query: {}
|
|
1167
|
-
};
|
|
1168
|
-
const cluster = {
|
|
1169
|
-
value: "",
|
|
1170
|
-
parameters: {},
|
|
1171
|
-
query: {}
|
|
1172
|
-
};
|
|
1173
|
-
const plane = {
|
|
1174
|
-
value: "",
|
|
1175
|
-
parameters: {},
|
|
1176
|
-
query: {},
|
|
1177
|
-
fragments: {
|
|
1178
|
-
texts: [],
|
|
1179
|
-
elements: []
|
|
1180
|
-
}
|
|
1181
|
-
};
|
|
1182
|
-
const valid = false;
|
|
1183
|
-
if (split.length === 0 || split.length > 7) {
|
|
1184
|
-
const url = {
|
|
1185
|
-
protocol: {
|
|
1186
|
-
value: protocol,
|
|
1187
|
-
secure: true
|
|
1188
|
-
},
|
|
1189
|
-
host: host,
|
|
1190
|
-
path: path,
|
|
1191
|
-
space: space,
|
|
1192
|
-
universe: universe,
|
|
1193
|
-
cluster: cluster,
|
|
1194
|
-
plane: plane,
|
|
1195
|
-
valid: valid
|
|
1196
|
-
};
|
|
1197
|
-
return url;
|
|
1301
|
+
function scalePlurid(matrix3d, direction = "", scaleIncrement = .05) {
|
|
1302
|
+
const transformRotate = getTransformRotate(matrix3d);
|
|
1303
|
+
const rotateX = transformRotate.rotateX;
|
|
1304
|
+
const rotateY = transformRotate.rotateY;
|
|
1305
|
+
const rotateZ = transformRotate.rotateZ;
|
|
1306
|
+
const transformTranslate = getTransformTranslate(matrix3d);
|
|
1307
|
+
const translateX = transformTranslate.translateX;
|
|
1308
|
+
const translateY = transformTranslate.translateY;
|
|
1309
|
+
const translateZ = transformTranslate.translateZ;
|
|
1310
|
+
let scale = getTransformScale(matrix3d).scale;
|
|
1311
|
+
const valRotationMatrix = rotateMatrix(rotateX, rotateY, rotateZ);
|
|
1312
|
+
const valTranslationMatrix = translateMatrix$1(translateX, translateY, translateZ);
|
|
1313
|
+
let valScalationMatrix = scaleMatrix$1(scale);
|
|
1314
|
+
if (direction === "up") {
|
|
1315
|
+
scale -= scaleIncrement;
|
|
1316
|
+
if (scale < .1) {
|
|
1317
|
+
scale = .1;
|
|
1318
|
+
}
|
|
1319
|
+
valScalationMatrix = scaleMatrix$1(scale);
|
|
1198
1320
|
}
|
|
1199
|
-
if (
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
path.value = routeSplit[0];
|
|
1204
|
-
break;
|
|
1205
|
-
|
|
1206
|
-
case 5:
|
|
1207
|
-
path.value = routeSplit[0];
|
|
1208
|
-
space.value = routeSplit[1];
|
|
1209
|
-
universe.value = routeSplit[2];
|
|
1210
|
-
cluster.value = routeSplit[3];
|
|
1211
|
-
plane.value = routeSplit[4];
|
|
1212
|
-
break;
|
|
1321
|
+
if (direction === "down") {
|
|
1322
|
+
scale += scaleIncrement;
|
|
1323
|
+
if (scale > 4) {
|
|
1324
|
+
scale = 4;
|
|
1213
1325
|
}
|
|
1214
|
-
|
|
1215
|
-
protocol: {
|
|
1216
|
-
value: protocol,
|
|
1217
|
-
secure: true
|
|
1218
|
-
},
|
|
1219
|
-
host: host,
|
|
1220
|
-
path: path,
|
|
1221
|
-
space: space,
|
|
1222
|
-
universe: universe,
|
|
1223
|
-
cluster: cluster,
|
|
1224
|
-
plane: plane,
|
|
1225
|
-
valid: true
|
|
1226
|
-
};
|
|
1227
|
-
return url;
|
|
1326
|
+
valScalationMatrix = scaleMatrix$1(scale);
|
|
1228
1327
|
}
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
plane.value = split[0];
|
|
1233
|
-
break;
|
|
1234
|
-
|
|
1235
|
-
case 2:
|
|
1236
|
-
cluster.value = split[0];
|
|
1237
|
-
plane.value = split[1];
|
|
1238
|
-
break;
|
|
1239
|
-
|
|
1240
|
-
case 3:
|
|
1241
|
-
universe.value = split[0];
|
|
1242
|
-
cluster.value = split[1];
|
|
1243
|
-
plane.value = split[2];
|
|
1244
|
-
break;
|
|
1328
|
+
const transformedMatrix3d = setTransform(valRotationMatrix, valTranslationMatrix, valScalationMatrix);
|
|
1329
|
+
return transformedMatrix3d;
|
|
1330
|
+
}
|
|
1245
1331
|
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1332
|
+
var index$c = Object.freeze({
|
|
1333
|
+
__proto__: null,
|
|
1334
|
+
getMatrixValues: getMatrixValues,
|
|
1335
|
+
getRotationMatrix: getRotationMatrix,
|
|
1336
|
+
getTranslationMatrix: getTranslationMatrix,
|
|
1337
|
+
getScalationValue: getScalationValue,
|
|
1338
|
+
setTransform: setTransform,
|
|
1339
|
+
getTransformRotate: getTransformRotate,
|
|
1340
|
+
getTransformTranslate: getTransformTranslate,
|
|
1341
|
+
getTransformScale: getTransformScale,
|
|
1342
|
+
rotatePlurid: rotatePlurid,
|
|
1343
|
+
translatePlurid: translatePlurid,
|
|
1344
|
+
scalePlurid: scalePlurid
|
|
1345
|
+
});
|
|
1252
1346
|
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
plane.value = split[4];
|
|
1259
|
-
break;
|
|
1347
|
+
var index$b = Object.freeze({
|
|
1348
|
+
__proto__: null,
|
|
1349
|
+
general: index$d,
|
|
1350
|
+
matrix3d: index$c
|
|
1351
|
+
});
|
|
1260
1352
|
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
break;
|
|
1353
|
+
var index$a = Object.freeze({
|
|
1354
|
+
__proto__: null,
|
|
1355
|
+
direction: index$g,
|
|
1356
|
+
matrix: index$e,
|
|
1357
|
+
quaternion: index$f,
|
|
1358
|
+
transform: index$b
|
|
1359
|
+
});
|
|
1269
1360
|
|
|
1270
|
-
|
|
1271
|
-
const url = {
|
|
1272
|
-
protocol: {
|
|
1273
|
-
value: protocol,
|
|
1274
|
-
secure: true
|
|
1275
|
-
},
|
|
1276
|
-
host: host,
|
|
1277
|
-
path: path,
|
|
1278
|
-
space: space,
|
|
1279
|
-
universe: universe,
|
|
1280
|
-
cluster: cluster,
|
|
1281
|
-
plane: plane,
|
|
1282
|
-
valid: valid
|
|
1283
|
-
};
|
|
1284
|
-
return url;
|
|
1285
|
-
}
|
|
1286
|
-
} else {
|
|
1287
|
-
switch (split.length) {
|
|
1288
|
-
case 3:
|
|
1289
|
-
protocol = split[0];
|
|
1290
|
-
host.value = split[1];
|
|
1291
|
-
path.value = split[2];
|
|
1292
|
-
break;
|
|
1361
|
+
const internatiolate = (lamguage, field) => pluridData.internationalization[lamguage][field];
|
|
1293
1362
|
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1363
|
+
const resolvePluridPlaneData = plane => {
|
|
1364
|
+
if (Array.isArray(plane)) {
|
|
1365
|
+
const [route, component, options] = plane;
|
|
1366
|
+
return Object.assign({
|
|
1367
|
+
route: route,
|
|
1368
|
+
component: component
|
|
1369
|
+
}, options);
|
|
1370
|
+
}
|
|
1371
|
+
return plane;
|
|
1372
|
+
};
|
|
1303
1373
|
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
path: path,
|
|
1312
|
-
space: space,
|
|
1313
|
-
universe: universe,
|
|
1314
|
-
cluster: cluster,
|
|
1315
|
-
plane: plane,
|
|
1316
|
-
valid: valid
|
|
1317
|
-
};
|
|
1318
|
-
return url;
|
|
1319
|
-
}
|
|
1374
|
+
const resolvePluridRoutePlaneData = plane => {
|
|
1375
|
+
if (Array.isArray(plane)) {
|
|
1376
|
+
const [value, component, options] = plane;
|
|
1377
|
+
return Object.assign({
|
|
1378
|
+
value: value,
|
|
1379
|
+
component: component
|
|
1380
|
+
}, options);
|
|
1320
1381
|
}
|
|
1321
|
-
|
|
1322
|
-
protocol: {
|
|
1323
|
-
value: protocol,
|
|
1324
|
-
secure: true
|
|
1325
|
-
},
|
|
1326
|
-
host: host,
|
|
1327
|
-
path: path,
|
|
1328
|
-
space: space,
|
|
1329
|
-
universe: universe,
|
|
1330
|
-
cluster: cluster,
|
|
1331
|
-
plane: plane,
|
|
1332
|
-
valid: true
|
|
1333
|
-
};
|
|
1334
|
-
return url;
|
|
1382
|
+
return plane;
|
|
1335
1383
|
};
|
|
1336
1384
|
|
|
1337
|
-
const
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
const divisions = pluridLinkPathDivider(route);
|
|
1341
|
-
const defaultPathname = typeof window !== "undefined" ? window.location.pathname === "/" ? "p" : window.location.pathname.slice(1) : divisions.path.value ? divisions.path.value : "p";
|
|
1342
|
-
const protocolDivision = divisions.protocol.value || windowProtocol;
|
|
1343
|
-
const hostDivision = divisions.host.value ? divisions.host : {
|
|
1344
|
-
value: windowHost,
|
|
1345
|
-
controlled: true
|
|
1346
|
-
};
|
|
1347
|
-
const path = divisions.path.value ? divisions.path : {
|
|
1348
|
-
value: defaultPathname,
|
|
1349
|
-
parameters: {},
|
|
1350
|
-
query: {}
|
|
1351
|
-
};
|
|
1352
|
-
const space = divisions.space.value ? divisions.space : {
|
|
1353
|
-
value: "s",
|
|
1354
|
-
parameters: {},
|
|
1355
|
-
query: {}
|
|
1356
|
-
};
|
|
1357
|
-
const universe = divisions.universe.value ? divisions.universe : {
|
|
1358
|
-
value: "u",
|
|
1359
|
-
parameters: {},
|
|
1360
|
-
query: {}
|
|
1361
|
-
};
|
|
1362
|
-
const cluster = divisions.cluster.value ? divisions.cluster : {
|
|
1363
|
-
value: "c",
|
|
1364
|
-
parameters: {},
|
|
1365
|
-
query: {}
|
|
1366
|
-
};
|
|
1367
|
-
const plane = divisions.plane;
|
|
1368
|
-
const separator = "://";
|
|
1369
|
-
if (!plane.value && route !== "/") {
|
|
1370
|
-
const resolvers = [ protocolDivision, hostDivision.value, path.value ];
|
|
1371
|
-
const absoluteRoute = resolvers.join(separator);
|
|
1372
|
-
return {
|
|
1373
|
-
protocol: protocolDivision,
|
|
1374
|
-
host: hostDivision,
|
|
1375
|
-
path: path,
|
|
1376
|
-
space: space,
|
|
1377
|
-
universe: universe,
|
|
1378
|
-
cluster: cluster,
|
|
1379
|
-
plane: plane,
|
|
1380
|
-
route: absoluteRoute
|
|
1381
|
-
};
|
|
1385
|
+
const getPluridPlaneIDByData = element => {
|
|
1386
|
+
if (!element) {
|
|
1387
|
+
return "";
|
|
1382
1388
|
}
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
space: "",
|
|
1389
|
-
universe: "",
|
|
1390
|
-
cluster: "",
|
|
1391
|
-
plane: "",
|
|
1392
|
-
route: route
|
|
1393
|
-
};
|
|
1389
|
+
const parent = element.parentElement;
|
|
1390
|
+
if (parent && parent.dataset.pluridPlane) {
|
|
1391
|
+
return parent.dataset.pluridPlane;
|
|
1392
|
+
}
|
|
1393
|
+
return getPluridPlaneIDByData(parent);
|
|
1394
1394
|
};
|
|
1395
1395
|
|
|
1396
1396
|
class IsoMatcher {
|
|
@@ -2122,7 +2122,7 @@ var index$5 = Object.freeze({
|
|
|
2122
2122
|
computeZigZagLayout: computeZigZagLayout
|
|
2123
2123
|
});
|
|
2124
2124
|
|
|
2125
|
-
const resolveViewItem = (planes, view, configuration, origin = "origin") => {
|
|
2125
|
+
const resolveViewItem = (planes, view, configuration, origin = "origin", getCount) => {
|
|
2126
2126
|
const {protocol: protocol, host: host} = configuration.network;
|
|
2127
2127
|
const viewData = typeof view === "string" ? view : view.plane;
|
|
2128
2128
|
const viewAddress = computePlaneAddress(viewData, undefined, origin);
|
|
@@ -2141,9 +2141,11 @@ const resolveViewItem = (planes, view, configuration, origin = "origin") => {
|
|
|
2141
2141
|
const match = isoMatcher.match(viewData);
|
|
2142
2142
|
if (match) {
|
|
2143
2143
|
const route = match.match.value;
|
|
2144
|
+
const count = getCount ? getCount() : pluridFunctions.uuid.generate();
|
|
2145
|
+
const planeID = route + "@" + count;
|
|
2144
2146
|
const treePlane = {
|
|
2145
2147
|
sourceID: route,
|
|
2146
|
-
planeID:
|
|
2148
|
+
planeID: planeID,
|
|
2147
2149
|
route: viewAddress,
|
|
2148
2150
|
routeDivisions: {
|
|
2149
2151
|
protocol: {
|
|
@@ -2201,14 +2203,26 @@ const resolveViewItem = (planes, view, configuration, origin = "origin") => {
|
|
|
2201
2203
|
return;
|
|
2202
2204
|
};
|
|
2203
2205
|
|
|
2204
|
-
const computeSpaceTree = (planes, view, configuration, origin = "origin") => {
|
|
2206
|
+
const computeSpaceTree = (planes, view, configuration, layout, origin = "origin", getCount) => {
|
|
2205
2207
|
const treePlanes = [];
|
|
2206
2208
|
for (const viewItem of view) {
|
|
2207
|
-
const treePlane = resolveViewItem(planes, viewItem, configuration, origin);
|
|
2209
|
+
const treePlane = resolveViewItem(planes, viewItem, configuration, origin, getCount);
|
|
2208
2210
|
if (treePlane) {
|
|
2209
2211
|
treePlanes.push(treePlane);
|
|
2210
2212
|
}
|
|
2211
2213
|
}
|
|
2214
|
+
if (!layout) {
|
|
2215
|
+
const layoutlessTreePlanes = treePlanes.map((plane => Object.assign(Object.assign({}, plane), {
|
|
2216
|
+
location: {
|
|
2217
|
+
rotateX: 0,
|
|
2218
|
+
rotateY: 0,
|
|
2219
|
+
translateX: 0,
|
|
2220
|
+
translateY: 0,
|
|
2221
|
+
translateZ: 0
|
|
2222
|
+
}
|
|
2223
|
+
})));
|
|
2224
|
+
return layoutlessTreePlanes;
|
|
2225
|
+
}
|
|
2212
2226
|
switch (configuration.space.layout.type) {
|
|
2213
2227
|
case pluridData.LAYOUT_TYPES.COLUMNS:
|
|
2214
2228
|
{
|
|
@@ -2584,12 +2598,16 @@ var logic = Object.freeze({
|
|
|
2584
2598
|
|
|
2585
2599
|
class Tree {
|
|
2586
2600
|
constructor(data, origin = "origin") {
|
|
2601
|
+
this.count = 0;
|
|
2587
2602
|
this.data = data;
|
|
2588
2603
|
this.origin = origin;
|
|
2589
2604
|
}
|
|
2590
2605
|
compute() {
|
|
2591
|
-
const {planes: planes, view: view, configuration: configuration} = this.data;
|
|
2592
|
-
return computeSpaceTree(planes, view, configuration, this.origin);
|
|
2606
|
+
const {planes: planes, view: view, configuration: configuration, layout: layout} = this.data;
|
|
2607
|
+
return computeSpaceTree(planes, view, configuration, layout, this.origin, this.getCount.bind(this));
|
|
2608
|
+
}
|
|
2609
|
+
getCount() {
|
|
2610
|
+
return this.count++;
|
|
2593
2611
|
}
|
|
2594
2612
|
}
|
|
2595
2613
|
|
|
@@ -2665,8 +2683,9 @@ const resolveSpace = (view, configuration, planesRegistrar, currentState, localS
|
|
|
2665
2683
|
view: view
|
|
2666
2684
|
}, hostname);
|
|
2667
2685
|
const computedTree = spaceTree.compute();
|
|
2668
|
-
const stateSpace = Object.assign(Object.assign(Object.assign(Object.assign({
|
|
2686
|
+
const stateSpace = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({
|
|
2669
2687
|
loading: true,
|
|
2688
|
+
resolvedLayout: false,
|
|
2670
2689
|
animatedTransform: false,
|
|
2671
2690
|
transformTime: 450,
|
|
2672
2691
|
scale: 1,
|
|
@@ -2675,6 +2694,7 @@ const resolveSpace = (view, configuration, planesRegistrar, currentState, localS
|
|
|
2675
2694
|
translationX: 0,
|
|
2676
2695
|
translationY: 0,
|
|
2677
2696
|
translationZ: 0,
|
|
2697
|
+
transform: "matrix3d(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)",
|
|
2678
2698
|
activeUniverseID: "",
|
|
2679
2699
|
camera: {
|
|
2680
2700
|
x: 0,
|
|
@@ -2696,9 +2716,13 @@ const resolveSpace = (view, configuration, planesRegistrar, currentState, localS
|
|
|
2696
2716
|
}
|
|
2697
2717
|
},
|
|
2698
2718
|
culledView: [],
|
|
2699
|
-
|
|
2719
|
+
activePlaneID: "",
|
|
2720
|
+
isolatePlane: "",
|
|
2721
|
+
lastClosedPlane: "",
|
|
2700
2722
|
tree: computedTree
|
|
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)
|
|
2723
|
+
}, 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), {
|
|
2724
|
+
view: view
|
|
2725
|
+
});
|
|
2702
2726
|
if (currentState) {
|
|
2703
2727
|
stateSpace.translationX = currentState.space.translationX;
|
|
2704
2728
|
stateSpace.translationY = currentState.space.translationY;
|
|
@@ -2817,9 +2841,9 @@ const pluridRouterNavigate = path => {
|
|
|
2817
2841
|
|
|
2818
2842
|
exports.cleanTemplate = cleanTemplate;
|
|
2819
2843
|
|
|
2820
|
-
exports.general = index$
|
|
2844
|
+
exports.general = index$h;
|
|
2821
2845
|
|
|
2822
|
-
exports.interaction = index$
|
|
2846
|
+
exports.interaction = index$a;
|
|
2823
2847
|
|
|
2824
2848
|
exports.internatiolate = internatiolate;
|
|
2825
2849
|
|
|
@@ -2833,5 +2857,5 @@ exports.space = index$2;
|
|
|
2833
2857
|
|
|
2834
2858
|
exports.state = index;
|
|
2835
2859
|
|
|
2836
|
-
exports.utilities = index$
|
|
2860
|
+
exports.utilities = index$j;
|
|
2837
2861
|
//# sourceMappingURL=index.js.map
|