@gramps-connect/story 0.7.0 → 0.7.1

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/dist/editor.js CHANGED
@@ -1960,6 +1960,10 @@ var OVERLAY_PREFIX = "story-overlay-";
1960
1960
  var PLACES_SOURCE = "story-places";
1961
1961
  var PLACES_LAYER = "story-places-dots";
1962
1962
  var OVERVIEW_PADDING = 60;
1963
+ var POINT_ZOOM = 6;
1964
+ var SHAPE_MAX_ZOOM = 13;
1965
+ var SHAPE_PADDING = 40;
1966
+ var MIN_SHAPE_DEGREES = 1e-5;
1963
1967
  var EMPTY = { type: "FeatureCollection", features: [] };
1964
1968
  function moveCamera(map, slide, duration) {
1965
1969
  if (slide.overview) {
@@ -1969,12 +1973,12 @@ function moveCamera(map, slide, duration) {
1969
1973
  }
1970
1974
  const place = slide.place;
1971
1975
  const bounds = placeBounds(place);
1972
- if (bounds) {
1973
- map.fitBounds([[bounds[0], bounds[1]], [bounds[2], bounds[3]]], { maxZoom: 17, duration });
1976
+ if (bounds && Math.max(bounds[2] - bounds[0], bounds[3] - bounds[1]) >= MIN_SHAPE_DEGREES) {
1977
+ map.fitBounds([[bounds[0], bounds[1]], [bounds[2], bounds[3]]], { maxZoom: SHAPE_MAX_ZOOM, padding: SHAPE_PADDING, duration });
1974
1978
  return;
1975
1979
  }
1976
1980
  const center = placeCenter(place);
1977
- if (center) map.flyTo({ center, zoom: 9, essential: true, duration });
1981
+ if (center) map.flyTo({ center, zoom: POINT_ZOOM, essential: true, duration });
1978
1982
  }
1979
1983
  function placeMarker(marker, slide) {
1980
1984
  if (!marker) return;