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 +3 -0
- package/mapshaper.js +1 -1
- package/package.json +1 -1
- package/www/mapshaper-gui.js +21 -14
- package/www/mapshaper.js +1 -1
package/CHANGELOG.md
CHANGED
package/mapshaper.js
CHANGED
package/package.json
CHANGED
package/www/mapshaper-gui.js
CHANGED
|
@@ -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
|
-
|
|
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
|
}
|