@panoramax/web-viewer 5.3.0-develop-e555dbf8 → 5.3.0-develop-9164b4a5

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.
@@ -9,7 +9,7 @@ import BasicStyles from "./Basic.css" with { type: "css" };
9
9
  document.adoptedStyleSheets.push(AtkinsonStyles);
10
10
  document.adoptedStyleSheets.push(BasicStyles);
11
11
 
12
- const __COMMIT_HASH__ = "e555dbf";
12
+ const __COMMIT_HASH__ = "9164b4a";
13
13
  const __PACKAGE_VERSION__ = "5.3.0";
14
14
  const __PACKAGE_ISSUES_URL__ = "https://gitlab.com/panoramax/clients/web-viewer/-/work_items";
15
15
 
@@ -398,35 +398,6 @@ export function paramsToMapFilters(vals) {
398
398
  * @param {object} params The parameters to apply.
399
399
  */
400
400
  export function alterPSVState(psv, params) {
401
- // Change xyz position
402
- if(params.xyz) {
403
- psv.addEventListener("picture-loaded", () => {
404
- const coords = xyzParamToPSVPosition(params.xyz);
405
- psv.setXYZ(coords.x, coords.y, coords.z);
406
- }, {once: true});
407
- }
408
-
409
- // Change xywh position
410
- if(params.xywh) {
411
- psv.addEventListener("picture-loaded", () => {
412
- const coords = xywhParamToPSVPosition(params.xywh, psv.getPictureMetadata());
413
- psv.rotate(coords);
414
- psv.zoom(coords.z);
415
- }, {once: true});
416
- }
417
-
418
- // Select focused annotation
419
- if(params.annotation) {
420
- if(psv.getPictureMetadata()) {
421
- psv.focusOnAnnotation(params.annotation);
422
- }
423
- else {
424
- psv.addEventListener("picture-loaded", () => {
425
- psv.focusOnAnnotation(params.annotation);
426
- }, {once: true});
427
- }
428
- }
429
-
430
401
  // Change transitionDuration
431
402
  let td = params.transitionDuration || params.speed;
432
403
  if(td !== undefined) {
@@ -438,6 +409,30 @@ export function alterPSVState(psv, params) {
438
409
  if(["none", "pic", "any", "seq"].includes(nav)) {
439
410
  psv.setPicturesNavigation(nav);
440
411
  }
412
+
413
+ // Params depending on picture loading state
414
+ const oncePicReady = () => {
415
+ // Change xyz position
416
+ if(params.xyz) {
417
+ const coords = xyzParamToPSVPosition(params.xyz);
418
+ psv.setXYZ(coords.x, coords.y, coords.z);
419
+ }
420
+
421
+ // Change xywh position
422
+ if(params.xywh) {
423
+ const coords = xywhParamToPSVPosition(params.xywh, psv.getPictureMetadata());
424
+ psv.rotate(coords);
425
+ psv.zoom(coords.z);
426
+ }
427
+
428
+ // Select focused annotation
429
+ if(params.annotation) {
430
+ psv.focusOnAnnotation(params.annotation);
431
+ }
432
+ };
433
+
434
+ if(psv.getPictureMetadata()) { oncePicReady(); }
435
+ else { psv.addEventListener("picture-loaded", oncePicReady, {once: true}); }
441
436
  }
442
437
 
443
438
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panoramax/web-viewer",
3
- "version": "5.3.0-develop-e555dbf8",
3
+ "version": "5.3.0-develop-9164b4a5",
4
4
  "description": "Panoramax web viewer for geolocated pictures",
5
5
  "main": "./build/cjs/index.js",
6
6
  "module": "./build/esm/index.js",