@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.
@@ -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
- /* eslint-disable */
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
- // TODO: Update bounding box and display units every time displayUnit is changed.
307
- // Also look into why displayUnit is one state behind when sourceUnit is changed in FOVEA.
308
- // Also look into bounding box label width being very long.
309
- // Finally, check that math is correct between source and display units.
310
- newMetaDataEntry('selectedDisplayUnit', displayUnit === unitless ? selectedSourceUnit : displayUnit);
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.rx);
44
- const radiansY = toRadians(currentMeshTracking.ry);
45
- const radiansZ = toRadians(currentMeshTracking.rz);
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.materials.find(mat => mat.materialId === firstMaterial.id);
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@archvisioninc/canvas",
3
- "version": "2.2.17",
3
+ "version": "2.3.1",
4
4
  "private": false,
5
5
  "main": "dist/Canvas.js",
6
6
  "module": "dist/Canvas.js",
@@ -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
- // TODO: Update bounding box and display units every time displayUnit is changed.
341
- // Also look into why displayUnit is one state behind when sourceUnit is changed in FOVEA.
342
- // Also look into bounding box label width being very long.
343
- // Finally, check that math is correct between source and display units.
344
- newMetaDataEntry('selectedDisplayUnit', displayUnit === unitless ? selectedSourceUnit : displayUnit);
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.rx);
69
- const radiansY = toRadians(currentMeshTracking.ry);
70
- const radiansZ = toRadians(currentMeshTracking.rz);
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.materials.find(mat => mat.materialId === firstMaterial.id);
173
+ const existingMaterial = scene.metadata?.materials?.find?.(mat => mat.materialId === firstMaterial.id);
174
174
  newMetaDataEntry('selectedMaterials', [ existingMaterial ]);
175
175
  }
176
176
 
@@ -1,10 +1,10 @@
1
1
  import { useEffect, useState, useCallback } from 'react';
2
2
  import { Notifications } from 'components';
3
- import { AppContainer, DebugButtons, Button, SourceUnits, DisplayUnits, EndButtons } from './styles';
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, scene } from 'package/helpers';
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
- <SourceUnits>
93
- <Button
94
- theme={theme}
95
- $selectedTheme={selectedTheme}
96
- onClick={() => {
97
- const inboundData = {
98
- payload: {
99
- sourceUnit: 'm',
100
- },
101
- };
102
-
103
- updateMesh(inboundData);
104
- const selectedSourceUnit = scene?.metadata.selectedSourceUnit;
105
- const selectedDisplayUnit = scene?.metadata.selectedDisplayUnit;
106
- console.log({ sourceUnit: 'm', selectedSourceUnit, selectedDisplayUnit });
107
- }}
108
- >
109
- Source: Meters
110
- </Button>
111
-
112
- <Button
113
- theme={theme}
114
- $selectedTheme={selectedTheme}
115
- onClick={() => {
116
- const inboundData = {
117
- payload: {
118
- sourceUnit: 'cm',
119
- },
120
- };
121
-
122
- updateMesh(inboundData);
123
- const selectedSourceUnit = scene?.metadata.selectedSourceUnit;
124
- const selectedDisplayUnit = scene?.metadata.selectedDisplayUnit;
125
- console.log({ sourceUnit: 'cm', selectedSourceUnit, selectedDisplayUnit });
126
- }}
127
- >
128
- Source: Centimeters
129
- </Button>
130
-
131
- <Button
132
- theme={theme}
133
- $selectedTheme={selectedTheme}
134
- onClick={() => {
135
- const inboundData = {
136
- payload: {
137
- sourceUnit: 'mm',
138
- },
139
- };
140
-
141
- updateMesh(inboundData);
142
- const selectedSourceUnit = scene?.metadata.selectedSourceUnit;
143
- const selectedDisplayUnit = scene?.metadata.selectedDisplayUnit;
144
- console.log({ sourceUnit: 'mm', selectedSourceUnit, selectedDisplayUnit });
145
- }}
146
- >
147
- Source: Millimeters
148
- </Button>
149
-
150
- <Button
151
- theme={theme}
152
- $selectedTheme={selectedTheme}
153
- onClick={() => {
154
- const inboundData = {
155
- payload: {
156
- sourceUnit: 'ft',
157
- },
158
- };
159
-
160
- updateMesh(inboundData);
161
- const selectedSourceUnit = scene?.metadata.selectedSourceUnit;
162
- const selectedDisplayUnit = scene?.metadata.selectedDisplayUnit;
163
- console.log({ sourceUnit: 'ft', selectedSourceUnit, selectedDisplayUnit });
164
- }}
165
- >
166
- Source: Feet
167
- </Button>
168
-
169
- <Button
170
- theme={theme}
171
- $selectedTheme={selectedTheme}
172
- onClick={() => {
173
- const inboundData = {
174
- payload: {
175
- sourceUnit: 'in',
176
- },
177
- };
178
-
179
- updateMesh(inboundData);
180
- const selectedSourceUnit = scene?.metadata.selectedSourceUnit;
181
- const selectedDisplayUnit = scene?.metadata.selectedDisplayUnit;
182
- console.log({ sourceUnit: 'in', selectedSourceUnit, selectedDisplayUnit });
183
- }}
184
- >
185
- Source: Inches
186
- </Button>
187
-
188
- <Button
189
- theme={theme}
190
- $selectedTheme={selectedTheme}
191
- onClick={() => {
192
- const inboundData = {
193
- payload: {
194
- sourceUnit: 'yd',
195
- },
196
- };
197
-
198
- updateMesh(inboundData);
199
- const selectedSourceUnit = scene?.metadata.selectedSourceUnit;
200
- const selectedDisplayUnit = scene?.metadata.selectedDisplayUnit;
201
- console.log({ sourceUnit: 'yd', selectedSourceUnit, selectedDisplayUnit });
202
- }}
203
- >
204
- Source: Yards
205
- </Button>
206
-
207
- <Button
208
- theme={theme}
209
- $selectedTheme={selectedTheme}
210
- onClick={() => {
211
- const inboundData = {
212
- payload: {
213
- sourceUnit: 'unitless',
214
- },
215
- };
216
-
217
- updateMesh(inboundData);
218
- const selectedSourceUnit = scene?.metadata.selectedSourceUnit;
219
- const selectedDisplayUnit = scene?.metadata.selectedDisplayUnit;
220
- console.log({ sourceUnit: 'unitless', selectedSourceUnit, selectedDisplayUnit });
221
- }}
222
- >
223
- Source: Unitless
224
- </Button>
225
- </SourceUnits>
226
-
227
- <DisplayUnits>
228
- <Button
229
- theme={theme}
230
- $selectedTheme={selectedTheme}
231
- onClick={() => {
232
- const inboundData = {
233
- payload: {
234
- displayUnit: 'm',
235
- },
236
- };
237
-
238
- updateMesh(inboundData);
239
- const selectedSourceUnit = scene?.metadata.selectedSourceUnit;
240
- const selectedDisplayUnit = scene?.metadata.selectedDisplayUnit;
241
- console.log({ displayUnit: 'm', selectedSourceUnit, selectedDisplayUnit });
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
  );
@@ -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
  `;