Skip to content

Commit

Permalink
feat(geomap): set default position
Browse files Browse the repository at this point in the history
  • Loading branch information
eliandoran committed Jan 22, 2025
1 parent a8e2c29 commit 9e2c592
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/public/app/widgets/type_widgets/geo_map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ const TPL = `\

const LOCATION_ATTRIBUTE = "geolocation";
const CHILD_NOTE_ICON = "bx bx-pin";
const DEFAULT_COORDINATES: [ number, number ] = [ 3.878638227135724, 446.6630455551659 ];
const DEFAULT_ZOOM = 2;

interface MapData {
view?: {
Expand Down Expand Up @@ -143,8 +145,8 @@ export default class GeoMapTypeWidget extends TypeWidget {
}

// Restore viewport position & zoom
const center = parsedContent.view?.center ?? [51.505, -0.09];
const zoom = parsedContent.view?.zoom ?? 13;
const center = parsedContent.view?.center ?? DEFAULT_COORDINATES;
const zoom = parsedContent.view?.zoom ?? DEFAULT_ZOOM;
map.setView(center, zoom);

// Restore markers.
Expand Down

0 comments on commit 9e2c592

Please sign in to comment.