@panoramax/web-viewer 4.1.0-develop-c921ed43 → 4.1.0-develop-c175bf43

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/config/paths.js CHANGED
@@ -56,6 +56,7 @@ module.exports = {
56
56
  appHtmlPhotoViewer: resolveApp('public/photo.html'),
57
57
  appHtmlWidgets: resolveApp('public/widgets.html'),
58
58
  appLibIndexJs: resolveModule(resolveApp, 'src/index'),
59
+ appLibPhotoViewerJs: resolveModule(resolveApp, 'src/index_photoviewer'),
59
60
  appPackageJson: resolveApp('package.json'),
60
61
  appSrc: resolveApp('src'),
61
62
  appSrcLib: resolveApp('src'),
@@ -1,3 +1,4 @@
1
+ /* eslint-disable */
1
2
  const fs = require('fs');
2
3
  const path = require('path');
3
4
  const webpack = require('webpack');
@@ -211,6 +212,34 @@ module.exports = function (webpackEnv) {
211
212
  return loaders;
212
213
  };
213
214
 
215
+ const getHtmlPlugin = (filename, template) => new HtmlWebpackPlugin(
216
+ Object.assign(
217
+ {},
218
+ {
219
+ inject: true,
220
+ filename: filename,
221
+ template: template,
222
+ chunks: ["index"],
223
+ },
224
+ isEnvProduction
225
+ ? {
226
+ minify: {
227
+ removeComments: true,
228
+ collapseWhitespace: true,
229
+ removeRedundantAttributes: true,
230
+ useShortDoctype: true,
231
+ removeEmptyAttributes: true,
232
+ removeStyleLinkTypeAttributes: true,
233
+ keepClosingSlash: true,
234
+ minifyJS: true,
235
+ minifyCSS: true,
236
+ minifyURLs: true,
237
+ },
238
+ }
239
+ : undefined
240
+ )
241
+ );
242
+
214
243
  return {
215
244
  target: ['browserslist'],
216
245
  mode: isEnvProduction ? 'production' : isEnvDevelopment && 'development',
@@ -223,7 +252,10 @@ module.exports = function (webpackEnv) {
223
252
  : isEnvDevelopment && 'cheap-module-source-map',
224
253
  // These are the "entry points" to our application.
225
254
  // This means they will be the "root" imports that are included in JS bundle.
226
- entry: paths.appLibIndexJs,
255
+ entry: Object.assign(
256
+ { index: paths.appLibIndexJs },
257
+ isEnvProduction ? { photoviewer: paths.appLibPhotoViewerJs } : {},
258
+ ),
227
259
  output: {
228
260
  globalObject: 'this',
229
261
  // The build folder.
@@ -233,7 +265,7 @@ module.exports = function (webpackEnv) {
233
265
  // There will be one main bundle, and one file per asynchronous chunk.
234
266
  // In development, it does not produce real files.
235
267
  filename: isEnvProduction
236
- ? 'index.js'
268
+ ? '[name].js'
237
269
  : isEnvDevelopment && 'static/js/bundle.js',
238
270
  // There are also additional JS chunk files if you use code splitting.
239
271
  chunkFilename: isEnvProduction
@@ -608,168 +640,15 @@ module.exports = function (webpackEnv) {
608
640
  new webpack.DefinePlugin({
609
641
  __COMMIT_HASH__: JSON.stringify(commitHash)
610
642
  }),
611
- // isEnvDevelopment &&
612
- // Generates an `index.html` file with the <script> injected.
613
- new HtmlWebpackPlugin(
614
- Object.assign(
615
- {},
616
- {
617
- inject: true,
618
- template: paths.appHtml,
619
- },
620
- isEnvProduction
621
- ? {
622
- minify: {
623
- removeComments: true,
624
- collapseWhitespace: true,
625
- removeRedundantAttributes: true,
626
- useShortDoctype: true,
627
- removeEmptyAttributes: true,
628
- removeStyleLinkTypeAttributes: true,
629
- keepClosingSlash: true,
630
- minifyJS: true,
631
- minifyCSS: true,
632
- minifyURLs: true,
633
- },
634
- }
635
- : undefined
636
- )
637
- ),
638
- // isEnvDevelopment &&
639
- // Generates a `map.html` file with the <script> injected.
640
- new HtmlWebpackPlugin(
641
- Object.assign(
642
- {},
643
- {
644
- inject: true,
645
- filename: "map.html",
646
- template: paths.appHtmlMap,
647
- },
648
- isEnvProduction
649
- ? {
650
- minify: {
651
- removeComments: true,
652
- collapseWhitespace: true,
653
- removeRedundantAttributes: true,
654
- useShortDoctype: true,
655
- removeEmptyAttributes: true,
656
- removeStyleLinkTypeAttributes: true,
657
- keepClosingSlash: true,
658
- minifyJS: true,
659
- minifyCSS: true,
660
- minifyURLs: true,
661
- },
662
- }
663
- : undefined
664
- )
665
- ),
666
- // isEnvDevelopment &&
667
- // Generates a `map.html` file with the <script> injected.
668
- new HtmlWebpackPlugin(
669
- Object.assign(
670
- {},
671
- {
672
- inject: true,
673
- filename: "editor.html",
674
- template: paths.appHtmlEditor,
675
- },
676
- isEnvProduction
677
- ? {
678
- minify: {
679
- removeComments: true,
680
- collapseWhitespace: true,
681
- removeRedundantAttributes: true,
682
- useShortDoctype: true,
683
- removeEmptyAttributes: true,
684
- removeStyleLinkTypeAttributes: true,
685
- keepClosingSlash: true,
686
- minifyJS: true,
687
- minifyCSS: true,
688
- minifyURLs: true,
689
- },
690
- }
691
- : undefined
692
- )
693
- ),
694
- // isEnvDevelopment &&
695
- new HtmlWebpackPlugin(
696
- Object.assign(
697
- {},
698
- {
699
- inject: true,
700
- filename: "viewer.html",
701
- template: paths.appHtmlViewer,
702
- },
703
- isEnvProduction
704
- ? {
705
- minify: {
706
- removeComments: true,
707
- collapseWhitespace: true,
708
- removeRedundantAttributes: true,
709
- useShortDoctype: true,
710
- removeEmptyAttributes: true,
711
- removeStyleLinkTypeAttributes: true,
712
- keepClosingSlash: true,
713
- minifyJS: true,
714
- minifyCSS: true,
715
- minifyURLs: true,
716
- },
717
- }
718
- : undefined
719
- )
720
- ),
721
- new HtmlWebpackPlugin(
722
- Object.assign(
723
- {},
724
- {
725
- inject: true,
726
- filename: "widgets.html",
727
- template: paths.appHtmlWidgets,
728
- },
729
- isEnvProduction
730
- ? {
731
- minify: {
732
- removeComments: true,
733
- collapseWhitespace: true,
734
- removeRedundantAttributes: true,
735
- useShortDoctype: true,
736
- removeEmptyAttributes: true,
737
- removeStyleLinkTypeAttributes: true,
738
- keepClosingSlash: true,
739
- minifyJS: true,
740
- minifyCSS: true,
741
- minifyURLs: true,
742
- },
743
- }
744
- : undefined
745
- )
746
- ),
747
- new HtmlWebpackPlugin(
748
- Object.assign(
749
- {},
750
- {
751
- inject: true,
752
- filename: "photo.html",
753
- template: paths.appHtmlPhotoViewer,
754
- },
755
- isEnvProduction
756
- ? {
757
- minify: {
758
- removeComments: true,
759
- collapseWhitespace: true,
760
- removeRedundantAttributes: true,
761
- useShortDoctype: true,
762
- removeEmptyAttributes: true,
763
- removeStyleLinkTypeAttributes: true,
764
- keepClosingSlash: true,
765
- minifyJS: true,
766
- minifyCSS: true,
767
- minifyURLs: true,
768
- },
769
- }
770
- : undefined
771
- )
772
- ),
643
+
644
+ // HTML demo pages
645
+ getHtmlPlugin("index.html", paths.appHtml),
646
+ getHtmlPlugin("map.html", paths.appHtmlMap),
647
+ getHtmlPlugin("editor.html", paths.appHtmlEditor),
648
+ getHtmlPlugin("viewer.html", paths.appHtmlViewer),
649
+ getHtmlPlugin("photo.html", paths.appHtmlPhotoViewer),
650
+ getHtmlPlugin("widgets.html", paths.appHtmlWidgets),
651
+
773
652
  // Inlines the webpack runtime script. This script is too small to warrant
774
653
  // a network request.
775
654
  // https://github.com/facebook/create-react-app/issues/5358
@@ -807,7 +686,7 @@ module.exports = function (webpackEnv) {
807
686
  new MiniCssExtractPlugin({
808
687
  // Options similar to the same options in webpackOptions.output
809
688
  // both options are optional
810
- filename: 'index.css',
689
+ filename: '[name].css',
811
690
  chunkFilename: 'index.[contenthash:8].chunk.css',
812
691
  }),
813
692
  // Generate an asset manifest file with the following content:
package/docs/index.md CHANGED
@@ -31,9 +31,9 @@ Many options are available for installing the viewer.
31
31
  You can rely on various providers offering hosted NPM packages, for example JSDelivr.
32
32
 
33
33
  ```html
34
- <!-- You may use another version than 4.0.0, just change the release in URL -->
35
- <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@panoramax/web-viewer@4.0.0/build/index.css" />
36
- <script src="https://cdn.jsdelivr.net/npm/@panoramax/web-viewer@4.0.0/build/index.js"></script>
34
+ <!-- You may use another version than 4.1.0, just change the release in URL -->
35
+ <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@panoramax/web-viewer@4.1.0/build/index.css" />
36
+ <script src="https://cdn.jsdelivr.net/npm/@panoramax/web-viewer@4.1.0/build/index.js"></script>
37
37
  ```
38
38
 
39
39
  === ":material-code-tags: Source code"
@@ -62,6 +62,10 @@ First, you need to import Panoramax code:
62
62
  <!-- Change the actual path depending of where you installed the library -->
63
63
  <link rel="stylesheet" type="text/css" href="web-viewer/build/index.css" />
64
64
  <script src="web-viewer/build/index.js"></script>
65
+
66
+ <!-- You can use the lightweight version with only PhotoViewer as well -->
67
+ <link rel="stylesheet" type="text/css" href="web-viewer/build/photoviewer.css" />
68
+ <script src="web-viewer/build/photoviewer.js"></script>
65
69
  ```
66
70
 
67
71
  === ":fontawesome-brands-node-js: New-style JS"
@@ -73,6 +77,13 @@ First, you need to import Panoramax code:
73
77
  import '@panoramax/web-viewer/build/index.css';
74
78
  ```
75
79
 
80
+ If you prefer the lightweight version, only containing PhotoViewer component:
81
+
82
+ ```js
83
+ import Panoramax from '@panoramax/web-viewer/build/photoviewer';
84
+ import '@panoramax/web-viewer/build/photoviewer.css';
85
+ ```
86
+
76
87
  Once ready, you can create for example a viewer. We use web components to do so, you can create it in HTML or in other web components:
77
88
 
78
89
  ```html
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panoramax/web-viewer",
3
- "version": "4.1.0-develop-c921ed43",
3
+ "version": "4.1.0-develop-c175bf43",
4
4
  "description": "Panoramax web viewer for geolocated pictures",
5
5
  "main": "build/index.js",
6
6
  "author": "Panoramax team",
@@ -93,11 +93,11 @@
93
93
  "@fortawesome/fontawesome-svg-core": "^6.7.2",
94
94
  "@fortawesome/free-regular-svg-icons": "^6.7.2",
95
95
  "@fortawesome/free-solid-svg-icons": "^6.7.2",
96
- "@photo-sphere-viewer/core": "5.13.3",
97
- "@photo-sphere-viewer/equirectangular-tiles-adapter": "5.13.3",
98
- "@photo-sphere-viewer/gallery-plugin": "5.13.3",
99
- "@photo-sphere-viewer/markers-plugin": "5.13.3",
100
- "@photo-sphere-viewer/virtual-tour-plugin": "5.13.3",
96
+ "@photo-sphere-viewer/core": "5.13.4",
97
+ "@photo-sphere-viewer/equirectangular-tiles-adapter": "5.13.4",
98
+ "@photo-sphere-viewer/gallery-plugin": "5.13.4",
99
+ "@photo-sphere-viewer/markers-plugin": "5.13.4",
100
+ "@photo-sphere-viewer/virtual-tour-plugin": "5.13.4",
101
101
  "iconify-icon": "^3.0.0",
102
102
  "json5": "^2.2.3",
103
103
  "lit": "^3.2.1",
@@ -1,7 +1,7 @@
1
1
  import { LitElement, html } from "lit";
2
2
  import API from "../../utils/API";
3
3
  import { getTranslations } from "../../utils/i18n";
4
- import { DEFAULT_TILES } from "../../utils/map";
4
+ import { MapTiles } from "../../utils/services";
5
5
  import { createWebComp } from "../../utils/widgets";
6
6
  import { isInIframe, isInternetFast } from "../../utils/utils";
7
7
  import JSON5 from "json5";
@@ -57,7 +57,7 @@ export default class Basic extends LitElement {
57
57
 
58
58
  // Some defaults
59
59
  this.users = ["geovisio"];
60
- this.mapstyle = this.getAttribute("mapstyle") || DEFAULT_TILES;
60
+ this.mapstyle = this.getAttribute("mapstyle") || MapTiles();
61
61
  this.lang = this.getAttribute("lang") || null;
62
62
  this.endpoint = this.getAttribute("endpoint") || null; // No default
63
63
  this.picture = this.getAttribute("picture") || null;
@@ -14,7 +14,6 @@ import { querySelectorDeep } from "query-selector-shadow-dom";
14
14
  import { default as InitParameters, alterMapState, alterViewerState } from "../../utils/InitParameters";
15
15
 
16
16
 
17
- export const PSV_ZOOM_DELTA = 20;
18
17
  const MAP_MOVE_DELTA = 100;
19
18
 
20
19
 
@@ -7,7 +7,7 @@
7
7
 
8
8
  import * as core from "./core";
9
9
  import * as layout from "./layout";
10
- import * as menus from "./menus";
11
- import * as ui from "./ui";
10
+ import * as menus from "./menus/index";
11
+ import * as ui from "./ui/index";
12
12
 
13
13
  export {core, layout, menus, ui};
@@ -0,0 +1,8 @@
1
+ /* eslint-disable import/no-unused-modules */
2
+
3
+ // Lightweight export for PhotoViewer
4
+ import * as layout from "./layout";
5
+ import * as menus from "./menus/index_photoviewer";
6
+ import * as ui from "./ui/index_photoviewer";
7
+
8
+ export {layout, menus, ui};
@@ -0,0 +1,11 @@
1
+ /* eslint-disable import/no-unused-modules */
2
+
3
+ // Lightweight export for PhotoViewer
4
+ export {default as AnnotationsList} from "./AnnotationsList";
5
+ export {default as PictureLegend} from "./PictureLegend";
6
+ export {default as PictureMetadata} from "./PictureMetadata";
7
+ export {default as PlayerOptions} from "./PlayerOptions";
8
+ export {default as QualityScoreDoc} from "./QualityScoreDoc";
9
+ export {default as ReportForm} from "./ReportForm";
10
+ export {default as SemanticsMetadata} from "./SemanticsMetadata";
11
+ export {default as Share} from "./Share";
@@ -93,6 +93,7 @@ export default class Photo extends PSViewer {
93
93
  baseBlur: false,
94
94
  resolution: parent.isWidthSmall() ? 32 : 64,
95
95
  shouldGoFast: options.shouldGoFast,
96
+ useXmpData: false,
96
97
  }],
97
98
  withCredentials: parent.api._getPSVWithCredentials(),
98
99
  requestHeaders: parent?.fetchOptions?.headers,
@@ -22,5 +22,5 @@ export {default as SearchBar} from "./SearchBar";
22
22
  export {default as SemanticsEditor} from "./SemanticsEditor";
23
23
  export {default as SemanticsTable} from "./SemanticsTable";
24
24
  export {default as TogglableGroup} from "./TogglableGroup";
25
- import * as widgets from "./widgets";
25
+ import * as widgets from "./widgets/index";
26
26
  export {widgets};
@@ -0,0 +1,22 @@
1
+ /* eslint-disable import/no-unused-modules */
2
+
3
+ // Lightweight export for PhotoViewer
4
+ export {default as ButtonGroup} from "./ButtonGroup";
5
+ export {default as Button} from "./Button";
6
+ export {default as CopyButton} from "./CopyButton";
7
+ export {default as Grade} from "./Grade";
8
+ export {default as AnnotationsSwitch} from "./AnnotationsSwitch";
9
+ export {default as LinkButton} from "./LinkButton";
10
+ export {default as ListGroup} from "./ListGroup";
11
+ export {default as ListItem} from "./ListItem";
12
+ export {default as Loader} from "./Loader";
13
+ export {default as Photo} from "./Photo";
14
+ export {default as Popup} from "./Popup";
15
+ export {default as ProgressBar} from "./ProgressBar";
16
+ export {default as QualityScore} from "./QualityScore";
17
+ export {default as SearchBar} from "./SearchBar";
18
+ export {default as SemanticsEditor} from "./SemanticsEditor";
19
+ export {default as SemanticsTable} from "./SemanticsTable";
20
+ export {default as TogglableGroup} from "./TogglableGroup";
21
+ import * as widgets from "./widgets/index_photoviewer";
22
+ export {widgets};
@@ -1,6 +1,6 @@
1
1
  import { LitElement, html } from "lit";
2
2
  import { PSV_DEFAULT_ZOOM, PSV_ANIM_DURATION } from "../Photo";
3
- import { PSV_ZOOM_DELTA } from "../../core/Viewer";
3
+ import { PSV_ZOOM_DELTA } from "../../core/PhotoViewer";
4
4
  import { fa, onceParentAvailable } from "../../../utils/widgets";
5
5
  import { faPlus } from "@fortawesome/free-solid-svg-icons/faPlus";
6
6
  import { faMinus } from "@fortawesome/free-solid-svg-icons/faMinus";
@@ -0,0 +1,9 @@
1
+ /* eslint-disable import/no-unused-modules */
2
+
3
+ // Lightweight export for PhotoViewer
4
+ export {default as CopyCoordinates} from "./CopyCoordinates";
5
+ export {default as Legend} from "./Legend";
6
+ export {default as OSMEditors} from "./OSMEditors";
7
+ export {default as PictureLegendActions} from "./PictureLegendActions";
8
+ export {default as Player} from "./Player";
9
+ export {default as Zoom} from "./Zoom";
package/src/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable import/no-unused-modules */
2
2
 
3
- export * as components from "./components";
4
- export * as utils from "./utils";
3
+ export * as components from "./components/index";
4
+ export * as utils from "./utils/index";
5
5
  export {default as Viewer} from "./components/core/Viewer";
6
6
  export {default as CoverageMap} from "./components/core/CoverageMap";
7
7
  export {default as Editor} from "./components/core/Editor";
@@ -0,0 +1,6 @@
1
+ /* eslint-disable import/no-unused-modules */
2
+
3
+ // Lightweight export for PhotoViewer
4
+ export * as components from "./components/index_photoviewer";
5
+ export * as utils from "./utils/index_photoviewer";
6
+ export {default as PhotoViewer} from "./components/core/PhotoViewer";
package/src/utils/API.js CHANGED
@@ -1,6 +1,8 @@
1
- import { TILES_PICTURES_ZOOM } from "./map";
2
1
  import { isNullId } from "./utils";
3
2
 
3
+ // Do not use ./map import to avoid bundling Maplibre for PhotoViewer
4
+ const TILES_PICTURES_ZOOM = 15;
5
+
4
6
  /**
5
7
  * API contains various utility functions to communicate with Panoramax/STAC API
6
8
  *
@@ -1,6 +1,3 @@
1
- // DO NOT REMOVE THE "!": bundled builds breaks otherwise !!!
2
- import maplibregl from "!maplibre-gl";
3
-
4
1
  import { NominatimBaseUrl, AdresseDataGouvBaseURL } from "./services";
5
2
 
6
3
  const PLACETYPE_ZOOM = {
@@ -58,7 +55,7 @@ export function forwardGeocodingNominatim(config) {
58
55
  finalRes.features.push({
59
56
  place_type: ["place"],
60
57
  place_name: plname,
61
- center: new maplibregl.LngLat(...f.geometry.coordinates),
58
+ center: f.geometry.coordinates,
62
59
  zoom: PLACETYPE_ZOOM[f.properties?.geocoding?.type],
63
60
  });
64
61
  listedNames.push(plname);
@@ -195,7 +192,7 @@ export function forwardGeocodingStandard(config, endpoint) {
195
192
  finalRes.features.push({
196
193
  place_type: ["place"],
197
194
  place_name: plname,
198
- center: new maplibregl.LngLat(...f.geometry.coordinates),
195
+ center: f.geometry.coordinates,
199
196
  zoom: PLACETYPE_ZOOM[f.properties.type],
200
197
  });
201
198
  listedNames.push(plname);
@@ -0,0 +1,15 @@
1
+ /* eslint-disable import/no-unused-modules */
2
+
3
+ // Lightweight export for PhotoViewer
4
+ import * as i18n from "./i18n";
5
+ import * as picture from "./picture";
6
+ import * as semantics from "./semantics";
7
+ import * as services from "./services";
8
+ import * as utils from "./utils";
9
+ import * as widgets from "./widgets";
10
+
11
+ export { i18n, picture, semantics, services, utils, widgets };
12
+ export {default as API} from "./API";
13
+ export {default as PhotoAdapter} from "./PhotoAdapter";
14
+ export {default as PresetsManager} from "./PresetsManager";
15
+ export {default as URLHandler} from "./URLHandler";
package/src/utils/map.js CHANGED
@@ -3,7 +3,6 @@ import { COLORS, QUALITYSCORE_RES_FLAT_VALUES, QUALITYSCORE_RES_360_VALUES, QUAL
3
3
  import { autoDetectLocale } from "./i18n";
4
4
  import { isNullId } from "./utils";
5
5
 
6
- export const DEFAULT_TILES = "https://panoramax.openstreetmap.fr/pmtiles/basic.json";
7
6
  export const RASTER_LAYER_ID = "pnx-aerial";
8
7
 
9
8
  export const TILES_PICTURES_ZOOM = 15;
@@ -143,10 +143,11 @@ export function getSphereCorrection(picture) {
143
143
  /**
144
144
  * Compute PSV panoData for cropped panorama based on picture metadata & EXIF tags.
145
145
  * @param {object} picture The GeoJSON picture feature
146
+ * @param {object} [img] The loaded image file, with width, height properties for possible resizing
146
147
  * @returns {object} The PSV panoData values
147
148
  * @private
148
149
  */
149
- export function getCroppedPanoData(picture) {
150
+ export function getCroppedPanoData(picture, img) {
150
151
  let res;
151
152
 
152
153
  if(picture.properties?.["pers:interior_orientation"]) {
@@ -182,6 +183,10 @@ export function getCroppedPanoData(picture) {
182
183
  croppedWidth: parseInt(picture.properties.exif?.["Xmp.GPano.CroppedAreaImageWidthPixels"]),
183
184
  croppedHeight: parseInt(picture.properties.exif?.["Xmp.GPano.CroppedAreaImageHeightPixels"]),
184
185
  };
186
+
187
+ // Fix images with cropped size higher than full size
188
+ if(res.croppedWidth > res.fullWidth) { res.fullWidth = res.croppedWidth; }
189
+ if(res.croppedHeight > res.fullHeight) { res.fullHeight = res.croppedHeight; }
185
190
  }
186
191
  catch(e) {
187
192
  console.warn("Invalid XMP.GPano values for cropped panorama "+picture.id);
@@ -201,6 +206,19 @@ export function getCroppedPanoData(picture) {
201
206
  }
202
207
  }
203
208
 
209
+ // Resize if image given
210
+ if(res?.fullWidth && img?.width) {
211
+ let ratio = img.width / (res?.croppedWidth || res.fullWidth);
212
+ res = {
213
+ fullWidth: res.fullWidth !== undefined ? Math.floor(res.fullWidth * ratio) : undefined,
214
+ fullHeight: res.fullHeight !== undefined ? Math.floor(res.fullHeight * ratio) : undefined,
215
+ croppedWidth: res.croppedWidth !== undefined ? Math.floor(res.croppedWidth * ratio) : undefined,
216
+ croppedHeight: res.croppedHeight !== undefined ? Math.floor(res.croppedHeight * ratio) : undefined,
217
+ croppedX: res.croppedX !== undefined ? Math.floor(res.croppedX * ratio) : undefined,
218
+ croppedY: res.croppedY !== undefined ? Math.floor(res.croppedY * ratio) : undefined,
219
+ };
220
+ }
221
+
204
222
  return res || {};
205
223
  }
206
224
 
@@ -326,7 +344,7 @@ export function apiFeatureToPSVNode(f, t, fastInternet=false, customLinkFilter=n
326
344
  origBaseUrl: fastInternet ? hdUrl : baseUrl,
327
345
  hdUrl,
328
346
  thumbUrl,
329
- basePanoData: croppedPanoData,
347
+ basePanoData: fastInternet ? croppedPanoData : (img) => getCroppedPanoData(f, img),
330
348
  // This is only to mock loading of tiles (which are not available for flat pictures)
331
349
  cols: 2, rows: 1, width: 2, tileUrl: () => null
332
350
  };
@@ -4,6 +4,14 @@
4
4
  */
5
5
 
6
6
 
7
+ /**
8
+ * Default map background tiles
9
+ * @returns {string} The website URL
10
+ */
11
+ export function MapTiles() {
12
+ return "https://panoramax.openstreetmap.fr/pmtiles/basic.json";
13
+ }
14
+
7
15
  /**
8
16
  * Panoramax website URL
9
17
  * @returns {string} The website URL
@@ -4,10 +4,10 @@ exports[`forwardGeocodingBAN works 1`] = `
4
4
  Object {
5
5
  "features": Array [
6
6
  Object {
7
- "center": Object {
8
- "lat": 47.8,
9
- "lng": -1.7,
10
- },
7
+ "center": Array [
8
+ 2.290084,
9
+ 49.897443,
10
+ ],
11
11
  "place_name": "8 Boulevard du Port, Amiens",
12
12
  "place_type": Array [
13
13
  "place",
@@ -22,10 +22,10 @@ exports[`forwardGeocodingNominatim works 1`] = `
22
22
  Object {
23
23
  "features": Array [
24
24
  Object {
25
- "center": Object {
26
- "lat": 47.8,
27
- "lng": -1.7,
28
- },
25
+ "center": Array [
26
+ 2.3483915,
27
+ 48.8534951,
28
+ ],
29
29
  "place_name": "Paris, Île-de-France",
30
30
  "place_type": Array [
31
31
  "place",