architwin 1.18.11 → 1.18.12

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.
@@ -11,6 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  import { _mpConfig } from "../architwin";
12
12
  import { _3DXObjects } from "../architwin";
13
13
  import { socketEmit } from '../socketio';
14
+ import pdfjs from 'pdfjs-dist/build/pdf';
14
15
  export class Plane {
15
16
  constructor(sdk) {
16
17
  this.disposables = [];
@@ -112,10 +113,10 @@ export class Plane {
112
113
  this.texture = new THREE.TextureLoader().load(this.inputs.url);
113
114
  break;
114
115
  case 'pdf':
115
- const pdfjs = yield import('pdfjs-dist/build/pdf');
116
- const pdfjsWorker = yield import('pdfjs-dist/build/pdf.worker.entry');
117
116
  const pdfPages = [];
118
- pdfjs.GlobalWorkerOptions.workerSrc = pdfjsWorker;
117
+ // pdf.worker.entry is a webpack-only shim that breaks Vite consumers; use a
118
+ // bundler-agnostic CDN worker pinned to the installed pdfjs-dist version.
119
+ pdfjs.GlobalWorkerOptions.workerSrc = `https://cdn.jsdelivr.net/npm/pdfjs-dist@${pdfjs.version}/build/pdf.worker.min.js`;
119
120
  const pdfDoc = yield pdfjs.getDocument(this.inputs.url).promise;
120
121
  const numPages = pdfDoc.numPages;
121
122
  for (let pageNum = 1; pageNum <= numPages; pageNum++) {
@@ -883,10 +883,10 @@ class PlanePdf {
883
883
  // const geometry = new THREE.PlaneGeometry(1.0, 1.0)
884
884
  // @ts-ignore
885
885
  const pdfjs = yield import('pdfjs-dist/build/pdf');
886
- // @ts-ignore
887
- const pdfjsWorker = yield import('pdfjs-dist/build/pdf.worker.entry');
888
886
  const pdfPages = [];
889
- pdfjs.GlobalWorkerOptions.workerSrc = pdfjsWorker;
887
+ // pdf.worker.entry is a webpack-only shim that breaks Vite consumers; use a
888
+ // bundler-agnostic CDN worker pinned to the installed pdfjs-dist version.
889
+ pdfjs.GlobalWorkerOptions.workerSrc = `https://cdn.jsdelivr.net/npm/pdfjs-dist@${pdfjs.version}/build/pdf.worker.min.js`;
890
890
  const pdfDoc = yield pdfjs.getDocument(this.inputs.url).promise;
891
891
  const numPages = pdfDoc.numPages;
892
892
  for (let pageNum = 1; pageNum <= numPages; pageNum++) {
package/lib/minimap.js CHANGED
@@ -57,6 +57,29 @@ let notyf = new Notyf({ position: { x: 'left', y: 'bottom' }, duration: 4500, ty
57
57
  //Map placement presets
58
58
  const mapPositions = ['topLeft', 'topRight', 'bottomLeft', 'bottomRight'];
59
59
  setInterval(locateAvatar, 5000);
60
+ function setActiveMinimapSweep(currentSweep, sweepIds, sweepLegacyIds) {
61
+ return __awaiter(this, void 0, void 0, function* () {
62
+ if (activeSweep !== null) {
63
+ const swp = document.getElementById('p' + activeSweep);
64
+ if (swp)
65
+ swp.classList.remove('active');
66
+ }
67
+ activeSweep = currentSweep.id;
68
+ if (_isInitialLoad) {
69
+ log.info('=== minimap: initial load; will delay activating current sweep; to resolve timing issues ');
70
+ yield new Promise(resolve => setTimeout(resolve, 2000));
71
+ }
72
+ const mapConfig = getMapConfig();
73
+ if (mapConfig && mapConfig.showDirection) {
74
+ showDirection();
75
+ }
76
+ const sweepBtn = document.getElementById('p' + activeSweep);
77
+ if (sweepBtn) {
78
+ sweepBtn.classList.add('active');
79
+ log.info('Entering Sweep - API ID:' + currentSweep.id + ' (#' + sweepIds[currentSweep.id] + ') - Legacy SDK ID: ' + sweepLegacyIds[currentSweep.id]);
80
+ }
81
+ });
82
+ }
60
83
  function setMap(mpSdk, appKey, mapId, openOnLoad) {
61
84
  return __awaiter(this, void 0, void 0, function* () {
62
85
  log.info('setMap(mpSdk: MpSdk)', mpSdk);
@@ -102,31 +125,7 @@ function setMap(mpSdk, appKey, mapId, openOnLoad) {
102
125
  return __awaiter(this, void 0, void 0, function* () {
103
126
  // Change to the current sweep has occurred.
104
127
  if (currentSweep.id !== '') {
105
- if (activeSweep !== null) {
106
- const swp = document.getElementById('p' + activeSweep);
107
- if (swp)
108
- swp.classList.remove('active');
109
- }
110
- activeSweep = currentSweep.id;
111
- if (_isInitialLoad) {
112
- log.info('=== minimap: initial load; will delay activating current sweep; to resolve timing issues ');
113
- yield new Promise(resolve => setTimeout(resolve, 2000));
114
- const mapConfig = getMapConfig();
115
- if (mapConfig && mapConfig.showDirection) {
116
- showDirection();
117
- }
118
- }
119
- else {
120
- const mapConfig = getMapConfig();
121
- if (mapConfig && mapConfig.showDirection) {
122
- showDirection();
123
- }
124
- }
125
- const sweepBtn = document.getElementById('p' + activeSweep);
126
- if (sweepBtn) {
127
- sweepBtn.classList.add('active');
128
- log.info('Entering Sweep - API ID:' + currentSweep.id + ' (#' + sweepIds[currentSweep.id] + ') - Legacy SDK ID: ' + sweepLegacyIds[currentSweep.id]);
129
- }
128
+ setActiveMinimapSweep(currentSweep, sweepIds, sweepLegacyIds);
130
129
  // document.getElementById('p' + activeSweep).classList.add('active');
131
130
  // log.info('Entering Sweep - API ID:' + currentSweep.id + ' (#' + sweepIds[currentSweep.id] + ') - Legacy SDK ID: ' + sweepLegacyIds[currentSweep.id]);
132
131
  }
@@ -286,7 +285,7 @@ function setMap(mpSdk, appKey, mapId, openOnLoad) {
286
285
  onCollectionUpdated: function (collection) {
287
286
  log.info('default the entire up-to-date collection', collection);
288
287
  _minimapSweepCollection = collection;
289
- if (_currentFloor) {
288
+ if (_currentFloor !== undefined) {
290
289
  toggleSweepMarkerFloors(_currentFloor);
291
290
  }
292
291
  dispatchSpaceEvent(SPACE_EVENTS.MINIMAP_SWEEPS_RENDERED);
@@ -340,6 +339,11 @@ function setMap(mpSdk, appKey, mapId, openOnLoad) {
340
339
  // Show Minimap when Tour Starts Playing.
341
340
  yield mpSdk.App.state.waitUntil((appState) => appState.phase == 'appphase.playing');
342
341
  document.body.classList.add('minimap');
342
+ //Tying to fix the issue where the minimap is not showing up on initial load. The minimap is not showing up because the current floor is not being set when the app starts. This is a workaround to set the current floor when the app starts.
343
+ const currentFloor = getCurrentFloor();
344
+ toggleSweepMarkerFloors(currentFloor.sequence);
345
+ const currentSweep = getCurrentSweep();
346
+ setActiveMinimapSweep(currentSweep, sweepIds, sweepLegacyIds);
343
347
  _isInitialLoad = false;
344
348
  });
345
349
  }
@@ -1307,7 +1311,7 @@ function generateCustomMinimap(mpSdk) {
1307
1311
  onCollectionUpdated: function (collection) {
1308
1312
  log.info('custom map: the entire up-to-date collection', collection);
1309
1313
  _minimapSweepCollection = collection;
1310
- if (_currentFloor) {
1314
+ if (_currentFloor !== undefined) {
1311
1315
  toggleSweepMarkerFloors(_currentFloor);
1312
1316
  }
1313
1317
  // Convert object to array
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "architwin",
3
- "version": "1.18.11",
3
+ "version": "1.18.12",
4
4
  "description": "ArchiTwin Library for Matterport",
5
5
  "main": "./lib/architwin.js",
6
6
  "types": "./lib/architwin.d.ts",