architwin 1.9.2 → 1.9.4

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.
@@ -458,7 +458,9 @@ export class BufferGeometry {
458
458
  wallColor: 0xffd150,
459
459
  floorOpacity: 0.4,
460
460
  wallOpacity: 0.6,
461
- visible: true
461
+ visible: true,
462
+ wallData: [],
463
+ floorData: undefined
462
464
  };
463
465
  this.emits = {
464
466
  changed: true,
@@ -510,7 +512,11 @@ export class BufferGeometry {
510
512
  opacity: this.inputs.floorOpacity,
511
513
  transparent: true
512
514
  }));
513
- floorMesh.name = this.inputs.uuid != '' ? `${this.inputs.uuid}-floor` : 'floor';
515
+ floorMesh.name = this.inputs.uuid != '' ? `${this.inputs.uuid}_floor` : 'floor';
516
+ const floorConfig = this.inputs.floorData;
517
+ if (floorConfig && floorConfig.options) {
518
+ floorMesh.visible = floorConfig.options.is_visible;
519
+ }
514
520
  this.groupedMesh.add(floorMesh);
515
521
  const floorArea = getPolygonArea(this.inputs.path);
516
522
  let [floors, walls] = this.renderWalls(WALL_HEIGHT);
@@ -520,7 +526,8 @@ export class BufferGeometry {
520
526
  const floorData = {
521
527
  options: {
522
528
  color: this.inputs.floorColor,
523
- opacity: this.inputs.floorOpacity
529
+ opacity: this.inputs.floorOpacity,
530
+ is_visible: floorMesh.visible
524
531
  },
525
532
  area: floorArea,
526
533
  floor_level: this.inputs.path[0].y,
@@ -534,7 +541,10 @@ export class BufferGeometry {
534
541
  floor_offset: currentOffsetValue,
535
542
  floor_sequence: currentFloor,
536
543
  floor: floorData,
537
- walls: wallDataArray
544
+ walls: wallDataArray,
545
+ options: {
546
+ is_visible: this.inputs.visible
547
+ }
538
548
  };
539
549
  dispatchSpaceEvent(SPACE_EVENTS.PARTITION_UPDATED, partitionData);
540
550
  console.log("Polygon mesh ", this.groupedMesh);
@@ -657,6 +667,18 @@ export class BufferGeometry {
657
667
  floorLabelMesh.position.set((startPoint.x + endPoint.x) / 2, midPoint.y + 0.1, (startPoint.z + endPoint.z) / 2);
658
668
  floorLabelMesh.rotation.y = -Math.PI / 2;
659
669
  //floorLabelMesh.rotation.z = -Math.PI / 2;
670
+ floorLabelMesh.name = this.inputs.uuid != '' ? `${this.inputs.uuid}_edgeLabel-${i}` : `edgeLabel-${i}`;
671
+ if (this.inputs.wallData && this.inputs.wallData.length > 0) {
672
+ const wallData = this.inputs.wallData.find((w) => w.index == i);
673
+ if (wallData && wallData.options) {
674
+ wallMesh.visible = wallData.options.is_visible;
675
+ wallLabelMesh.visible = wallData.options.is_visible;
676
+ }
677
+ }
678
+ const floorConfig = this.inputs.floorData;
679
+ if (floorConfig && floorConfig.options) {
680
+ floorLabelMesh.visible = floorConfig.options.is_visible;
681
+ }
660
682
  this.wallLabels.push(wallLabelMesh);
661
683
  this.floorLabels.push(floorLabelMesh);
662
684
  this.groupedMesh.add(wallMesh);
@@ -679,8 +701,10 @@ export class BufferGeometry {
679
701
  const wallData = {
680
702
  options: {
681
703
  color: this.inputs.wallColor,
682
- opacity: this.inputs.wallOpacity
704
+ opacity: this.inputs.wallOpacity,
705
+ is_visible: wallMesh.visible
683
706
  },
707
+ index: i,
684
708
  area: wallArea,
685
709
  wall_height: WALL_HEIGHT,
686
710
  edges: wallEdges
package/lib/types.d.ts CHANGED
@@ -985,6 +985,7 @@ export interface FloorPolyData {
985
985
  options?: {
986
986
  color: number | undefined;
987
987
  opacity: number | undefined;
988
+ is_visible?: boolean | undefined;
988
989
  };
989
990
  area: number | undefined;
990
991
  floor_level: number;
@@ -993,9 +994,11 @@ export interface FloorPolyData {
993
994
  export interface WallPolyData {
994
995
  uuid?: string | undefined;
995
996
  name?: string | undefined;
997
+ index?: number | undefined;
996
998
  options?: {
997
- color: number | undefined;
998
- opacity: number | undefined;
999
+ color?: number | undefined;
1000
+ opacity?: number | undefined;
1001
+ is_visible?: boolean | undefined;
999
1002
  };
1000
1003
  area: number;
1001
1004
  wall_height: number;
@@ -1003,11 +1006,18 @@ export interface WallPolyData {
1003
1006
  }
1004
1007
  export interface PolygonData {
1005
1008
  path: Array<Vector3>;
1006
- options: any;
1009
+ options?: {
1010
+ is_visible?: boolean | undefined;
1011
+ };
1007
1012
  floor_offset: number;
1008
1013
  floor_sequence: MpSdk.Floor.FloorData;
1009
1014
  floor: FloorPolyData;
1010
1015
  walls: Array<WallPolyData>;
1016
+ is_visible?: boolean;
1017
+ }
1018
+ export interface PolyWallVisibility {
1019
+ index: number;
1020
+ is_visible: boolean;
1011
1021
  }
1012
1022
  export declare const enum IO_PARTICIPANT_COLORS {
1013
1023
  GREEN = "GREEN",
package/lib/utils.d.ts CHANGED
@@ -70,3 +70,9 @@ export declare function isEqual(value: any, other: any): boolean;
70
70
  * @returns The modified string with the replacement word
71
71
  */
72
72
  export declare function replaceWordInString(originalString: string, targetWord: string, replacementWord: string, caseInsensitive?: boolean): string;
73
+ /**
74
+ * Checks if an HTML element is visible in the browser viewport.
75
+ * @param element The HTML element to check for visibility
76
+ * @returns
77
+ */
78
+ export declare function isElementVisible(element: HTMLElement): boolean;
package/lib/utils.js CHANGED
@@ -318,3 +318,18 @@ export function replaceWordInString(originalString, targetWord, replacementWord,
318
318
  const pattern = new RegExp(`\\b${targetWord}\\b`, caseMode);
319
319
  return originalString.replace(pattern, replacementWord);
320
320
  }
321
+ /**
322
+ * Checks if an HTML element is visible in the browser viewport.
323
+ * @param element The HTML element to check for visibility
324
+ * @returns
325
+ */
326
+ export function isElementVisible(element) {
327
+ if (!element) {
328
+ return false; // Element is not provided
329
+ }
330
+ const style = window.getComputedStyle(element);
331
+ const isVisible = style.display !== 'none' && style.visibility !== 'hidden' && style.opacity !== '0';
332
+ const rect = element.getBoundingClientRect();
333
+ const isInViewport = rect.top >= 0 && rect.left >= 0 && rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && rect.right <= (window.innerWidth || document.documentElement.clientWidth);
334
+ return isVisible && isInViewport;
335
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "architwin",
3
- "version": "1.9.2",
3
+ "version": "1.9.4",
4
4
  "description": "ArchiTwin Library for Matterport",
5
5
  "main": "./lib/architwin.js",
6
6
  "types": "./lib/architwin.d.ts",
@@ -1449,7 +1449,7 @@
1449
1449
  display: none;
1450
1450
  }
1451
1451
 
1452
- .at_room_edit_btn, .at_room_visible_btn {
1452
+ .at_room_edit_btn, .at_room_visible_btn, .at_child_visible_btn {
1453
1453
  cursor: pointer;
1454
1454
  }
1455
1455
 
@@ -203,6 +203,10 @@ width: 100vw;
203
203
  opacity: 0.6;
204
204
  }
205
205
 
206
+ .at_hidden {
207
+ display: none;
208
+ }
209
+
206
210
  .at_bolder {
207
211
  font-weight: bolder;
208
212
  }