@panoramax/web-viewer 3.2.3-develop-b76f2545 → 3.2.3-develop-1369d03e

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panoramax/web-viewer",
3
- "version": "3.2.3-develop-b76f2545",
3
+ "version": "3.2.3-develop-1369d03e",
4
4
  "description": "Panoramax web viewer for geolocated pictures",
5
5
  "main": "build/index.js",
6
6
  "author": "Panoramax team",
@@ -105,14 +105,6 @@ export default class PhotoViewer extends Basic {
105
105
  this.psvContainer.setAttribute("slot", "bg");
106
106
  this.grid.appendChild(this.psvContainer);
107
107
  this.popup = createWebComp("pnx-popup", {_parent: this, onclose: this._onPopupClose.bind(this)});
108
-
109
- if(this["url-parameters"] && this["url-parameters"] !== "false") {
110
- this.urlHandler = new URLHandler(this);
111
- this.onceReady().then(() => {
112
- this.urlHandler.listenToChanges();
113
- this.urlHandler._onParentChange();
114
- });
115
- }
116
108
  }
117
109
 
118
110
  /** @private */
@@ -168,7 +160,14 @@ export default class PhotoViewer extends Basic {
168
160
  /** @private */
169
161
  connectedCallback() {
170
162
  super.connectedCallback();
171
- this._moveChildToGrid();
163
+
164
+ if(this["url-parameters"] && this["url-parameters"] !== "false") {
165
+ this.urlHandler = new URLHandler(this);
166
+ this.onceReady().then(() => {
167
+ this.urlHandler.listenToChanges();
168
+ this.urlHandler._onParentChange();
169
+ });
170
+ }
172
171
 
173
172
  this.onceAPIReady().then(async () => {
174
173
  this.loader.setAttribute("value", 30);
@@ -190,6 +189,12 @@ export default class PhotoViewer extends Basic {
190
189
  });
191
190
  }
192
191
 
192
+ /** @private */
193
+ firstUpdated() {
194
+ super.firstUpdated();
195
+ this._moveChildToGrid();
196
+ }
197
+
193
198
  getClassName() {
194
199
  return "PhotoViewer";
195
200
  }
@@ -208,7 +213,7 @@ export default class PhotoViewer extends Basic {
208
213
 
209
214
  /** @private */
210
215
  render() {
211
- return [this.loader, this.grid, this.popup, this.slot];
216
+ return [this.loader, this.grid, this.popup];
212
217
  }
213
218
 
214
219
  getSubComponentsNames() {
@@ -330,26 +335,24 @@ export default class PhotoViewer extends Basic {
330
335
 
331
336
  /** @private */
332
337
  _moveChildToGrid() {
333
- let i = 0;
334
- while(i < this.childNodes.length) {
335
- let n = this.childNodes[i];
336
- if(n.getAttribute?.("slot")) {
337
- // Add parent + translation for our components
338
- if(n.tagName?.toLowerCase().startsWith("pnx-")) {
339
- n._parent = this;
340
- n._t = this._t;
341
- }
342
- // Editors slot -> legend
343
- if(n.getAttribute("slot") === "editors") {
344
- this.onceReady().then(() => this.legend.appendChild(n));
345
- }
346
- // Add to grid for other cases
347
- else {
348
- this.grid.appendChild(n);
349
- }
338
+ const slotContent = Array.from(this.querySelectorAll("[slot]"));
339
+
340
+ slotContent.forEach(n => {
341
+ // Add parent + translation for our components
342
+ if(n.tagName?.toLowerCase().startsWith("pnx-")) {
343
+ n._parent = this;
344
+ n._t = this._t;
350
345
  }
351
- else { i++; }
352
- }
346
+
347
+ // Editors slot -> legend
348
+ if(n.getAttribute("slot") === "editors") {
349
+ this.onceReady().then(() => this.legend?.appendChild(n));
350
+ }
351
+ // Add to grid else
352
+ else {
353
+ this.grid.appendChild(n);
354
+ }
355
+ });
353
356
  }
354
357
 
355
358
  /**
@@ -199,7 +199,6 @@ export default class Viewer extends PhotoViewer {
199
199
  /** @private */
200
200
  connectedCallback() {
201
201
  Basic.prototype.connectedCallback.call(this);
202
- this._moveChildToGrid();
203
202
 
204
203
  this.onceAPIReady().then(async () => {
205
204
  this.loader.setAttribute("value", 30);
@@ -210,6 +209,10 @@ export default class Viewer extends PhotoViewer {
210
209
  this._initPSV();
211
210
  await this._initMap();
212
211
  this._initWidgets();
212
+
213
+ // Re-launch slot move (for those depending on widgets)
214
+ this._moveChildToGrid();
215
+
213
216
  alterViewerState(this, myPostInitParams);
214
217
  this._handleKeyboardManagement();
215
218