@archvisioninc/canvas 2.2.17 → 2.3.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/dist/actions/shortcutActions.js +2 -2
- package/dist/helpers/canvasUpdateHelpers.js +10 -7
- package/dist/helpers/gizmoHelpers.js +3 -3
- package/dist/helpers/viewportHelpers.js +1 -1
- package/package.json +1 -1
- package/src/package/actions/shortcutActions.js +2 -3
- package/src/package/helpers/canvasUpdateHelpers.js +11 -6
- package/src/package/helpers/gizmoHelpers.js +3 -3
- package/src/package/helpers/viewportHelpers.js +1 -1
- package/src/scenes/App/App.js +153 -293
- package/src/scenes/App/styles.js +2 -29
|
@@ -120,8 +120,8 @@ export const toggleBoundingBoxWidget = () => {
|
|
|
120
120
|
guiTexture.getControlByName(dimension.label)?.dispose?.();
|
|
121
121
|
guiTexture.getControlByName(dimension.container)?.dispose?.();
|
|
122
122
|
});
|
|
123
|
-
resetManagerGizmos(GIZMOS.BoundingBoxGizmo);
|
|
124
123
|
if (!gizmoManager.boundingBoxGizmoEnabled) {
|
|
124
|
+
resetManagerGizmos(GIZMOS.BoundingBoxGizmo);
|
|
125
125
|
gizmoManager.attachToMesh(boundingMesh);
|
|
126
126
|
}
|
|
127
127
|
gizmoManager.boundingBoxGizmoEnabled = !isEnabled;
|
|
@@ -261,7 +261,7 @@ export const modelToOrigin = sourceUnitScaleOperation => {
|
|
|
261
261
|
const parentList = [];
|
|
262
262
|
const handleBoundingBox = () => {
|
|
263
263
|
const newBox = createBoundingMesh();
|
|
264
|
-
if (boundingBoxEnabled) toggleBoundingBoxWidget();
|
|
264
|
+
if (boundingBoxEnabled && !sourceUnitScaleOperation) toggleBoundingBoxWidget();
|
|
265
265
|
if (gizmoManager.boundingBoxGizmoEnabled) gizmoManager.attachToMesh(newBox);
|
|
266
266
|
resetManagerGizmos(GIZMOS.BoundingBoxGizmo);
|
|
267
267
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { getUserMeshes, resetSelectedMeshes, addNewMesh, scene, mirrorGround, ground, newVector, newColor, newScreenshot, serializeScene, newMetaDataEntry, selectedMeshes, singleMeshTNode, toRadians, toDegrees, multiMeshTNode, handleMousePointerTap, prepareCamera, buildMaterialsArray, buildMeshPositionsArray, createBoundingMesh, attachToSelectMeshesNode, newTexture, getUserMaterials, buildSelectedMaterialArray, buildMeshIdArray, refreshHighlight, guiTexture, getBoundingMeshData, getScaleFactor } from '../helpers';
|
|
1
|
+
import { getUserMeshes, resetSelectedMeshes, addNewMesh, scene, mirrorGround, ground, newVector, newColor, newScreenshot, serializeScene, newMetaDataEntry, selectedMeshes, singleMeshTNode, toRadians, toDegrees, multiMeshTNode, handleMousePointerTap, prepareCamera, buildMaterialsArray, buildMeshPositionsArray, createBoundingMesh, attachToSelectMeshesNode, newTexture, getUserMaterials, buildSelectedMaterialArray, buildMeshIdArray, refreshHighlight, guiTexture, getBoundingMeshData, getScaleFactor, gizmoManager } from '../helpers';
|
|
3
2
|
import { toggleSafeFrame, toggleOrthographicViews, toggleBoundingBoxWidget, resetManagerGizmos, modelToOrigin, focusCamera } from '../actions';
|
|
4
3
|
import { GLTF2 } from 'babylonjs-loaders';
|
|
5
4
|
import { GIZMOS, TRANSPARENCY_MODES, GUI } from '../constants';
|
|
@@ -292,6 +291,7 @@ export const updateMesh = inboundData => {
|
|
|
292
291
|
const meshChangeTracking = scene.metadata?.meshChangeTracking || [];
|
|
293
292
|
const selectedSourceUnit = scene.metadata.selectedSourceUnit;
|
|
294
293
|
const selectedDisplayUnit = scene.metadata?.selectedDisplayUnit;
|
|
294
|
+
const isBoundingBoxEnabled = gizmoManager.boundingBoxGizmoEnabled;
|
|
295
295
|
const userMeshes = getUserMeshes();
|
|
296
296
|
const rootMesh = scene.getMeshByID('__root__');
|
|
297
297
|
const newTrackingData = args => meshChangeTracking?.map(mesh => {
|
|
@@ -303,11 +303,12 @@ export const updateMesh = inboundData => {
|
|
|
303
303
|
|
|
304
304
|
// Change display units
|
|
305
305
|
if (!_.isEmpty(displayUnit) && selectedSourceUnit && selectedSourceUnit !== unitless) {
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
306
|
+
const newDisplayUnit = displayUnit === unitless ? selectedSourceUnit : displayUnit;
|
|
307
|
+
newMetaDataEntry('selectedDisplayUnit', newDisplayUnit);
|
|
308
|
+
if (isBoundingBoxEnabled) {
|
|
309
|
+
toggleBoundingBoxWidget();
|
|
310
|
+
toggleBoundingBoxWidget();
|
|
311
|
+
}
|
|
311
312
|
}
|
|
312
313
|
|
|
313
314
|
// Change mesh scale based on source units
|
|
@@ -393,7 +394,9 @@ export const updateMesh = inboundData => {
|
|
|
393
394
|
...convertedScales
|
|
394
395
|
});
|
|
395
396
|
modelToOrigin(sourceUnitScaleOperation);
|
|
397
|
+
isBoundingBoxEnabled && toggleBoundingBoxWidget();
|
|
396
398
|
focusCamera();
|
|
399
|
+
isBoundingBoxEnabled && toggleBoundingBoxWidget();
|
|
397
400
|
return;
|
|
398
401
|
}
|
|
399
402
|
}
|
|
@@ -40,9 +40,9 @@ export const handleSingleMeshGizmo = mesh => {
|
|
|
40
40
|
const isChildOfNode = previousSingleNode?.name === mesh.name;
|
|
41
41
|
const parent = mesh.parent;
|
|
42
42
|
const currentMeshTracking = scene.metadata.meshChangeTracking.find(trackedMesh => trackedMesh.meshId === mesh.id);
|
|
43
|
-
const radiansX = toRadians(currentMeshTracking
|
|
44
|
-
const radiansY = toRadians(currentMeshTracking
|
|
45
|
-
const radiansZ = toRadians(currentMeshTracking
|
|
43
|
+
const radiansX = toRadians(currentMeshTracking?.rx);
|
|
44
|
+
const radiansY = toRadians(currentMeshTracking?.ry);
|
|
45
|
+
const radiansZ = toRadians(currentMeshTracking?.rz);
|
|
46
46
|
const newRotation = newVector(radiansX, radiansY, radiansZ);
|
|
47
47
|
parentList.push({
|
|
48
48
|
mesh,
|
|
@@ -117,7 +117,7 @@ export const resetSelectedMeshes = () => {
|
|
|
117
117
|
const firstMaterial = userMaterials[0] || {};
|
|
118
118
|
newMetaDataEntry('selectedMaterials', []);
|
|
119
119
|
if (!_.isEmpty(firstMaterial)) {
|
|
120
|
-
const existingMaterial = scene.metadata
|
|
120
|
+
const existingMaterial = scene.metadata?.materials?.find?.(mat => mat.materialId === firstMaterial.id);
|
|
121
121
|
newMetaDataEntry('selectedMaterials', [existingMaterial]);
|
|
122
122
|
}
|
|
123
123
|
highlightManager.removeAllMeshes();
|
package/package.json
CHANGED
|
@@ -178,9 +178,8 @@ export const toggleBoundingBoxWidget = () => {
|
|
|
178
178
|
guiTexture.getControlByName(dimension.container)?.dispose?.();
|
|
179
179
|
});
|
|
180
180
|
|
|
181
|
-
resetManagerGizmos(GIZMOS.BoundingBoxGizmo);
|
|
182
|
-
|
|
183
181
|
if (!gizmoManager.boundingBoxGizmoEnabled) {
|
|
182
|
+
resetManagerGizmos(GIZMOS.BoundingBoxGizmo);
|
|
184
183
|
gizmoManager.attachToMesh(boundingMesh);
|
|
185
184
|
}
|
|
186
185
|
|
|
@@ -340,7 +339,7 @@ export const modelToOrigin = sourceUnitScaleOperation => {
|
|
|
340
339
|
|
|
341
340
|
const handleBoundingBox = () => {
|
|
342
341
|
const newBox = createBoundingMesh();
|
|
343
|
-
if (boundingBoxEnabled) toggleBoundingBoxWidget();
|
|
342
|
+
if (boundingBoxEnabled && !sourceUnitScaleOperation) toggleBoundingBoxWidget();
|
|
344
343
|
if (gizmoManager.boundingBoxGizmoEnabled) gizmoManager.attachToMesh(newBox);
|
|
345
344
|
resetManagerGizmos(GIZMOS.BoundingBoxGizmo);
|
|
346
345
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
1
|
import {
|
|
3
2
|
getUserMeshes,
|
|
4
3
|
resetSelectedMeshes,
|
|
@@ -30,6 +29,7 @@ import {
|
|
|
30
29
|
guiTexture,
|
|
31
30
|
getBoundingMeshData,
|
|
32
31
|
getScaleFactor,
|
|
32
|
+
gizmoManager,
|
|
33
33
|
} from '../helpers';
|
|
34
34
|
import {
|
|
35
35
|
toggleSafeFrame,
|
|
@@ -328,6 +328,7 @@ export const updateMesh = inboundData => {
|
|
|
328
328
|
const meshChangeTracking = scene.metadata?.meshChangeTracking || [];
|
|
329
329
|
const selectedSourceUnit = scene.metadata.selectedSourceUnit;
|
|
330
330
|
const selectedDisplayUnit = scene.metadata?.selectedDisplayUnit;
|
|
331
|
+
const isBoundingBoxEnabled = gizmoManager.boundingBoxGizmoEnabled;
|
|
331
332
|
const userMeshes = getUserMeshes();
|
|
332
333
|
const rootMesh = scene.getMeshByID('__root__');
|
|
333
334
|
|
|
@@ -337,11 +338,13 @@ export const updateMesh = inboundData => {
|
|
|
337
338
|
|
|
338
339
|
// Change display units
|
|
339
340
|
if (!_.isEmpty(displayUnit) && selectedSourceUnit && selectedSourceUnit !== unitless) {
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
341
|
+
const newDisplayUnit = displayUnit === unitless ? selectedSourceUnit : displayUnit;
|
|
342
|
+
newMetaDataEntry('selectedDisplayUnit', newDisplayUnit);
|
|
343
|
+
|
|
344
|
+
if (isBoundingBoxEnabled) {
|
|
345
|
+
toggleBoundingBoxWidget();
|
|
346
|
+
toggleBoundingBoxWidget();
|
|
347
|
+
}
|
|
345
348
|
}
|
|
346
349
|
|
|
347
350
|
// Change mesh scale based on source units
|
|
@@ -405,7 +408,9 @@ export const updateMesh = inboundData => {
|
|
|
405
408
|
|
|
406
409
|
newMetaDataEntry('globalTransforms', { ...globalTransforms, ...convertedScales });
|
|
407
410
|
modelToOrigin(sourceUnitScaleOperation);
|
|
411
|
+
isBoundingBoxEnabled && toggleBoundingBoxWidget();
|
|
408
412
|
focusCamera();
|
|
413
|
+
isBoundingBoxEnabled && toggleBoundingBoxWidget();
|
|
409
414
|
return;
|
|
410
415
|
}
|
|
411
416
|
}
|
|
@@ -65,9 +65,9 @@ export const handleSingleMeshGizmo = mesh => {
|
|
|
65
65
|
const isChildOfNode = previousSingleNode?.name === mesh.name;
|
|
66
66
|
const parent = mesh.parent;
|
|
67
67
|
const currentMeshTracking = scene.metadata.meshChangeTracking.find(trackedMesh => trackedMesh.meshId === mesh.id);
|
|
68
|
-
const radiansX = toRadians(currentMeshTracking
|
|
69
|
-
const radiansY = toRadians(currentMeshTracking
|
|
70
|
-
const radiansZ = toRadians(currentMeshTracking
|
|
68
|
+
const radiansX = toRadians(currentMeshTracking?.rx);
|
|
69
|
+
const radiansY = toRadians(currentMeshTracking?.ry);
|
|
70
|
+
const radiansZ = toRadians(currentMeshTracking?.rz);
|
|
71
71
|
const newRotation = newVector(radiansX, radiansY, radiansZ);
|
|
72
72
|
|
|
73
73
|
parentList.push({ mesh, parent });
|
|
@@ -170,7 +170,7 @@ export const resetSelectedMeshes = () => {
|
|
|
170
170
|
newMetaDataEntry('selectedMaterials', []);
|
|
171
171
|
|
|
172
172
|
if (!_.isEmpty(firstMaterial)) {
|
|
173
|
-
const existingMaterial = scene.metadata
|
|
173
|
+
const existingMaterial = scene.metadata?.materials?.find?.(mat => mat.materialId === firstMaterial.id);
|
|
174
174
|
newMetaDataEntry('selectedMaterials', [ existingMaterial ]);
|
|
175
175
|
}
|
|
176
176
|
|
package/src/scenes/App/App.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { useEffect, useState, useCallback } from 'react';
|
|
2
2
|
import { Notifications } from 'components';
|
|
3
|
-
import { AppContainer, DebugButtons, Button
|
|
3
|
+
import { AppContainer, DebugButtons, Button } from './styles';
|
|
4
4
|
import { theme } from 'static/theme';
|
|
5
5
|
import { fetchDownloadURL } from 'helpers/fetchHelpers';
|
|
6
6
|
import { ENVIRONMENTS } from 'constants';
|
|
7
|
-
import { updateMesh
|
|
7
|
+
import { updateMesh } from 'package/helpers';
|
|
8
8
|
import Canvas from 'package/Canvas';
|
|
9
9
|
import _ from 'lodash';
|
|
10
10
|
|
|
@@ -89,297 +89,157 @@ const App = () => {
|
|
|
89
89
|
/>
|
|
90
90
|
|
|
91
91
|
<DebugButtons>
|
|
92
|
-
<
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
>
|
|
244
|
-
Display: Meters
|
|
245
|
-
</Button>
|
|
246
|
-
|
|
247
|
-
<Button
|
|
248
|
-
theme={theme}
|
|
249
|
-
$selectedTheme={selectedTheme}
|
|
250
|
-
onClick={() => {
|
|
251
|
-
const inboundData = {
|
|
252
|
-
payload: {
|
|
253
|
-
displayUnit: 'cm',
|
|
254
|
-
},
|
|
255
|
-
};
|
|
256
|
-
|
|
257
|
-
updateMesh(inboundData);
|
|
258
|
-
const selectedSourceUnit = scene?.metadata.selectedSourceUnit;
|
|
259
|
-
const selectedDisplayUnit = scene?.metadata.selectedDisplayUnit;
|
|
260
|
-
console.log({ displayUnit: 'cm', selectedSourceUnit, selectedDisplayUnit });
|
|
261
|
-
}}
|
|
262
|
-
>
|
|
263
|
-
Display: Centimeters
|
|
264
|
-
</Button>
|
|
265
|
-
|
|
266
|
-
<Button
|
|
267
|
-
theme={theme}
|
|
268
|
-
$selectedTheme={selectedTheme}
|
|
269
|
-
onClick={() => {
|
|
270
|
-
const inboundData = {
|
|
271
|
-
payload: {
|
|
272
|
-
displayUnit: 'mm',
|
|
273
|
-
},
|
|
274
|
-
};
|
|
275
|
-
|
|
276
|
-
updateMesh(inboundData);
|
|
277
|
-
const selectedSourceUnit = scene?.metadata.selectedSourceUnit;
|
|
278
|
-
const selectedDisplayUnit = scene?.metadata.selectedDisplayUnit;
|
|
279
|
-
console.log({ displayUnit: 'mm', selectedSourceUnit, selectedDisplayUnit });
|
|
280
|
-
}}
|
|
281
|
-
>
|
|
282
|
-
Display: Millimeters
|
|
283
|
-
</Button>
|
|
284
|
-
|
|
285
|
-
<Button
|
|
286
|
-
theme={theme}
|
|
287
|
-
$selectedTheme={selectedTheme}
|
|
288
|
-
onClick={() => {
|
|
289
|
-
const inboundData = {
|
|
290
|
-
payload: {
|
|
291
|
-
displayUnit: 'ft',
|
|
292
|
-
},
|
|
293
|
-
};
|
|
294
|
-
|
|
295
|
-
updateMesh(inboundData);
|
|
296
|
-
const selectedSourceUnit = scene?.metadata.selectedSourceUnit;
|
|
297
|
-
const selectedDisplayUnit = scene?.metadata.selectedDisplayUnit;
|
|
298
|
-
console.log({ displayUnit: 'ft', selectedSourceUnit, selectedDisplayUnit });
|
|
299
|
-
}}
|
|
300
|
-
>
|
|
301
|
-
Display: Feet
|
|
302
|
-
</Button>
|
|
303
|
-
|
|
304
|
-
<Button
|
|
305
|
-
theme={theme}
|
|
306
|
-
$selectedTheme={selectedTheme}
|
|
307
|
-
onClick={() => {
|
|
308
|
-
const inboundData = {
|
|
309
|
-
payload: {
|
|
310
|
-
displayUnit: 'in',
|
|
311
|
-
},
|
|
312
|
-
};
|
|
313
|
-
|
|
314
|
-
updateMesh(inboundData);
|
|
315
|
-
const selectedSourceUnit = scene?.metadata.selectedSourceUnit;
|
|
316
|
-
const selectedDisplayUnit = scene?.metadata.selectedDisplayUnit;
|
|
317
|
-
console.log({ displayUnit: 'in', selectedSourceUnit, selectedDisplayUnit });
|
|
318
|
-
}}
|
|
319
|
-
>
|
|
320
|
-
Display: Inches
|
|
321
|
-
</Button>
|
|
322
|
-
|
|
323
|
-
<Button
|
|
324
|
-
theme={theme}
|
|
325
|
-
$selectedTheme={selectedTheme}
|
|
326
|
-
onClick={() => {
|
|
327
|
-
const inboundData = {
|
|
328
|
-
payload: {
|
|
329
|
-
displayUnit: 'yd',
|
|
330
|
-
},
|
|
331
|
-
};
|
|
332
|
-
|
|
333
|
-
updateMesh(inboundData);
|
|
334
|
-
const selectedSourceUnit = scene?.metadata.selectedSourceUnit;
|
|
335
|
-
const selectedDisplayUnit = scene?.metadata.selectedDisplayUnit;
|
|
336
|
-
console.log({ displayUnit: 'yd', selectedSourceUnit, selectedDisplayUnit });
|
|
337
|
-
}}
|
|
338
|
-
>
|
|
339
|
-
Display: Yards
|
|
340
|
-
</Button>
|
|
341
|
-
|
|
342
|
-
<Button
|
|
343
|
-
theme={theme}
|
|
344
|
-
$selectedTheme={selectedTheme}
|
|
345
|
-
onClick={() => {
|
|
346
|
-
const inboundData = {
|
|
347
|
-
payload: {
|
|
348
|
-
displayUnit: 'unitless',
|
|
349
|
-
},
|
|
350
|
-
};
|
|
351
|
-
|
|
352
|
-
updateMesh(inboundData);
|
|
353
|
-
const selectedSourceUnit = scene?.metadata.selectedSourceUnit;
|
|
354
|
-
const selectedDisplayUnit = scene?.metadata.selectedDisplayUnit;
|
|
355
|
-
console.log({ displayUnit: 'unitless', selectedSourceUnit, selectedDisplayUnit });
|
|
356
|
-
}}
|
|
357
|
-
>
|
|
358
|
-
Display: Unitless
|
|
359
|
-
</Button>
|
|
360
|
-
</DisplayUnits>
|
|
361
|
-
|
|
362
|
-
<EndButtons>
|
|
363
|
-
<Button
|
|
364
|
-
theme={theme}
|
|
365
|
-
$selectedTheme={selectedTheme}
|
|
366
|
-
onClick={() => {
|
|
367
|
-
const selectedSourceUnit = scene?.metadata.selectedSourceUnit;
|
|
368
|
-
const selectedDisplayUnit = scene?.metadata.selectedDisplayUnit;
|
|
369
|
-
console.log({ selectedSourceUnit, selectedDisplayUnit });
|
|
370
|
-
}}
|
|
371
|
-
>
|
|
372
|
-
Value check
|
|
373
|
-
</Button>
|
|
374
|
-
|
|
375
|
-
<Button
|
|
376
|
-
theme={theme}
|
|
377
|
-
$selectedTheme={selectedTheme}
|
|
378
|
-
onClick={() => setSelectedTheme(selectedTheme === 'light' ? 'dark' : 'light')}
|
|
379
|
-
>
|
|
380
|
-
Change theme
|
|
381
|
-
</Button>
|
|
382
|
-
</EndButtons>
|
|
92
|
+
<Button
|
|
93
|
+
theme={theme}
|
|
94
|
+
$selectedTheme={selectedTheme}
|
|
95
|
+
onClick={() => {
|
|
96
|
+
const inboundData = {
|
|
97
|
+
payload: {
|
|
98
|
+
sourceUnit: 'unitless',
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
updateMesh(inboundData);
|
|
103
|
+
}}
|
|
104
|
+
>
|
|
105
|
+
Unitless
|
|
106
|
+
</Button>
|
|
107
|
+
|
|
108
|
+
<Button
|
|
109
|
+
theme={theme}
|
|
110
|
+
$selectedTheme={selectedTheme}
|
|
111
|
+
onClick={() => {
|
|
112
|
+
const inboundData = {
|
|
113
|
+
payload: {
|
|
114
|
+
sourceUnit: 'cm',
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
updateMesh(inboundData);
|
|
119
|
+
}}
|
|
120
|
+
>
|
|
121
|
+
Source: Centimeters
|
|
122
|
+
</Button>
|
|
123
|
+
|
|
124
|
+
<Button
|
|
125
|
+
theme={theme}
|
|
126
|
+
$selectedTheme={selectedTheme}
|
|
127
|
+
onClick={() => {
|
|
128
|
+
const inboundData = {
|
|
129
|
+
payload: {
|
|
130
|
+
sourceUnit: 'mm',
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
updateMesh(inboundData);
|
|
135
|
+
}}
|
|
136
|
+
>
|
|
137
|
+
Source: Millimeters
|
|
138
|
+
</Button>
|
|
139
|
+
|
|
140
|
+
<Button
|
|
141
|
+
theme={theme}
|
|
142
|
+
$selectedTheme={selectedTheme}
|
|
143
|
+
onClick={() => {
|
|
144
|
+
const inboundData = {
|
|
145
|
+
payload: {
|
|
146
|
+
sourceUnit: 'm',
|
|
147
|
+
},
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
updateMesh(inboundData);
|
|
151
|
+
}}
|
|
152
|
+
>
|
|
153
|
+
Source: Meters
|
|
154
|
+
</Button>
|
|
155
|
+
|
|
156
|
+
<Button
|
|
157
|
+
theme={theme}
|
|
158
|
+
$selectedTheme={selectedTheme}
|
|
159
|
+
onClick={() => {
|
|
160
|
+
const inboundData = {
|
|
161
|
+
payload: {
|
|
162
|
+
displayUnit: 'ft',
|
|
163
|
+
},
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
updateMesh(inboundData);
|
|
167
|
+
}}
|
|
168
|
+
>
|
|
169
|
+
Display: Feet
|
|
170
|
+
</Button>
|
|
171
|
+
|
|
172
|
+
<Button
|
|
173
|
+
theme={theme}
|
|
174
|
+
$selectedTheme={selectedTheme}
|
|
175
|
+
onClick={() => {
|
|
176
|
+
const inboundData = {
|
|
177
|
+
payload: {
|
|
178
|
+
displayUnit: 'in',
|
|
179
|
+
},
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
updateMesh(inboundData);
|
|
183
|
+
}}
|
|
184
|
+
>
|
|
185
|
+
Display: Inches
|
|
186
|
+
</Button>
|
|
187
|
+
|
|
188
|
+
<Button
|
|
189
|
+
theme={theme}
|
|
190
|
+
$selectedTheme={selectedTheme}
|
|
191
|
+
onClick={() => {
|
|
192
|
+
const inboundData = {
|
|
193
|
+
payload: {
|
|
194
|
+
sourceUnit: 'in',
|
|
195
|
+
},
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
updateMesh(inboundData);
|
|
199
|
+
}}
|
|
200
|
+
>
|
|
201
|
+
Source: Inches
|
|
202
|
+
</Button>
|
|
203
|
+
|
|
204
|
+
<Button
|
|
205
|
+
theme={theme}
|
|
206
|
+
$selectedTheme={selectedTheme}
|
|
207
|
+
onClick={() => {
|
|
208
|
+
const inboundData = {
|
|
209
|
+
payload: {
|
|
210
|
+
sourceUnit: 'ft',
|
|
211
|
+
},
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
updateMesh(inboundData);
|
|
215
|
+
}}
|
|
216
|
+
>
|
|
217
|
+
Source: Feet
|
|
218
|
+
</Button>
|
|
219
|
+
|
|
220
|
+
<Button
|
|
221
|
+
theme={theme}
|
|
222
|
+
$selectedTheme={selectedTheme}
|
|
223
|
+
onClick={() => {
|
|
224
|
+
const inboundData = {
|
|
225
|
+
payload: {
|
|
226
|
+
sourceUnit: 'yd',
|
|
227
|
+
},
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
updateMesh(inboundData);
|
|
231
|
+
}}
|
|
232
|
+
>
|
|
233
|
+
Source: Yards
|
|
234
|
+
</Button>
|
|
235
|
+
|
|
236
|
+
<Button
|
|
237
|
+
theme={theme}
|
|
238
|
+
$selectedTheme={selectedTheme}
|
|
239
|
+
onClick={() => setSelectedTheme(selectedTheme === 'light' ? 'dark' : 'light')}
|
|
240
|
+
>
|
|
241
|
+
Change theme
|
|
242
|
+
</Button>
|
|
383
243
|
</DebugButtons>
|
|
384
244
|
</AppContainer>
|
|
385
245
|
);
|
package/src/scenes/App/styles.js
CHANGED
|
@@ -10,19 +10,11 @@ export const AppContainer = styled('div')`
|
|
|
10
10
|
|
|
11
11
|
export const DebugButtons = styled('div')`
|
|
12
12
|
position: absolute;
|
|
13
|
-
display: grid;
|
|
14
|
-
gap: 0.5rem 3rem;
|
|
15
|
-
align-items: center;
|
|
16
|
-
justify-content: center;
|
|
17
|
-
grid-template-columns: 1fr auto;
|
|
18
|
-
grid-template-rows: repeat(2, auto);
|
|
19
|
-
grid-template-areas:
|
|
20
|
-
'sourceUnits endButtons'
|
|
21
|
-
'displayUnits endButtons';
|
|
22
|
-
|
|
23
13
|
top: 1rem;
|
|
24
14
|
right: 1rem;
|
|
25
15
|
width: fit-content;
|
|
16
|
+
display: inline-flex;
|
|
17
|
+
gap: 0.5rem;
|
|
26
18
|
`;
|
|
27
19
|
|
|
28
20
|
export const Button = styled('button')`
|
|
@@ -39,23 +31,4 @@ export const Button = styled('button')`
|
|
|
39
31
|
background-color: ${props => getColor(props, 'accentHover')};
|
|
40
32
|
color: ${props => getColor(props, 'onAccentHover')};
|
|
41
33
|
}
|
|
42
|
-
`;
|
|
43
|
-
|
|
44
|
-
export const SourceUnits = styled('div')`
|
|
45
|
-
display:inline-flex;
|
|
46
|
-
align-items: center;
|
|
47
|
-
justify-content: center;
|
|
48
|
-
grid-area: sourceUnits;
|
|
49
|
-
gap: 0.5rem;
|
|
50
|
-
width: 100%;
|
|
51
|
-
`;
|
|
52
|
-
|
|
53
|
-
export const DisplayUnits = styled(SourceUnits)`
|
|
54
|
-
grid-area: displayUnits;
|
|
55
|
-
`;
|
|
56
|
-
|
|
57
|
-
export const EndButtons = styled('div')`
|
|
58
|
-
display: inline-flex;
|
|
59
|
-
grid-area: endButtons;
|
|
60
|
-
gap: 0.5rem;
|
|
61
34
|
`;
|