@panoramax/web-viewer 3.2.3-develop-1369d03e → 3.2.3-develop-387e736b

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-1369d03e",
3
+ "version": "3.2.3-develop-387e736b",
4
4
  "description": "Panoramax web viewer for geolocated pictures",
5
5
  "main": "build/index.js",
6
6
  "author": "Panoramax team",
@@ -169,24 +169,7 @@ export default class PhotoViewer extends Basic {
169
169
  });
170
170
  }
171
171
 
172
- this.onceAPIReady().then(async () => {
173
- this.loader.setAttribute("value", 30);
174
- this._createInitParamsHandler();
175
-
176
- const myPostInitParams = this._initParams.getParentPostInit();
177
-
178
- this._initPSV();
179
- this._initWidgets();
180
- alterPhotoViewerState(this, myPostInitParams);
181
- this._handleKeyboardManagement();
182
-
183
- if(myPostInitParams.picture) {
184
- this.psv.addEventListener("picture-loaded", () => this.loader.dismiss(), {once: true});
185
- }
186
- else {
187
- this.loader.dismiss();
188
- }
189
- });
172
+ this.onceAPIReady().then(this._postAPIInit.bind(this));
190
173
  }
191
174
 
192
175
  /** @private */
@@ -262,6 +245,26 @@ export default class PhotoViewer extends Basic {
262
245
  });
263
246
  }
264
247
 
248
+ /** @private */
249
+ async _postAPIInit() {
250
+ this.loader.setAttribute("value", 30);
251
+ this._createInitParamsHandler();
252
+
253
+ const myPostInitParams = this._initParams.getParentPostInit();
254
+
255
+ this._initPSV();
256
+ this._initWidgets();
257
+ alterPhotoViewerState(this, myPostInitParams);
258
+ this._handleKeyboardManagement();
259
+
260
+ if(myPostInitParams.picture) {
261
+ this.psv.addEventListener("picture-loaded", () => this.loader.dismiss(), {once: true});
262
+ }
263
+ else {
264
+ this.loader.dismiss();
265
+ }
266
+ }
267
+
265
268
  /** @private */
266
269
  _initPSV() {
267
270
  try {
@@ -196,38 +196,6 @@ export default class Viewer extends PhotoViewer {
196
196
  }
197
197
  }
198
198
 
199
- /** @private */
200
- connectedCallback() {
201
- Basic.prototype.connectedCallback.call(this);
202
-
203
- this.onceAPIReady().then(async () => {
204
- this.loader.setAttribute("value", 30);
205
- this._createInitParamsHandler();
206
-
207
- const myPostInitParams = this._initParams.getParentPostInit();
208
-
209
- this._initPSV();
210
- await this._initMap();
211
- this._initWidgets();
212
-
213
- // Re-launch slot move (for those depending on widgets)
214
- this._moveChildToGrid();
215
-
216
- alterViewerState(this, myPostInitParams);
217
- this._handleKeyboardManagement();
218
-
219
- if(myPostInitParams.picture) {
220
- this.psv.addEventListener("picture-loaded", () => {
221
- alterViewerState(this, myPostInitParams); // Do it again for forcing focus
222
- this.loader.dismiss();
223
- }, {once: true});
224
- }
225
- else {
226
- this.loader.dismiss();
227
- }
228
- });
229
- }
230
-
231
199
  getClassName() {
232
200
  return "Viewer";
233
201
  }
@@ -331,6 +299,34 @@ export default class Viewer extends PhotoViewer {
331
299
  linkMapAndPhoto(this);
332
300
  }
333
301
 
302
+ /** @private */
303
+ async _postAPIInit() {
304
+ this.loader.setAttribute("value", 30);
305
+ this._createInitParamsHandler();
306
+
307
+ const myPostInitParams = this._initParams.getParentPostInit();
308
+
309
+ this._initPSV();
310
+ await this._initMap();
311
+ this._initWidgets();
312
+
313
+ // Re-launch slot move (for those depending on widgets)
314
+ this._moveChildToGrid();
315
+
316
+ alterViewerState(this, myPostInitParams);
317
+ this._handleKeyboardManagement();
318
+
319
+ if(myPostInitParams.picture) {
320
+ this.psv.addEventListener("picture-loaded", () => {
321
+ alterViewerState(this, myPostInitParams); // Do it again for forcing focus
322
+ this.loader.dismiss();
323
+ }, {once: true});
324
+ }
325
+ else {
326
+ this.loader.dismiss();
327
+ }
328
+ }
329
+
334
330
  /** @private */
335
331
  _handleKeyboardManagement() {
336
332
  // Switchers
@@ -105,6 +105,7 @@ export default class MapFilters extends LitElement {
105
105
  /* Checkbox looking like buttons */
106
106
  .pnx-input-group.pnx-checkbox-btns {
107
107
  gap: 0;
108
+ align-items: stretch;
108
109
  }
109
110
  .pnx-checkbox-btns label {
110
111
  display: inline-block;
@@ -210,15 +210,16 @@ export default class Photo extends PSViewer {
210
210
  const sameSequence = fromNode && toNode.sequence.id === fromNode.sequence.id;
211
211
  const fromNodeHeading = (fromNode?.properties?.["view:azimuth"] || 0) * (Math.PI / 180);
212
212
  const toNodeHeading = (toNode?.properties?.["view:azimuth"] || 0) * (Math.PI / 180);
213
+ const toNodeRelHeading = getRelativeHeading(toNode) * (Math.PI / 180);
213
214
 
214
215
  this.setOption("maxFov", Math.min(toNode.horizontalFov * 3/4, 90));
215
216
 
216
- const centerNoAnim = {
217
+ const forwardNoAnim = {
217
218
  showLoader: false,
218
219
  effect: "none",
219
220
  speed: 0,
220
221
  rotation: false,
221
- rotateTo: { pitch: 0, yaw: 0 },
222
+ rotateTo: { pitch: 0, yaw: -toNodeRelHeading },
222
223
  zoomTo: PSV_DEFAULT_ZOOM
223
224
  };
224
225
 
@@ -226,13 +227,13 @@ export default class Photo extends PSViewer {
226
227
  if(toNode.horizontalFov == 360) {
227
228
  // No previous sequence -> Point to center + no animation
228
229
  if(!fromNode) {
229
- nodeTransition = centerNoAnim;
230
+ nodeTransition = forwardNoAnim;
230
231
  }
231
232
  // Has a previous sequence
232
233
  else {
233
234
  // Far away sequences -> Point to center + no animation
234
235
  if(getDistance(fromNode.gps, toNode.gps) >= 0.001) {
235
- nodeTransition = centerNoAnim;
236
+ nodeTransition = forwardNoAnim;
236
237
  }
237
238
  // Nearby sequences -> Keep orientation
238
239
  else {
@@ -265,7 +266,7 @@ export default class Photo extends PSViewer {
265
266
  }
266
267
  // Different sequence -> Point to center + no animation
267
268
  else {
268
- nodeTransition = centerNoAnim;
269
+ nodeTransition = forwardNoAnim;
269
270
  }
270
271
  }
271
272