architwin 1.10.10 → 2.0.0
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/lib/architwin.d.ts +7 -2
- package/lib/architwin.js +83 -10
- package/lib/atwinui/components/toolbar/actionSettingsPane.d.ts +6 -1
- package/lib/atwinui/components/toolbar/actionSettingsPane.js +70 -21
- package/lib/atwinui/components/toolbar/i18n.js +12 -2
- package/lib/atwinui/components/toolbar/menuBar.js +1 -4
- package/lib/atwinui/components/toolbar/modelControlsPane.d.ts +5 -1
- package/lib/atwinui/components/toolbar/modelControlsPane.js +324 -65
- package/lib/atwinui/events.js +177 -11
- package/lib/types.d.ts +30 -1
- package/lib/types.js +6 -0
- package/lib/worldConversion.d.ts +1 -0
- package/lib/worldConversion.js +23 -0
- package/package.json +1 -1
- package/static/atwinui.css +5 -0
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { degreesToRadians, radiansToDegrees, useCapitalizeFirstLetter } from "../../../utils";
|
|
2
|
-
import { getSelectedObject } from "../../../architwin";
|
|
3
|
-
import {
|
|
2
|
+
import { getSelectedObject, setObjectTransformation, get3DXObjects, _mpConfig } from "../../../architwin";
|
|
3
|
+
import { COORDINATE_SYSTEM } from "../../../types";
|
|
4
|
+
import { convertZupToYup, convertYupToZup, getOffsetPositionFromBasepoint } from "../../../worldConversion";
|
|
5
|
+
import { getScaleFactor, getMeasurementUnit, getBasepoint, getCoordinateSystem, isAdjust } from "./actionSettingsPane";
|
|
4
6
|
import { Notyf } from 'notyf';
|
|
5
7
|
import log from 'loglevel';
|
|
6
8
|
import i18n from "./i18n";
|
|
9
|
+
import { getBasepointObjectPayload } from "./actionSettingsPane";
|
|
7
10
|
let notyf = new Notyf({ position: { x: 'left', y: 'bottom' }, duration: 4500 });
|
|
8
11
|
export let activeModelControlPane = false;
|
|
9
12
|
export let modelControlPane;
|
|
@@ -12,8 +15,13 @@ let inputX;
|
|
|
12
15
|
let inputY;
|
|
13
16
|
let inputZ;
|
|
14
17
|
let isInputEventListenerSet = false;
|
|
15
|
-
|
|
18
|
+
let basepointCoord;
|
|
19
|
+
let coordSystem = '';
|
|
20
|
+
let measurementUnit = '';
|
|
21
|
+
let scaleFactor = '';
|
|
22
|
+
let selectedObjectCoordinateSystem;
|
|
16
23
|
export function renderModelControlPane(type = 'Translate') {
|
|
24
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
17
25
|
const element = document.createElement('div');
|
|
18
26
|
element.classList.add('at_container');
|
|
19
27
|
element.classList.add('at_h-full');
|
|
@@ -26,7 +34,21 @@ export function renderModelControlPane(type = 'Translate') {
|
|
|
26
34
|
<span class="at_bolder at_text_base" id="at-transform-type-title">${i18n.t(type)}</span>
|
|
27
35
|
<span class="mdi mdi-close at_text_base" style="cursor:pointer" id="at-close-model-controls" data-cy="at-close-model-controls"></span>
|
|
28
36
|
</div>
|
|
29
|
-
<span id="at-coordinate-system-text" class="at_text_xs">${i18n.t("CoordinateSystem")}: ${i18n.t("Matterport")}</span>
|
|
37
|
+
<span style="display:${((_b = (_a = _mpConfig.toolbarConfig) === null || _a === void 0 ? void 0 : _a.menuItems) === null || _b === void 0 ? void 0 : _b.bim) ? 'block' : 'none'}" id="at-coordinate-system-text" class="at_text_xs">${i18n.t("CoordinateSystem")}: ${i18n.t("Matterport")}</span>
|
|
38
|
+
<div style="display:${((_d = (_c = _mpConfig.toolbarConfig) === null || _c === void 0 ? void 0 : _c.menuItems) === null || _d === void 0 ? void 0 : _d.bim) ? 'block' : 'none'}" class="at_flex at_flex_column at_gap_2" id="at-coordinate-container">
|
|
39
|
+
<label class="at_text_xs">${i18n.t("CoordinateSystem")}</label>
|
|
40
|
+
<div class="at_flex at_justify_center at_gap_4">
|
|
41
|
+
<label class="at_flex at_align_center at_text_xxs at_gap_1">
|
|
42
|
+
<input type="radio" id="at-settings-radio-matterport" name="obj-coordinate-system" value="matterport" checked />
|
|
43
|
+
${i18n.t("Matterport")}
|
|
44
|
+
</label>
|
|
45
|
+
<label class="at_flex at_align_center at_text_xxs at_gap_1">
|
|
46
|
+
<input type="radio" id="at-settings-radio-bim" name="obj-coordinate-system" value="bim" />
|
|
47
|
+
${i18n.t("Bim")}
|
|
48
|
+
</label>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
|
|
30
52
|
<div class="at_number_field">
|
|
31
53
|
<span class="at_bolder">X</span>
|
|
32
54
|
<input type="number" id="at-input-x" class="at_rounded_input"/>
|
|
@@ -42,7 +64,7 @@ export function renderModelControlPane(type = 'Translate') {
|
|
|
42
64
|
<input type="number" id="at-input-z" class="at_rounded_input"/>
|
|
43
65
|
<span class="at_bolder at_model_unit">m</span>
|
|
44
66
|
</div>
|
|
45
|
-
<div class="at_mt_static_text at_mt_static_text_container at_inline_block at_rounded">
|
|
67
|
+
<div style="display:${((_f = (_e = _mpConfig.toolbarConfig) === null || _e === void 0 ? void 0 : _e.menuItems) === null || _f === void 0 ? void 0 : _f.bim) ? 'block' : 'none'}" class="at_mt_static_text at_mt_static_text_container at_inline_block at_rounded" id="at-mt-static-text-container">
|
|
46
68
|
<span class="at_text_xxs at_mx-w-16" id="at-transform-note">Matterport</span>
|
|
47
69
|
<span class="at_text_xxs">x:</span>
|
|
48
70
|
<span class="at_text_xxs at_mt_cal_text" id="at-mt-coordx"></span>
|
|
@@ -51,7 +73,7 @@ export function renderModelControlPane(type = 'Translate') {
|
|
|
51
73
|
<span class="at_text_xxs">z:</span>
|
|
52
74
|
<span class="at_text_xxs at_mt_cal_text" id="at-mt-coordz"></span>
|
|
53
75
|
</div>
|
|
54
|
-
<span class="at_text_xxs at_mx-w-16" id="at-transform-note">
|
|
76
|
+
<span style="display:${((_h = (_g = _mpConfig.toolbarConfig) === null || _g === void 0 ? void 0 : _g.menuItems) === null || _h === void 0 ? void 0 : _h.bim) ? 'block' : 'none'}" class="at_text_xxs at_mx-w-16" id="at-transform-note">
|
|
55
77
|
${i18n.t("CoordinateNote")}
|
|
56
78
|
</span>
|
|
57
79
|
<button class="at_button at_cat_confirm_btn" id="at-confirm-transform" data-cy="at-confirm-transform">${i18n.t('Confirm')}</button>
|
|
@@ -69,6 +91,7 @@ export function toggleModelControl(visible = true, type = 'translate') {
|
|
|
69
91
|
modelControlPane.style.display = 'block';
|
|
70
92
|
setTransformType(type);
|
|
71
93
|
showCurrentCoordinateValue();
|
|
94
|
+
setCoordinateSystemType();
|
|
72
95
|
log.info("=====test toggle: ", type);
|
|
73
96
|
return;
|
|
74
97
|
}
|
|
@@ -131,11 +154,17 @@ export function getCoordinateValues() {
|
|
|
131
154
|
}
|
|
132
155
|
const selectedObject = getSelectedObject();
|
|
133
156
|
const transform = {};
|
|
134
|
-
|
|
135
|
-
|
|
157
|
+
let newRotationValue;
|
|
158
|
+
if (selectedObject.type == "BASEPOINT") {
|
|
159
|
+
newRotationValue = { x: 1.57079633, y: 0, z: 0 };
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
newRotationValue = transformType === 'rotate' ? degreesToRadians(formCoords) : selectedObject.node.quaternion;
|
|
163
|
+
}
|
|
164
|
+
log.info("degreeToRadianRotation ", newRotationValue);
|
|
136
165
|
transform.object_position = transformType === 'translate' ? formCoords : selectedObject.node.position;
|
|
137
166
|
transform.object_scale = transformType === 'scale' ? formCoords : selectedObject.node.scale;
|
|
138
|
-
transform.object_rotation =
|
|
167
|
+
transform.object_rotation = newRotationValue;
|
|
139
168
|
console.log("getCoordinateValues rotation quaternion values", selectedObject.node.quaternion);
|
|
140
169
|
return transform;
|
|
141
170
|
}
|
|
@@ -166,18 +195,40 @@ export function showCurrentCoordinateValue(payload) {
|
|
|
166
195
|
inputZ = document.getElementById('at-input-z');
|
|
167
196
|
}
|
|
168
197
|
const selectedObject = getSelectedObject();
|
|
198
|
+
getCoordinateSetup();
|
|
199
|
+
initObjectCoordinateSystem();
|
|
200
|
+
isCoordinatesDisplay();
|
|
169
201
|
if (!selectedObject) {
|
|
170
202
|
console.error("selectedObject is undefined");
|
|
171
203
|
return;
|
|
172
204
|
}
|
|
173
205
|
if (transformType == 'translate') {
|
|
206
|
+
// if (_mpConfig.toolbarConfig.menuItems && _mpConfig.toolbarConfig.menuItems.bim) {
|
|
207
|
+
// const coordinateSwitch = document.getElementById('at-coordinate-container')
|
|
208
|
+
// const coordinateText = document.getElementById('at-coordinate-system-text')
|
|
209
|
+
// if (coordinateSwitch && isAdjust == true) {
|
|
210
|
+
// coordinateSwitch.style.display = 'none'
|
|
211
|
+
// coordinateText.style.display = 'block'
|
|
212
|
+
// }
|
|
213
|
+
// if (coordinateText && isAdjust == false) {
|
|
214
|
+
// coordinateText.style.display = 'none'
|
|
215
|
+
// coordinateSwitch.style.display = 'block'
|
|
216
|
+
// }
|
|
217
|
+
// }
|
|
174
218
|
const currentPos = selectedObject.node.position;
|
|
175
219
|
inputX.value = currentPos.x.toFixed(3).toString();
|
|
176
220
|
inputY.value = currentPos.y.toFixed(3).toString();
|
|
177
221
|
inputZ.value = currentPos.z.toFixed(3).toString();
|
|
178
|
-
updateDisplayedCoordinates()
|
|
222
|
+
// updateDisplayedCoordinates()
|
|
223
|
+
displayMTCoordinates();
|
|
179
224
|
}
|
|
180
225
|
else if (transformType == 'rotate') {
|
|
226
|
+
if (_mpConfig.toolbarConfig.menuItems && _mpConfig.toolbarConfig.menuItems.bim) {
|
|
227
|
+
const coordinateSwitch = document.getElementById('at-coordinate-container');
|
|
228
|
+
if (coordinateSwitch) {
|
|
229
|
+
coordinateSwitch.style.display = 'none';
|
|
230
|
+
}
|
|
231
|
+
}
|
|
181
232
|
//@ts-expect-error
|
|
182
233
|
log.info("obj3D rotation ", selectedObject.node.obj3D.rotation);
|
|
183
234
|
//@ts-expect-error
|
|
@@ -193,14 +244,26 @@ export function showCurrentCoordinateValue(payload) {
|
|
|
193
244
|
inputX.setAttribute('radian-value', rotationDegreeFormat.x.toString());
|
|
194
245
|
inputY.setAttribute('radian-value', rotationDegreeFormat.y.toString());
|
|
195
246
|
inputZ.setAttribute('radian-value', rotationDegreeFormat.z.toString());
|
|
196
|
-
updateDisplayedCoordinates()
|
|
247
|
+
// updateDisplayedCoordinates()
|
|
248
|
+
displayMTCoordinates();
|
|
197
249
|
}
|
|
198
250
|
else if (transformType == 'scale') {
|
|
251
|
+
if (_mpConfig.toolbarConfig.menuItems && _mpConfig.toolbarConfig.menuItems.bim) {
|
|
252
|
+
const coordinateSwitch = document.getElementById('at-coordinate-container');
|
|
253
|
+
const coordinateText = document.getElementById('at-coordinate-system-text');
|
|
254
|
+
if (coordinateSwitch) {
|
|
255
|
+
coordinateSwitch.style.display = 'block';
|
|
256
|
+
}
|
|
257
|
+
if (coordinateText && isAdjust == false) {
|
|
258
|
+
coordinateText.style.display = 'none';
|
|
259
|
+
}
|
|
260
|
+
}
|
|
199
261
|
const currentScale = selectedObject.node.scale;
|
|
200
262
|
inputX.value = currentScale.x.toFixed(3).toString();
|
|
201
263
|
inputY.value = currentScale.y.toFixed(3).toString();
|
|
202
264
|
inputZ.value = currentScale.z.toFixed(3).toString();
|
|
203
|
-
updateDisplayedCoordinates()
|
|
265
|
+
// updateDisplayedCoordinates()
|
|
266
|
+
displayMTCoordinates();
|
|
204
267
|
}
|
|
205
268
|
}
|
|
206
269
|
function setModelInputUnit(type) {
|
|
@@ -260,70 +323,266 @@ export function handleModelControlInputs() {
|
|
|
260
323
|
inputX.addEventListener('input', onModelControlInput);
|
|
261
324
|
inputY.addEventListener('input', onModelControlInput);
|
|
262
325
|
inputZ.addEventListener('input', onModelControlInput);
|
|
263
|
-
updateDisplayedCoordinates()
|
|
326
|
+
// updateDisplayedCoordinates()
|
|
327
|
+
displayMTCoordinates();
|
|
328
|
+
}
|
|
329
|
+
function getCoordinateSetup() {
|
|
330
|
+
log.info("getCoordinateSetup()");
|
|
331
|
+
// gets basepoint value
|
|
332
|
+
if (getBasepoint()) {
|
|
333
|
+
basepointCoord = getBasepoint();
|
|
334
|
+
log.info("=======basepoint: ", basepointCoord);
|
|
335
|
+
}
|
|
336
|
+
// get the coordinate system
|
|
337
|
+
if (getCoordinateSystem()) {
|
|
338
|
+
coordSystem = getCoordinateSystem();
|
|
339
|
+
log.info("=======coordsystem: ", coordSystem);
|
|
340
|
+
}
|
|
341
|
+
// get the measurement unit
|
|
342
|
+
if (getMeasurementUnit()) {
|
|
343
|
+
measurementUnit = getMeasurementUnit();
|
|
344
|
+
log.info("=======measurement: ", measurementUnit);
|
|
345
|
+
}
|
|
346
|
+
// get the scale factor
|
|
347
|
+
if (getScaleFactor()) {
|
|
348
|
+
scaleFactor = getScaleFactor();
|
|
349
|
+
log.info("=======scalefactor: ", scaleFactor);
|
|
350
|
+
}
|
|
264
351
|
}
|
|
265
|
-
function updateDisplayedCoordinates() {
|
|
266
|
-
log.info("
|
|
352
|
+
export function updateDisplayedCoordinates() {
|
|
353
|
+
log.info("=======updating coordinates: ");
|
|
267
354
|
const selectedObject = getSelectedObject();
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
355
|
+
let convert = {};
|
|
356
|
+
const excludedTypes = ['BASEPOINT', 'POLYGON'];
|
|
357
|
+
const filteredObjects = get3DXObjects().filter(obj => !excludedTypes.includes(obj.type));
|
|
358
|
+
const basepointObject = get3DXObjects().find(obj => obj.type == 'BASEPOINT');
|
|
359
|
+
log.info("=======filtered Objects: ", filteredObjects, get3DXObjects());
|
|
360
|
+
if (inputX && inputY && inputZ) {
|
|
361
|
+
log.info("=======text Selected Object: ", selectedObject);
|
|
362
|
+
const object = {
|
|
363
|
+
x: Number(inputX.value),
|
|
364
|
+
y: Number(inputY.value),
|
|
365
|
+
z: Number(inputZ.value)
|
|
366
|
+
};
|
|
367
|
+
log.info("=======test Object to update: ", object);
|
|
368
|
+
// const convert = convertYupToZup(object, basepointCoord, 'm', 1)
|
|
369
|
+
// when converted value exists
|
|
370
|
+
// if (convert) {
|
|
371
|
+
// log.info("=======test Convert Text: ", convert)
|
|
372
|
+
// // display mt-coordinate values
|
|
373
|
+
// document.getElementById("at-mt-coordx").textContent = convert.x.toFixed(3).toString();
|
|
374
|
+
// document.getElementById("at-mt-coordy").textContent = convert.y.toFixed(3).toString();
|
|
375
|
+
// document.getElementById("at-mt-coordz").textContent = convert.z.toFixed(3).toString();
|
|
376
|
+
// }
|
|
377
|
+
// updates object position
|
|
378
|
+
if (selectedObject) {
|
|
379
|
+
const currentCoordinates = getCoordinateValues();
|
|
380
|
+
log.info("=======checking current coordinate: ", currentCoordinates);
|
|
381
|
+
if (selectedObject.object.coordinate_system == COORDINATE_SYSTEM.BIM || basepointObject) {
|
|
382
|
+
convert = convertZupToYup(object, basepointCoord);
|
|
383
|
+
}
|
|
384
|
+
// basepoint exists and is adjusting its coordinates
|
|
385
|
+
if (basepointObject && isAdjust == true) {
|
|
386
|
+
const coordinateSwitch = document.getElementById('at-coordinate-container');
|
|
387
|
+
// if (coordinateSwitch) {
|
|
388
|
+
// coordinateSwitch.style.display = 'none'
|
|
389
|
+
// }
|
|
390
|
+
log.info("=======checking User is adjusting Basepoint: ", currentCoordinates);
|
|
391
|
+
const basepointCoords = {
|
|
392
|
+
object_position: basepointObject.object.object_position,
|
|
393
|
+
object_rotation: basepointObject.object.object_rotation,
|
|
394
|
+
object_scale: basepointObject.object.object_scale
|
|
395
|
+
};
|
|
396
|
+
for (let i = 0; i < filteredObjects.length; i++) {
|
|
397
|
+
if (filteredObjects[i].object.coordinate_system == COORDINATE_SYSTEM.BIM) {
|
|
398
|
+
const convertedPosition = convertYupToZup(filteredObjects[i].object.object_position);
|
|
399
|
+
const offsettedPosition = getOffsetPositionFromBasepoint(convertedPosition, basepointCoords.object_position);
|
|
400
|
+
setObjectTransformation(filteredObjects[i].node, {
|
|
401
|
+
object_position: offsettedPosition,
|
|
402
|
+
object_rotation: filteredObjects[i].object.object_rotation,
|
|
403
|
+
object_scale: filteredObjects[i].object.object_scale
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
// filteredObjects.forEach((object: IObjectData) => {
|
|
408
|
+
// if (object.object.coordinate_system == COORDINATE_SYSTEM.BIM) {
|
|
409
|
+
// log.info("=======checking to update objects as bim is adjusted", object)
|
|
410
|
+
// setObjectTransformation(object.node, basepointCoords)
|
|
411
|
+
// }
|
|
412
|
+
// })
|
|
413
|
+
}
|
|
414
|
+
else {
|
|
415
|
+
log.info("======test init coordinate: ", coordSystem);
|
|
416
|
+
if (transformType == 'translate') {
|
|
417
|
+
log.info("=======test Translate: ", currentCoordinates, object);
|
|
418
|
+
// currentCoordinates.object_position = convert
|
|
419
|
+
setObjectTransformation(selectedObject.node, currentCoordinates);
|
|
420
|
+
}
|
|
421
|
+
else if (transformType == 'scale') {
|
|
422
|
+
log.info("=======test Scale: ", currentCoordinates, object);
|
|
423
|
+
// currentCoordinates.object_scale = convert
|
|
424
|
+
setObjectTransformation(selectedObject.node, currentCoordinates);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
export function getSelectedObjectCoordinateSystem() {
|
|
431
|
+
// let coordClass = ''
|
|
432
|
+
// const selectObject = getSelectedObject()
|
|
433
|
+
// log.info("=====This get Object coordinate: ", payload, coordSystem = payload, selectObject)
|
|
434
|
+
// payload == 'matterport' ? coordClass = 'at-settings-radio-matterport' : coordClass = 'at-settings-radio-bim'
|
|
435
|
+
// if (coordClass) {
|
|
436
|
+
// log.info("======This is test for coord System: ", coordSystem)
|
|
437
|
+
// const coordRadio = document.getElementById(coordClass) as HTMLInputElement;
|
|
438
|
+
// log.info("======This is test for coord Class: ", coordClass)
|
|
439
|
+
// log.info("======This is test for coordRadio: ", coordRadio)
|
|
440
|
+
// //NOTE: getters should not set values. Only get not set
|
|
441
|
+
// // if (payload == 'matterport') {
|
|
442
|
+
// // selectObject.object.coordinate_system = COORDINATE_SYSTEM.MATTERPORT
|
|
443
|
+
// // } else if (payload == 'bim') {
|
|
444
|
+
// // selectObject.object.coordinate_system = COORDINATE_SYSTEM.BIM
|
|
445
|
+
// // }
|
|
446
|
+
// if (coordRadio) {
|
|
447
|
+
// coordRadio.checked = true
|
|
448
|
+
// log.info("======This is test before updating: ", selectObject)
|
|
449
|
+
// // setSelectedObject(selectObject.object, selectObject.node, selectObject.component, '3DX')
|
|
450
|
+
// log.info("======This is test after updating: ", selectObject)
|
|
293
451
|
// }
|
|
452
|
+
// return payload == 'matterport' ? COORDINATE_SYSTEM.MATTERPORT : COORDINATE_SYSTEM.BIM
|
|
294
453
|
// }
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
454
|
+
return selectedObjectCoordinateSystem;
|
|
455
|
+
}
|
|
456
|
+
export function setSelectedObjectCoordinateSystem(payload) {
|
|
457
|
+
if (!payload) {
|
|
458
|
+
log.error("payload is undefined");
|
|
459
|
+
return;
|
|
460
|
+
}
|
|
461
|
+
const targetId = payload == 'matterport' ? 'at-settings-radio-matterport' : 'at-settings-radio-bim';
|
|
462
|
+
const coordRadio = document.getElementById(targetId);
|
|
463
|
+
if (coordRadio) {
|
|
464
|
+
coordRadio.checked = true;
|
|
465
|
+
}
|
|
466
|
+
selectedObjectCoordinateSystem = payload == 'matterport' ? COORDINATE_SYSTEM.MATTERPORT : COORDINATE_SYSTEM.BIM;
|
|
467
|
+
}
|
|
468
|
+
function initObjectCoordinateSystem() {
|
|
469
|
+
log.info("======This is initialize test");
|
|
470
|
+
let coordClass = '';
|
|
471
|
+
const selectObject = getSelectedObject();
|
|
472
|
+
if (selectObject) {
|
|
473
|
+
// coordSystem = document.getElementById('at-coordinate-container')?.innerText.trim();
|
|
474
|
+
log.info("======This is initialize test select Object: ", selectObject);
|
|
475
|
+
if (selectObject.object.coordinate_system == COORDINATE_SYSTEM.MATTERPORT) {
|
|
476
|
+
coordClass = 'at-settings-radio-matterport';
|
|
477
|
+
}
|
|
478
|
+
else if (selectObject.object.coordinate_system == COORDINATE_SYSTEM.BIM) {
|
|
479
|
+
coordClass = 'at-settings-radio-bim';
|
|
480
|
+
}
|
|
481
|
+
if (coordClass) {
|
|
482
|
+
const coordRadio = document.getElementById(coordClass);
|
|
483
|
+
if (coordRadio) {
|
|
484
|
+
log.info("======This is initialize test for coordRadio: ", coordRadio);
|
|
485
|
+
coordRadio.checked = true;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
// displays read-only mt-values
|
|
491
|
+
function displayMTCoordinates() {
|
|
492
|
+
if (inputX && inputY && inputZ) {
|
|
493
|
+
const selectObject = getSelectedObject();
|
|
299
494
|
const object = {
|
|
300
495
|
x: Number(inputX.value),
|
|
301
496
|
y: Number(inputY.value),
|
|
302
497
|
z: Number(inputZ.value)
|
|
303
498
|
};
|
|
304
|
-
log.info("
|
|
305
|
-
const convert =
|
|
499
|
+
log.info("=======test Object to update: ", object);
|
|
500
|
+
const convert = convertZupToYup(object, basepointCoord, 'm', 1);
|
|
306
501
|
// when converted value exists
|
|
307
502
|
if (convert) {
|
|
308
|
-
log.info("
|
|
309
|
-
|
|
310
|
-
document.getElementById("at-mt-
|
|
311
|
-
document.getElementById("at-mt-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
503
|
+
log.info("=======test Convert Text: ", convert);
|
|
504
|
+
// display mt-coordinate values
|
|
505
|
+
document.getElementById("at-mt-coordx").textContent = convert.x.toFixed(3).toString();
|
|
506
|
+
document.getElementById("at-mt-coordy").textContent = convert.y.toFixed(3).toString();
|
|
507
|
+
document.getElementById("at-mt-coordz").textContent = convert.z.toFixed(3).toString();
|
|
508
|
+
}
|
|
509
|
+
else {
|
|
510
|
+
if (selectObject) {
|
|
511
|
+
const currentCoordinates = getCoordinateValues();
|
|
512
|
+
if (currentCoordinates && transformType == 'translate') {
|
|
513
|
+
document.getElementById("at-mt-coordx").textContent = currentCoordinates.object_position.x.toFixed(3).toString();
|
|
514
|
+
document.getElementById("at-mt-coordy").textContent = currentCoordinates.object_position.y.toFixed(3).toString();
|
|
515
|
+
document.getElementById("at-mt-coordz").textContent = currentCoordinates.object_position.z.toFixed(3).toString();
|
|
516
|
+
}
|
|
517
|
+
else if (currentCoordinates && transformType == 'scale') {
|
|
518
|
+
document.getElementById("at-mt-coordx").textContent = currentCoordinates.object_scale.x.toFixed(3).toString();
|
|
519
|
+
document.getElementById("at-mt-coordy").textContent = currentCoordinates.object_scale.y.toFixed(3).toString();
|
|
520
|
+
document.getElementById("at-mt-coordz").textContent = currentCoordinates.object_scale.z.toFixed(3).toString();
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
function isCoordinatesDisplay() {
|
|
527
|
+
const isBimEnabled = _mpConfig.toolbarConfig.menuItems.bim;
|
|
528
|
+
log.info("======is bim active, ", isBimEnabled);
|
|
529
|
+
const coordinateSwitch = document.getElementById('at-coordinate-container');
|
|
530
|
+
const staticCoordinate = document.getElementById('at-transform-note');
|
|
531
|
+
const coordinateText = document.getElementById('at-coordinate-system-text');
|
|
532
|
+
const coordinateStatic = document.getElementById('at-mt-static-text-container');
|
|
533
|
+
if (isBimEnabled == false) {
|
|
534
|
+
log.info("======is bim false, ", isBimEnabled);
|
|
535
|
+
if (coordinateSwitch && staticCoordinate && coordinateText) {
|
|
536
|
+
log.info("======is bim setting to display none ", isBimEnabled, coordinateSwitch, staticCoordinate, coordinateText);
|
|
537
|
+
staticCoordinate.style.display = 'none';
|
|
538
|
+
coordinateSwitch.style.display = 'none';
|
|
539
|
+
coordinateText.style.display = 'none';
|
|
540
|
+
}
|
|
541
|
+
if (coordinateStatic) {
|
|
542
|
+
coordinateStatic.style.display = 'none';
|
|
543
|
+
}
|
|
544
|
+
if (coordinateText) {
|
|
545
|
+
coordinateText.style.display = 'none';
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
// function isRadioCoordinateDisable(payload: string) {
|
|
550
|
+
// const radContainer = document.getElementById('at-coordinate-container')
|
|
551
|
+
// if (radContainer) {
|
|
552
|
+
// const radioButtons = radContainer.querySelectorAll('input[type="radio"]') as NodeListOf<HTMLInputElement>;;
|
|
553
|
+
// if (radioButtons && payload == 'rotate') {
|
|
554
|
+
// // radioButtons.forEach(radio => {
|
|
555
|
+
// // radio.disabled = true; // Disables each radio button
|
|
556
|
+
// // });
|
|
557
|
+
// console.log("Radio buttons are disabled", payload);
|
|
558
|
+
// }
|
|
559
|
+
// } else {
|
|
560
|
+
// console.log("Container not found");
|
|
561
|
+
// }
|
|
562
|
+
// }
|
|
563
|
+
export function setCoordinateSystemType() {
|
|
564
|
+
var _a, _b;
|
|
565
|
+
if ((_b = (_a = _mpConfig.toolbarConfig) === null || _a === void 0 ? void 0 : _a.menuItems) === null || _b === void 0 ? void 0 : _b.bim) {
|
|
566
|
+
const coordinateText = document.getElementById('at-coordinate-system-text');
|
|
567
|
+
const mtStaticText = document.getElementById('at-mt-static-text-container');
|
|
568
|
+
const coordinateCont = document.getElementById('at-coordinate-container');
|
|
569
|
+
const selectedObj = getSelectedObject();
|
|
570
|
+
if (selectedObj.type === "BASEPOINT") {
|
|
571
|
+
const basepointPayload = getBasepointObjectPayload();
|
|
572
|
+
if (basepointPayload.coordinate_system === COORDINATE_SYSTEM.MATTERPORT) {
|
|
573
|
+
coordinateText.innerText = `${i18n.t("CoordinateSystem")}: ${i18n.t('Matterport')}`;
|
|
574
|
+
}
|
|
575
|
+
else if (basepointPayload.coordinate_system === COORDINATE_SYSTEM.BIM) {
|
|
576
|
+
coordinateText.innerText = `${i18n.t("CoordinateSystem")}: ${i18n.t('Bim')}`;
|
|
577
|
+
}
|
|
578
|
+
coordinateCont.style.display = 'none';
|
|
579
|
+
coordinateText.style.display = 'block';
|
|
580
|
+
mtStaticText.classList.add('hidden');
|
|
581
|
+
}
|
|
582
|
+
else {
|
|
583
|
+
mtStaticText.classList.remove('hidden');
|
|
584
|
+
coordinateCont.style.display = 'block';
|
|
585
|
+
coordinateText.style.display = 'none';
|
|
327
586
|
}
|
|
328
587
|
}
|
|
329
588
|
}
|