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