mapshaper 0.5.104 → 0.5.105

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/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ v0.5.105
2
+ * More basemap improvements.
3
+
1
4
  v0.5.104
2
5
  * Improvements to the basemap feature.
3
6
 
package/mapshaper.js CHANGED
@@ -1,6 +1,6 @@
1
1
  (function () {
2
2
 
3
- var VERSION = "0.5.104";
3
+ var VERSION = "0.5.105";
4
4
 
5
5
 
6
6
  var utils = /*#__PURE__*/Object.freeze({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mapshaper",
3
- "version": "0.5.104",
3
+ "version": "0.5.105",
4
4
  "description": "A tool for editing vector datasets for mapping and GIS.",
5
5
  "keywords": [
6
6
  "shapefile",
@@ -8386,24 +8386,32 @@
8386
8386
  function recenter(cx, cy, scale, data) {
8387
8387
  scale = scale ? limitScale(scale) : _scale;
8388
8388
  if (cx == _cx && cy == _cy && scale == _scale) return;
8389
+ navigate(cx, cy, scale);
8390
+ onChange(data);
8391
+ }
8392
+
8393
+ function navigate(cx, cy, scale) {
8389
8394
  if (_strictBounds) {
8390
- scale = Math.max(1, scale);
8395
+ var full = fillOut(_contentBounds);
8396
+ var minScale = full.height() / _strictBounds.height();
8397
+ if (scale < minScale) {
8398
+ var dx = cx - _cx;
8399
+ cx = _cx + dx * (minScale - _scale) / (scale - _scale);
8400
+ scale = minScale;
8401
+ }
8402
+ var dist = full.height() / 2 / scale;
8403
+ var ymax = _strictBounds.ymax - dist;
8404
+ var ymin = _strictBounds.ymin + dist;
8405
+ if (cy > ymax ) {
8406
+ cy = ymax;
8407
+ }
8408
+ if (cy < ymin) {
8409
+ cy = ymin;
8410
+ }
8391
8411
  }
8392
8412
  _cx = cx;
8393
8413
  _cy = cy;
8394
8414
  _scale = scale;
8395
- limitExtent();
8396
- onChange(data);
8397
- }
8398
-
8399
- function limitExtent() {
8400
- if (!_strictBounds) return;
8401
- if (_scale < 1) _scale = 1;
8402
- var dist = _strictBounds.height() / 2 / _scale;
8403
- var ymax = _strictBounds.ymax - dist;
8404
- var ymin = _strictBounds.ymin + dist;
8405
- if (_cy > ymax) _cy = ymax;
8406
- if (_cy < ymin) _cy = ymin;
8407
8415
  }
8408
8416
 
8409
8417
  function onChange(data) {
@@ -8473,7 +8481,6 @@
8473
8481
  function fitIn(b, b2) {
8474
8482
  // only fitting vertical extent
8475
8483
  // (currently only used in basemap view to enforce Mapbox's vertical limits)
8476
-
8477
8484
  if (b.height() > b2.height()) {
8478
8485
  b.scale(b2.height() / b.height());
8479
8486
  }
package/www/mapshaper.js CHANGED
@@ -1,6 +1,6 @@
1
1
  (function () {
2
2
 
3
- var VERSION = "0.5.104";
3
+ var VERSION = "0.5.105";
4
4
 
5
5
 
6
6
  var utils = /*#__PURE__*/Object.freeze({