architwin 1.12.5 → 1.13.1
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/CORE_FEATURES.md +35 -0
- package/lib/architwin.d.ts +96 -5
- package/lib/architwin.js +1 -1
- package/lib/atwinui/components/toolbar/collapse.d.ts +18 -0
- package/lib/atwinui/components/toolbar/collapse.js +62 -0
- package/lib/atwinui/components/toolbar/i18n.js +56 -4
- package/lib/atwinui/components/toolbar/index.js +11 -1
- package/lib/atwinui/components/toolbar/menuBar.d.ts +1 -0
- package/lib/atwinui/components/toolbar/menuBar.js +11 -0
- package/lib/atwinui/components/toolbar/pipeFormPane.d.ts +31 -0
- package/lib/atwinui/components/toolbar/pipeFormPane.js +545 -0
- package/lib/atwinui/components/toolbar/pipeListPane.d.ts +19 -0
- package/lib/atwinui/components/toolbar/pipeListPane.js +388 -0
- package/lib/atwinui/components/toolbar/spaceUserListPane.d.ts +3 -0
- package/lib/atwinui/components/toolbar/spaceUserListPane.js +95 -0
- package/lib/atwinui/components/toolbar/tagFormPane.d.ts +1 -0
- package/lib/atwinui/components/toolbar/tagFormPane.js +4 -1
- package/lib/atwinui/components/toolbar/tagIotForm.d.ts +20 -0
- package/lib/atwinui/components/toolbar/tagIotForm.js +391 -0
- package/lib/atwinui/components/toolbar/tagIotFormPane.d.ts +62 -0
- package/lib/atwinui/components/toolbar/tagIotFormPane.js +606 -0
- package/lib/atwinui/components/toolbar/tagMessagingPane.js +5 -5
- package/lib/atwinui/components/toolbar/usersPane.d.ts +14 -0
- package/lib/atwinui/components/toolbar/usersPane.js +273 -0
- package/lib/atwinui/components/toolbar/viewingRemoteSpace.d.ts +7 -0
- package/lib/atwinui/components/toolbar/viewingRemoteSpace.js +77 -0
- package/lib/atwinui/events.d.ts +4 -1
- package/lib/atwinui/events.js +96 -15
- package/lib/atwinui/helpers.d.ts +15 -0
- package/lib/atwinui/helpers.js +49 -0
- package/lib/atwinui/index.js +2 -0
- package/lib/loaders/curosrMarkerLoader.d.ts +25 -0
- package/lib/loaders/curosrMarkerLoader.js +86 -0
- package/lib/loaders/index.d.ts +2 -1
- package/lib/loaders/index.js +2 -1
- package/lib/loaders/pathLoader.d.ts +99 -0
- package/lib/loaders/pathLoader.js +451 -0
- package/lib/minimap.d.ts +4 -2
- package/lib/minimap.js +16 -3
- package/lib/types.d.ts +86 -2
- package/lib/types.js +39 -0
- package/package.json +1 -1
- package/static/atwinui.css +263 -0
- package/static/map.css +9 -1
- package/static/utility.css +81 -1
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
import { Pane } from 'tweakpane';
|
|
2
|
+
import { dispatchSpaceEvent } from "../architwin";
|
|
3
|
+
import { SPACE_EVENTS } from "../types";
|
|
4
|
+
export class PathLine {
|
|
5
|
+
constructor(mpSdk) {
|
|
6
|
+
this.time = 0;
|
|
7
|
+
this.closed = false;
|
|
8
|
+
this.billboard = undefined;
|
|
9
|
+
this.hovered = false;
|
|
10
|
+
this.length = 0;
|
|
11
|
+
this.inputs = {
|
|
12
|
+
name: '',
|
|
13
|
+
label: 'Path Line',
|
|
14
|
+
description: '',
|
|
15
|
+
node: null,
|
|
16
|
+
tubes: null,
|
|
17
|
+
path: null,
|
|
18
|
+
enabled: true,
|
|
19
|
+
active: false,
|
|
20
|
+
editMode: false,
|
|
21
|
+
direction: -1,
|
|
22
|
+
curveType: 'catmullrom',
|
|
23
|
+
opacity: 0.3,
|
|
24
|
+
tubularSegments: 100,
|
|
25
|
+
radialSegments: 20,
|
|
26
|
+
fillColor: 'none',
|
|
27
|
+
textColor: 'rgb(255,255,255)',
|
|
28
|
+
text: '➡︎',
|
|
29
|
+
font: '48px sans-serif',
|
|
30
|
+
radius: 0.05,
|
|
31
|
+
scrollSpeed: 1.35,
|
|
32
|
+
collider: true,
|
|
33
|
+
visible: true,
|
|
34
|
+
pathOptions: null
|
|
35
|
+
};
|
|
36
|
+
//@ts-expect-error
|
|
37
|
+
this.outputs = {
|
|
38
|
+
length: 0,
|
|
39
|
+
gui: {},
|
|
40
|
+
};
|
|
41
|
+
this.emits = {
|
|
42
|
+
active: true,
|
|
43
|
+
destroyed: true,
|
|
44
|
+
};
|
|
45
|
+
this.events = {
|
|
46
|
+
'INTERACTION.CLICK': true,
|
|
47
|
+
'INTERACTION.HOVER': false,
|
|
48
|
+
};
|
|
49
|
+
this.onInit = () => {
|
|
50
|
+
const THREE = this.context.three;
|
|
51
|
+
this.groupedMesh = new THREE.Group();
|
|
52
|
+
if (this.inputs.active) {
|
|
53
|
+
//this.renderGUI();
|
|
54
|
+
}
|
|
55
|
+
if (this.inputs.path.length > 1) {
|
|
56
|
+
this.renderPathLine();
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
this.onInputsUpdated = (prevInputs) => {
|
|
60
|
+
if (this.inputs !== prevInputs) {
|
|
61
|
+
const THREE = this.context.three;
|
|
62
|
+
this.groupedMesh = new THREE.Group();
|
|
63
|
+
if (!this.inputs.active && this.panel) {
|
|
64
|
+
this.panel.dispose();
|
|
65
|
+
//@ts-expect-error
|
|
66
|
+
this.panel = false;
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
if (!this.panel || this.inputs.label !== prevInputs.label) {
|
|
70
|
+
//console.log('Rendering GUI...');
|
|
71
|
+
// this.renderGUI();
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (this.inputs.pathOptions) {
|
|
75
|
+
const excludedKeys = ['id', 'pathOptions'];
|
|
76
|
+
for (let key in this.inputs) {
|
|
77
|
+
if (!excludedKeys.includes(key)) {
|
|
78
|
+
if (this.inputs.pathOptions[key]) {
|
|
79
|
+
this.inputs[key] = this.inputs.pathOptions[key];
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
if (this.inputs.path.length > 1) {
|
|
85
|
+
this.renderPathLine();
|
|
86
|
+
console.log("paths ", this.inputs.path);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
this.renderPathLine = () => {
|
|
91
|
+
const THREE = this.context.three;
|
|
92
|
+
// Find Length
|
|
93
|
+
let sections = this.inputs.path.length - 1;
|
|
94
|
+
this.length = 0;
|
|
95
|
+
for (let i = 0; i < sections; i++) {
|
|
96
|
+
const start = new THREE.Vector3(this.inputs.path[i].x, this.inputs.path[i].y, this.inputs.path[i].z);
|
|
97
|
+
const end = new THREE.Vector3(this.inputs.path[i + 1].x, this.inputs.path[i + 1].y, this.inputs.path[i + 1].z);
|
|
98
|
+
this.length += start.distanceTo(end);
|
|
99
|
+
}
|
|
100
|
+
const ctx = document.createElement('canvas').getContext('2d');
|
|
101
|
+
if (!ctx) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
ctx.canvas.width = 64;
|
|
105
|
+
ctx.canvas.height = 64;
|
|
106
|
+
if (this.inputs.fillColor == 'none') {
|
|
107
|
+
ctx.clearRect(0, 0, 64, 64);
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
// background
|
|
111
|
+
let fillColorRGBA = this.inputs.fillColor.replace(/rgb/i, 'rgba');
|
|
112
|
+
fillColorRGBA = fillColorRGBA.replace(/\)/i, ',' + (this.hovered ? 0.9 : this.inputs.opacity) + ')');
|
|
113
|
+
ctx.fillStyle = fillColorRGBA;
|
|
114
|
+
ctx.fillRect(0, 0, 64, 64);
|
|
115
|
+
}
|
|
116
|
+
// render out text measurement in the rendered line
|
|
117
|
+
ctx.translate(32, 32);
|
|
118
|
+
ctx.fillStyle = this.inputs.textColor;
|
|
119
|
+
ctx.textAlign = 'center';
|
|
120
|
+
ctx.textBaseline = 'middle';
|
|
121
|
+
ctx.font = this.inputs.font;
|
|
122
|
+
ctx.fillText(this.inputs.text, 0, 0);
|
|
123
|
+
this.texture = new THREE.CanvasTexture(ctx.canvas);
|
|
124
|
+
this.texture.wrapS = THREE.RepeatWrapping;
|
|
125
|
+
this.texture.wrapT = THREE.RepeatWrapping;
|
|
126
|
+
this.texture.repeat.set(this.length, 3);
|
|
127
|
+
this.material = new THREE.MeshBasicMaterial({
|
|
128
|
+
map: this.texture,
|
|
129
|
+
side: THREE.DoubleSide,
|
|
130
|
+
depthWrite: false,
|
|
131
|
+
depthTest: true,
|
|
132
|
+
transparent: true,
|
|
133
|
+
//@ts-expect-error
|
|
134
|
+
flatShading: true,
|
|
135
|
+
emissive: 0x072534,
|
|
136
|
+
});
|
|
137
|
+
if (this.inputs.path !== null) {
|
|
138
|
+
this.tubeGeometry && this.tubeGeometry.dispose();
|
|
139
|
+
this.tubeGeometry = new THREE.TubeGeometry(new THREE.CatmullRomCurve3(this.inputs.path, false,
|
|
140
|
+
//@ts-expect-error
|
|
141
|
+
this.inputs.curveType, this.inputs.curveType == 'catmullrom' ? 0.25 : 0), this.inputs.tubularSegments, // tubularSegments
|
|
142
|
+
this.inputs.radius, this.inputs.radialSegments, // radialSegments
|
|
143
|
+
this.closed // closed
|
|
144
|
+
);
|
|
145
|
+
this.mesh = new THREE.Mesh(this.tubeGeometry, this.material);
|
|
146
|
+
}
|
|
147
|
+
this.mesh.name = this.inputs.name;
|
|
148
|
+
this.outputs.length = this.length;
|
|
149
|
+
this.groupedMesh.add(this.mesh);
|
|
150
|
+
this.mesh.visible = this.inputs.visible;
|
|
151
|
+
if (this.inputs.enabled) {
|
|
152
|
+
this.outputs.objectRoot = this.mesh;
|
|
153
|
+
this.outputs.collider = this.inputs.collider ? this.mesh : null;
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
this.outputs.objectRoot = null;
|
|
157
|
+
this.outputs.collider = null;
|
|
158
|
+
}
|
|
159
|
+
if (this.panel) {
|
|
160
|
+
this.panel.refresh();
|
|
161
|
+
}
|
|
162
|
+
dispatchSpaceEvent(SPACE_EVENTS.PATH_UPDATED, {
|
|
163
|
+
path: this.inputs.path,
|
|
164
|
+
textColor: this.inputs.textColor
|
|
165
|
+
});
|
|
166
|
+
};
|
|
167
|
+
this.setBillboard = (value) => {
|
|
168
|
+
this.billboard = value;
|
|
169
|
+
};
|
|
170
|
+
//This is just a temp gui I need for debugging and experimentation purposes. Will be commented out once I am done
|
|
171
|
+
this.renderGUI = () => {
|
|
172
|
+
if (this.panel) {
|
|
173
|
+
this.panel.dispose();
|
|
174
|
+
}
|
|
175
|
+
this.panel = new Pane({
|
|
176
|
+
//width: 260,
|
|
177
|
+
title: 'Scrolling Tube Creator',
|
|
178
|
+
container: document.getElementById('objgui'),
|
|
179
|
+
});
|
|
180
|
+
const tab = this.panel.addTab({
|
|
181
|
+
pages: [{ title: 'Edit' }, { title: 'All Drawings' }],
|
|
182
|
+
});
|
|
183
|
+
const folder1 = tab.pages[0].addFolder({ title: 'Inputs' });
|
|
184
|
+
folder1.addBinding(this.inputs, 'name');
|
|
185
|
+
folder1.addBinding(this.inputs, 'label');
|
|
186
|
+
folder1.addBinding(this.inputs, 'description', {
|
|
187
|
+
readonly: false,
|
|
188
|
+
multiline: true,
|
|
189
|
+
rows: 5,
|
|
190
|
+
});
|
|
191
|
+
folder1.addBinding(this.inputs, 'text', {
|
|
192
|
+
options: { ' ': ' ', '➡︎': '➡︎', '✳': '✳', '☠': '☠' },
|
|
193
|
+
});
|
|
194
|
+
folder1.addBinding(this.inputs, 'textColor');
|
|
195
|
+
folder1.addBinding(this.inputs, 'fillColor');
|
|
196
|
+
folder1.addBinding(this.inputs, 'direction', {
|
|
197
|
+
options: { 'Left to Right': -1, 'Right to Left': 1 },
|
|
198
|
+
});
|
|
199
|
+
folder1.addBinding(this.outputs, 'length', {
|
|
200
|
+
readonly: true,
|
|
201
|
+
});
|
|
202
|
+
// If the node was passed as an input, we can run node.destroy();
|
|
203
|
+
if (this.inputs.node) {
|
|
204
|
+
const remove = folder1.addButton({ title: 'Remove', label: 'Remove' });
|
|
205
|
+
remove.on('click', () => {
|
|
206
|
+
//@ts-expect-error
|
|
207
|
+
this.notify('destroyed');
|
|
208
|
+
this.panel.dispose();
|
|
209
|
+
//@ts-expect-error
|
|
210
|
+
this.panel = false;
|
|
211
|
+
this.inputs.active = false;
|
|
212
|
+
this.inputs.node.stop();
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
const folder2 = tab.pages[0].addFolder({
|
|
216
|
+
title: 'Advanced',
|
|
217
|
+
expanded: true,
|
|
218
|
+
});
|
|
219
|
+
folder2.addBinding(this.inputs, 'enabled');
|
|
220
|
+
folder2.addBinding(this.inputs, 'opacity', { min: 0, max: 1, step: 0.05 });
|
|
221
|
+
folder2.addBinding(this.inputs, 'radius', {
|
|
222
|
+
min: 0.01,
|
|
223
|
+
max: 1,
|
|
224
|
+
step: 0.01,
|
|
225
|
+
});
|
|
226
|
+
folder2.addBinding(this.inputs, 'scrollSpeed', {
|
|
227
|
+
min: 0,
|
|
228
|
+
max: 5,
|
|
229
|
+
step: 0.05,
|
|
230
|
+
});
|
|
231
|
+
folder2.addBinding(this.inputs, 'tubularSegments', {
|
|
232
|
+
min: 1,
|
|
233
|
+
max: 100,
|
|
234
|
+
step: 1,
|
|
235
|
+
});
|
|
236
|
+
folder2.addBinding(this.inputs, 'radialSegments', {
|
|
237
|
+
min: 1,
|
|
238
|
+
max: 20,
|
|
239
|
+
step: 1,
|
|
240
|
+
});
|
|
241
|
+
folder2.addBinding(this.inputs, 'collider');
|
|
242
|
+
if (this.inputs.tubes !== null) {
|
|
243
|
+
const nodeIterator = this.inputs.tubes.nodeIterator();
|
|
244
|
+
let nodes = nodeIterator.next();
|
|
245
|
+
while (!nodes.done) {
|
|
246
|
+
const componentIterator = nodes.value.componentIterator();
|
|
247
|
+
let component = componentIterator.next();
|
|
248
|
+
nodes = nodeIterator.next();
|
|
249
|
+
const button = tab.pages[1].addButton({
|
|
250
|
+
title: component.value.inputs.label,
|
|
251
|
+
label: '=',
|
|
252
|
+
});
|
|
253
|
+
button.on('click', (data) => {
|
|
254
|
+
// This needs to be reviewed
|
|
255
|
+
if (!component.value.inputs.active) {
|
|
256
|
+
//@ts-expect-error
|
|
257
|
+
this.notify('active', { component: component.value });
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
this.mpSdk = mpSdk;
|
|
264
|
+
}
|
|
265
|
+
onEvent(eventType, data) {
|
|
266
|
+
if (eventType === 'INTERACTION.CLICK') {
|
|
267
|
+
//@ts-expect-error
|
|
268
|
+
this.notify('active', { component: this });
|
|
269
|
+
// Show a Tag Billboard with the info of this tube
|
|
270
|
+
if (!this.billboard) {
|
|
271
|
+
// Allow access to these variables within then callbacks.
|
|
272
|
+
var mpSdk = this.mpSdk;
|
|
273
|
+
mpSdk.Tag.toggleNavControls(false);
|
|
274
|
+
mpSdk.Tag.add({
|
|
275
|
+
label: this.inputs.label,
|
|
276
|
+
description: this.inputs.description +
|
|
277
|
+
' - ' +
|
|
278
|
+
Math.round(this.length * 1000) / 1000 +
|
|
279
|
+
'm',
|
|
280
|
+
anchorPosition: {
|
|
281
|
+
x: data.point.x,
|
|
282
|
+
y: data.point.y,
|
|
283
|
+
z: data.point.z,
|
|
284
|
+
},
|
|
285
|
+
stemVector: {
|
|
286
|
+
x: 0,
|
|
287
|
+
y: 0,
|
|
288
|
+
z: 0,
|
|
289
|
+
},
|
|
290
|
+
}).then((tags) => {
|
|
291
|
+
this.setBillboard(tags[0]);
|
|
292
|
+
mpSdk.Tag.allowAction(tags[0], {
|
|
293
|
+
opening: true,
|
|
294
|
+
navigating: true,
|
|
295
|
+
});
|
|
296
|
+
mpSdk.Tag.editOpacity(tags[0], 0);
|
|
297
|
+
mpSdk.Tag.open(tags[0]).then(() => {
|
|
298
|
+
let tagDestroyer = mpSdk.Tag.openTags.subscribe((newState) => {
|
|
299
|
+
if (newState.selected.size == 0) {
|
|
300
|
+
let thisTag = newState.selected;
|
|
301
|
+
//@ts-expect-error
|
|
302
|
+
if (thisTag != tags[0]) {
|
|
303
|
+
mpSdk.Tag.remove(tags[0]);
|
|
304
|
+
tagDestroyer.cancel();
|
|
305
|
+
this.setBillboard(false);
|
|
306
|
+
mpSdk.Tag.toggleNavControls(true);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
});
|
|
310
|
+
});
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
onTick(tickDelta) {
|
|
316
|
+
if (this.inputs.scrollSpeed > 0) {
|
|
317
|
+
this.time += tickDelta;
|
|
318
|
+
if (this.texture) {
|
|
319
|
+
this.texture.offset.x =
|
|
320
|
+
(this.inputs.direction *
|
|
321
|
+
((this.inputs.scrollSpeed * this.time) / 1000)) %
|
|
322
|
+
1;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
onDestroy() {
|
|
327
|
+
this.texture.dispose();
|
|
328
|
+
if (this.panel) {
|
|
329
|
+
this.panel.dispose();
|
|
330
|
+
//@ts-expect-error
|
|
331
|
+
this.panel = false;
|
|
332
|
+
}
|
|
333
|
+
if (this.billboard) {
|
|
334
|
+
this.mpSdk.Tag.remove(this.billboard);
|
|
335
|
+
console.log('Nav Controls On');
|
|
336
|
+
this.mpSdk.Tag.toggleNavControls(true);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
export const pathLineType = 'pathLine';
|
|
341
|
+
export const pathLineFactory = function (mpSdk) {
|
|
342
|
+
return function () {
|
|
343
|
+
return new PathLine(mpSdk);
|
|
344
|
+
};
|
|
345
|
+
};
|
|
346
|
+
export class PathPoint {
|
|
347
|
+
constructor(mpSdk) {
|
|
348
|
+
this.inputs = {
|
|
349
|
+
index: null,
|
|
350
|
+
radius: 0.05,
|
|
351
|
+
position: null,
|
|
352
|
+
fillColor: 'rgb(11,57,72)',
|
|
353
|
+
hoverColor: 'rgb(255,0,0)',
|
|
354
|
+
ringVisibility: false
|
|
355
|
+
};
|
|
356
|
+
this.emits = {
|
|
357
|
+
active: true,
|
|
358
|
+
changed: true,
|
|
359
|
+
};
|
|
360
|
+
this.events = {
|
|
361
|
+
'INTERACTION.DRAG': true,
|
|
362
|
+
'INTERACTION.DRAG_BEGIN': true,
|
|
363
|
+
'INTERACTION.DRAG_END': true,
|
|
364
|
+
'INTERACTION.HOVER': true,
|
|
365
|
+
};
|
|
366
|
+
this.onInputsUpdated = (prevInputs) => {
|
|
367
|
+
this.renderVertice(false);
|
|
368
|
+
};
|
|
369
|
+
this.onInit = () => {
|
|
370
|
+
this.renderVertice();
|
|
371
|
+
};
|
|
372
|
+
this.renderVertice = (hovered = false) => {
|
|
373
|
+
const THREE = this.context.three;
|
|
374
|
+
const group = new THREE.Group();
|
|
375
|
+
//This is just a visual marker so that the user can see the points they have already marked
|
|
376
|
+
this.geometry = new THREE.SphereGeometry(this.inputs.radius, 16, 16);
|
|
377
|
+
this.material = new THREE.MeshBasicMaterial({
|
|
378
|
+
color: (hovered ? this.inputs.hoverColor : this.inputs.fillColor),
|
|
379
|
+
transparent: true,
|
|
380
|
+
opacity: 0.6,
|
|
381
|
+
});
|
|
382
|
+
this.mesh = new THREE.Mesh(this.geometry, this.material);
|
|
383
|
+
this.mesh.position.set(this.inputs.position.x, this.inputs.position.y, this.inputs.position.z);
|
|
384
|
+
this.outputs.objectRoot = this.mesh;
|
|
385
|
+
this.outputs.collider = this.mesh;
|
|
386
|
+
};
|
|
387
|
+
this.mpSdk = mpSdk;
|
|
388
|
+
}
|
|
389
|
+
onEvent(eventType, data) {
|
|
390
|
+
var _a;
|
|
391
|
+
if (eventType === 'INTERACTION.DRAG') {
|
|
392
|
+
//this.pointerIntersection.object === 'intersectedobject.model'
|
|
393
|
+
//this.pointerIntersection.object
|
|
394
|
+
console.log("group this.pointerIntersection ", this.pointerIntersection);
|
|
395
|
+
if (this.pointerIntersection.object === 'intersectedobject.model') {
|
|
396
|
+
let e = Object.assign({}, this.pointerIntersection.position);
|
|
397
|
+
this.mesh.position.set(e.x, e.y, e.z);
|
|
398
|
+
//this.mesh.children[0].position.set(e.x, e.y, e.z)
|
|
399
|
+
//@ts-expect-error
|
|
400
|
+
this.notify('changed', {
|
|
401
|
+
index: this.inputs.index,
|
|
402
|
+
position: this.mesh.position,
|
|
403
|
+
collider: null,
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
if (eventType === 'INTERACTION.DRAG_BEGIN') {
|
|
408
|
+
this.mpSdk.Pointer.setVisible(false);
|
|
409
|
+
//@ts-expect-error
|
|
410
|
+
this.mesh.material.opacity = 0.5;
|
|
411
|
+
//this.mesh.children[0].material.opacity = 0.5
|
|
412
|
+
// will make it smaller later. Setting this to 0.5 to make it easier to see in the space
|
|
413
|
+
this.mesh.scale.set(0.5, 0.5, 0.5);
|
|
414
|
+
if (this.pointerSub == null) {
|
|
415
|
+
this.pointerSub = this.mpSdk.Pointer.intersection.subscribe((data) => {
|
|
416
|
+
this.pointerIntersection = data;
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
//@ts-expect-error
|
|
420
|
+
this.notify('changed', {
|
|
421
|
+
index: this.inputs.index,
|
|
422
|
+
position: this.mesh.position,
|
|
423
|
+
collider: false,
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
if (eventType === 'INTERACTION.DRAG_END') {
|
|
427
|
+
//@ts-expect-error
|
|
428
|
+
this.mesh.material.opacity = 1;
|
|
429
|
+
this.mesh.scale.set(1, 1, 1);
|
|
430
|
+
this.mpSdk.Pointer.setVisible(true);
|
|
431
|
+
(_a = this.pointerSub) === null || _a === void 0 ? void 0 : _a.cancel();
|
|
432
|
+
//renderPolygonFromPath()
|
|
433
|
+
//@ts-expect-error
|
|
434
|
+
this.notify('changed', {
|
|
435
|
+
index: this.inputs.index,
|
|
436
|
+
position: this.mesh.position,
|
|
437
|
+
collider: false,
|
|
438
|
+
});
|
|
439
|
+
dispatchSpaceEvent(SPACE_EVENTS.VERTEX_DRAG_END, {
|
|
440
|
+
index: this.inputs.index,
|
|
441
|
+
position: this.mesh.position
|
|
442
|
+
});
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
export const pathPointType = 'pathPoint';
|
|
447
|
+
export const pathPointFactory = function (mpSdk) {
|
|
448
|
+
return function () {
|
|
449
|
+
return new PathPoint(mpSdk);
|
|
450
|
+
};
|
|
451
|
+
};
|
package/lib/minimap.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MpSdk } from "../bundle/sdk";
|
|
2
|
-
import { ISweep, SweepColor, DEGREE, CustomMapFloorData } from "./types";
|
|
2
|
+
import { ISweep, SweepColor, DEGREE, CustomMapFloorData, CUSTOM_MAP_MODE } from "./types";
|
|
3
3
|
import 'notyf/notyf.min.css';
|
|
4
4
|
declare let isMinimapNavigation: boolean;
|
|
5
5
|
interface FloorData {
|
|
@@ -120,4 +120,6 @@ declare function getCustomMapFloorData(index?: number): CustomMapFloorData[] | C
|
|
|
120
120
|
declare function resetCustomMapSettingValues(): void;
|
|
121
121
|
declare function setMpSDK(mpSdk: MpSdk): void;
|
|
122
122
|
declare function getMpSdk(): MpSdk;
|
|
123
|
-
|
|
123
|
+
declare function setCustomMapMode(mode: CUSTOM_MAP_MODE): void;
|
|
124
|
+
declare function getCustomMapMode(): CUSTOM_MAP_MODE;
|
|
125
|
+
export { isMinimapNavigation, mapPositions, setMap, showMinimap, hideMinimap, locateAvatar, resetSweepMarkerColors, renderOverlaySweep, showDirection, toggleMinimapVisibility, setSweepMarkerColor, setStandaloneMap, toggleMinimapFloor, getFloorsInSpace, createDropdown, setMinimapPosition, setCurrentMinimapPosition, setCustomMap, setupCustomMinimapPane, setCustomMinimapRotation, getCustomMinimapRotation, generateCustomMinimap, setCustomMapScale, setCustomMapTranslate, setCustomMapXOffset, setCustomMapYOffset, getCustomMapScale, getCustomMapTranslate, getCustomMapXOffset, getCustomMapYOffset, setMinAndMax, setCustomMapFloorData, getCustomMapFloorData, resetCustomMapSettingValues, getMinimapPosition, subscribeToFloorChanges, setMpSDK, getMpSdk, setCustomMapMode, getCustomMapMode };
|
package/lib/minimap.js
CHANGED
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import * as superviz from './superviz';
|
|
11
11
|
import { _mpConfig, getCurrentCameraPose, getCurrentSweep, getMapConfig, dispatchSpaceEvent, isCdnMapDataAvailable, getCurrentFloor, minimap } from "./architwin";
|
|
12
|
-
import { SPACE_EVENTS, DEGREE, MAP_OPTIONS } from "./types";
|
|
12
|
+
import { SPACE_EVENTS, DEGREE, MAP_OPTIONS, CUSTOM_MAP_MODE } from "./types";
|
|
13
13
|
import { isValidCSSColor } from "./color";
|
|
14
14
|
import { _participants } from "./participant";
|
|
15
15
|
import { getAtwinSdk } from "./architwin";
|
|
@@ -46,6 +46,7 @@ let _customMapContainer;
|
|
|
46
46
|
let _customMapFloorData = [];
|
|
47
47
|
let _minimapPosition = "bottomRight";
|
|
48
48
|
let _mpSdk;
|
|
49
|
+
let _customMapMode = CUSTOM_MAP_MODE.DEFAULT;
|
|
49
50
|
let notyf = new Notyf({ position: { x: 'left', y: 'bottom' }, duration: 4500, types: [
|
|
50
51
|
{
|
|
51
52
|
type: 'info',
|
|
@@ -1343,7 +1344,12 @@ function displaySweepToCustomMap(sweepItem, mpSdk) {
|
|
|
1343
1344
|
const posY = sweepItem.y;
|
|
1344
1345
|
let thisSweep = document.createElement('button');
|
|
1345
1346
|
log.info("getCurrentSweep().id ==> ", getCurrentSweep().id);
|
|
1346
|
-
const
|
|
1347
|
+
const isActive = getCurrentSweep().id === sweepItem.id;
|
|
1348
|
+
const isDefaultMode = _customMapMode === CUSTOM_MAP_MODE.DEFAULT;
|
|
1349
|
+
const cList = isActive
|
|
1350
|
+
? 'at_custom_sweep active'
|
|
1351
|
+
: `at_custom_sweep ${isDefaultMode ? 'at_sweep_color_default' : 'at_sweep_color_edit'}`;
|
|
1352
|
+
// const cList = getCurrentSweep().id === sweepItem.id ? 'at_custom_sweep active' : 'at_custom_sweep'
|
|
1347
1353
|
const scaleX = _customMapScale;
|
|
1348
1354
|
const scaleY = (_customMapScale * 21 / 9) / _customMapTranslate;
|
|
1349
1355
|
const scaledX = scaleToContainer(posX, minX, maxX, scaleX, 0);
|
|
@@ -1618,8 +1624,15 @@ function setMpSDK(mpSdk) {
|
|
|
1618
1624
|
function getMpSdk() {
|
|
1619
1625
|
return _mpSdk;
|
|
1620
1626
|
}
|
|
1627
|
+
function setCustomMapMode(mode) {
|
|
1628
|
+
log.info("__@ setCustomMapMode: ", mode);
|
|
1629
|
+
_customMapMode = mode;
|
|
1630
|
+
}
|
|
1631
|
+
function getCustomMapMode() {
|
|
1632
|
+
return _customMapMode;
|
|
1633
|
+
}
|
|
1621
1634
|
export {
|
|
1622
1635
|
// _miniMapData as minimapData,
|
|
1623
1636
|
isMinimapNavigation, mapPositions, setMap, showMinimap, hideMinimap, locateAvatar, resetSweepMarkerColors, renderOverlaySweep, showDirection, toggleMinimapVisibility, setSweepMarkerColor, setStandaloneMap, toggleMinimapFloor, getFloorsInSpace, createDropdown, setMinimapPosition, setCurrentMinimapPosition,
|
|
1624
1637
|
// custom minimap
|
|
1625
|
-
setCustomMap, setupCustomMinimapPane, setCustomMinimapRotation, getCustomMinimapRotation, generateCustomMinimap, setCustomMapScale, setCustomMapTranslate, setCustomMapXOffset, setCustomMapYOffset, getCustomMapScale, getCustomMapTranslate, getCustomMapXOffset, getCustomMapYOffset, setMinAndMax, setCustomMapFloorData, getCustomMapFloorData, resetCustomMapSettingValues, getMinimapPosition, subscribeToFloorChanges, setMpSDK, getMpSdk };
|
|
1638
|
+
setCustomMap, setupCustomMinimapPane, setCustomMinimapRotation, getCustomMinimapRotation, generateCustomMinimap, setCustomMapScale, setCustomMapTranslate, setCustomMapXOffset, setCustomMapYOffset, getCustomMapScale, getCustomMapTranslate, getCustomMapXOffset, getCustomMapYOffset, setMinAndMax, setCustomMapFloorData, getCustomMapFloorData, resetCustomMapSettingValues, getMinimapPosition, subscribeToFloorChanges, setMpSDK, getMpSdk, setCustomMapMode, getCustomMapMode };
|
package/lib/types.d.ts
CHANGED
|
@@ -446,6 +446,8 @@ export interface ComponentOptions {
|
|
|
446
446
|
polygonData?: PolygonData | undefined;
|
|
447
447
|
wallHeight?: number | undefined;
|
|
448
448
|
floorLevel?: number | undefined;
|
|
449
|
+
lineComponentType?: string | undefined;
|
|
450
|
+
id?: number | undefined;
|
|
449
451
|
}
|
|
450
452
|
export interface VectorCoords {
|
|
451
453
|
object_position: Vector3;
|
|
@@ -731,7 +733,23 @@ export declare enum SPACE_EVENTS {
|
|
|
731
733
|
CUSTOM_SWEEP_OFFSETY_UPDATED = "CUSTOM_SWEEP_OFFSETY_UPDATED",
|
|
732
734
|
CUSTOM_MAP_SETTINGS_UPDATED = "CUSTOM_MAP_SETTINGS_UPDATED",
|
|
733
735
|
SPACE_METADATA_RETRIEVED = "SPACE_METADATA_RETRIEVED",
|
|
734
|
-
|
|
736
|
+
RENDER_PIPE_CATEGORY = "RENDER_PIPE_CATEGORY",
|
|
737
|
+
PIPE_CATEGORY_REMOVED = "PIPE_CATEGORY_REMOVED",
|
|
738
|
+
PIPE_CATEGORY_SAVED = "PIPE_CATEGORY_SAVED",
|
|
739
|
+
PIPE_CATEGORY_SELECTED = "PIPE_CATEGORY_SELECTED",
|
|
740
|
+
PIPE_CATEGORY_ON_CHANGE = "PIPE_CATEGORY_ON_CHANGE",
|
|
741
|
+
PIPE_SAVED = "PIPE_SAVED",
|
|
742
|
+
PIPE_REMOVED = "PIPE_REMOVED",
|
|
743
|
+
PIPE_ON_CHANGE = "PIPE_ON_CHANGE",
|
|
744
|
+
PIPE_CLICKED = "PIPE_CLICKED",
|
|
745
|
+
PIPE_ADD = "PIPE_ADD",
|
|
746
|
+
PIPE_SELECTED = "PIPE_SELECTED",
|
|
747
|
+
DRAW_PIPE = "DRAW_PIPE",
|
|
748
|
+
DRAW_PIPE_UNDO = "DRAW_PIPE_UNDO",
|
|
749
|
+
DRAW_PIPE_REDO = "DRAW_PIPE_REDO",
|
|
750
|
+
PIPE_VERTEX_REMOVED = "PIPE_VERTEX_REMOVED",
|
|
751
|
+
TAG_MESSAGE_UNSEND = "TAG_MESSAGE_UNSEND",
|
|
752
|
+
PATH_UPDATED = "PATH_UPDATED"
|
|
735
753
|
}
|
|
736
754
|
export declare const enum TAG_COLOR {
|
|
737
755
|
MAROON = "MAROON",
|
|
@@ -885,6 +903,7 @@ export interface IToolbarConfig {
|
|
|
885
903
|
includeMeasurements?: boolean;
|
|
886
904
|
includeViews?: boolean;
|
|
887
905
|
};
|
|
906
|
+
pipe?: boolean;
|
|
888
907
|
models?: boolean;
|
|
889
908
|
minimap?: boolean;
|
|
890
909
|
theme?: boolean;
|
|
@@ -988,6 +1007,7 @@ export interface TagMessage {
|
|
|
988
1007
|
binaryFile?: File;
|
|
989
1008
|
created_on?: any;
|
|
990
1009
|
modified_on?: any;
|
|
1010
|
+
is_sender?: boolean;
|
|
991
1011
|
}
|
|
992
1012
|
export interface EmbedlyData {
|
|
993
1013
|
author_name: string;
|
|
@@ -1097,7 +1117,8 @@ export declare const enum SCREEN_POSITIONS {
|
|
|
1097
1117
|
}
|
|
1098
1118
|
export declare const enum FORM_MODE {
|
|
1099
1119
|
ADD = "ADD",
|
|
1100
|
-
EDIT = "EDIT"
|
|
1120
|
+
EDIT = "EDIT",
|
|
1121
|
+
NONE = "NONE"
|
|
1101
1122
|
}
|
|
1102
1123
|
export declare enum ZOOM_COMMAND {
|
|
1103
1124
|
TOGGLE_VIDEO_ON = "TOGGLE VIDEO ON",
|
|
@@ -1280,6 +1301,18 @@ export interface SpaceMetadata {
|
|
|
1280
1301
|
};
|
|
1281
1302
|
};
|
|
1282
1303
|
}
|
|
1304
|
+
export interface PathConfig {
|
|
1305
|
+
lineType: string;
|
|
1306
|
+
verticeType: string;
|
|
1307
|
+
lineTypeComponentConfig?: ComponentOptions;
|
|
1308
|
+
verticeTypeComponentConfig?: ComponentOptions;
|
|
1309
|
+
}
|
|
1310
|
+
export interface ModelPayload {
|
|
1311
|
+
mediaUrl: string;
|
|
1312
|
+
objectType: string;
|
|
1313
|
+
config?: ObjectConfig;
|
|
1314
|
+
object_data?: I3DObject;
|
|
1315
|
+
}
|
|
1283
1316
|
export declare enum COORDINATE_SYSTEM {
|
|
1284
1317
|
MATTERPORT = "YUP",
|
|
1285
1318
|
BIM = "ZUP"
|
|
@@ -1304,3 +1337,54 @@ export declare enum MAP_OPTIONS {
|
|
|
1304
1337
|
DEFAULT_MAP = "Default Minimap",
|
|
1305
1338
|
CUSTOM_MAP = "Custom Minimap"
|
|
1306
1339
|
}
|
|
1340
|
+
export declare enum CUSTOM_MAP_MODE {
|
|
1341
|
+
DEFAULT = "DEFAULT",
|
|
1342
|
+
EDIT = "EDIT"
|
|
1343
|
+
}
|
|
1344
|
+
export interface VetexData {
|
|
1345
|
+
uuid: string;
|
|
1346
|
+
name: string;
|
|
1347
|
+
path: Array<Vector3>;
|
|
1348
|
+
}
|
|
1349
|
+
export interface IPipeCategory {
|
|
1350
|
+
uuid: string;
|
|
1351
|
+
space_uuid: string;
|
|
1352
|
+
name: string;
|
|
1353
|
+
parent_uuid: string;
|
|
1354
|
+
json_data: string;
|
|
1355
|
+
color?: string;
|
|
1356
|
+
pipes: Array<IPipe>;
|
|
1357
|
+
owner_uuid?: string;
|
|
1358
|
+
created_on: Date;
|
|
1359
|
+
}
|
|
1360
|
+
export interface IPipe {
|
|
1361
|
+
uuid: string;
|
|
1362
|
+
space_uuid: string;
|
|
1363
|
+
name: string;
|
|
1364
|
+
category_uuid: string;
|
|
1365
|
+
json_data: string;
|
|
1366
|
+
created_on: Date;
|
|
1367
|
+
}
|
|
1368
|
+
export declare enum COLLAPSE {
|
|
1369
|
+
TOGGLE_ID = "at-collapse-toggle-btn",
|
|
1370
|
+
CONTENT_ID = "at-collapse-content",
|
|
1371
|
+
ACTIVE = "active",
|
|
1372
|
+
EXPAND = "expand",
|
|
1373
|
+
TOGGLE = "toggle",
|
|
1374
|
+
INACTIVE = "inactive",
|
|
1375
|
+
LIST = "at-collapse-list",
|
|
1376
|
+
HEADER = "at-collapse-header",
|
|
1377
|
+
FORM = "at-collapse-form",
|
|
1378
|
+
ITEM = "item"
|
|
1379
|
+
}
|
|
1380
|
+
export declare enum DRAWING_MODE {
|
|
1381
|
+
ACTIVE = "active",
|
|
1382
|
+
INACTIVE = "inactive"
|
|
1383
|
+
}
|
|
1384
|
+
export interface PipePayload {
|
|
1385
|
+
uuid?: string | undefined;
|
|
1386
|
+
space_uuid?: string | undefined;
|
|
1387
|
+
name?: string | undefined;
|
|
1388
|
+
parent_uuid?: string | undefined;
|
|
1389
|
+
json_data: PolygonData;
|
|
1390
|
+
}
|