mapshaper 0.6.81 → 0.6.82
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/mapshaper.js +3 -3
- package/package.json +2 -2
- package/www/index.html +1 -1
- package/www/mapshaper-gui.js +59 -16
- package/www/mapshaper.js +3 -3
- package/www/modules.js +1856 -140
- package/www/page.css +10 -2
package/mapshaper.js
CHANGED
|
@@ -39557,7 +39557,7 @@ ${svg}
|
|
|
39557
39557
|
}
|
|
39558
39558
|
|
|
39559
39559
|
function isCircleClippedProjection(P) {
|
|
39560
|
-
return inList(P, 'stere,sterea,ups,ortho,gnom,laea,nsper,tpers');
|
|
39560
|
+
return inList(P, 'stere,sterea,ups,ortho,gnom,laea,nsper,tpers,geos');
|
|
39561
39561
|
}
|
|
39562
39562
|
|
|
39563
39563
|
function getPerspectiveClipAngle(P) {
|
|
@@ -39572,7 +39572,7 @@ ${svg}
|
|
|
39572
39572
|
|
|
39573
39573
|
function getDefaultClipAngle(P) {
|
|
39574
39574
|
var slug = getCrsSlug(P);
|
|
39575
|
-
if (slug == 'nsper') return getPerspectiveClipAngle(P);
|
|
39575
|
+
if (slug == 'nsper' || slug == 'geos') return getPerspectiveClipAngle(P);
|
|
39576
39576
|
if (slug == 'tpers') {
|
|
39577
39577
|
message('Automatic clipping is not supported for the Tilted Perspective projection');
|
|
39578
39578
|
return 0;
|
|
@@ -45535,7 +45535,7 @@ ${svg}
|
|
|
45535
45535
|
});
|
|
45536
45536
|
}
|
|
45537
45537
|
|
|
45538
|
-
var version = "0.6.
|
|
45538
|
+
var version = "0.6.82";
|
|
45539
45539
|
|
|
45540
45540
|
// Parse command line args into commands and run them
|
|
45541
45541
|
// Function takes an optional Node-style callback. A Promise is returned if no callback is given.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mapshaper",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.82",
|
|
4
4
|
"description": "A tool for editing vector datasets for mapping and GIS.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"shapefile",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"iconv-lite": "^0.6.3",
|
|
57
57
|
"idb-keyval": "^6.2.0",
|
|
58
58
|
"kdbush": "^3.0.0",
|
|
59
|
-
"mproj": "0.0.
|
|
59
|
+
"mproj": "0.0.38",
|
|
60
60
|
"msgpackr": "^1.10.1",
|
|
61
61
|
"opn": "^5.3.0",
|
|
62
62
|
"rw": "~1.3.3",
|
package/www/index.html
CHANGED
|
@@ -298,7 +298,7 @@ encoding=big5</span>. Click to see all options.</div></div></div></div>
|
|
|
298
298
|
<span class="intersection-check text-btn colored-text">Check line intersections</span><span class="intersection-count">0 line intersections</span>
|
|
299
299
|
<img class="close-btn" draggable="false" src="images/close.png">
|
|
300
300
|
<div class="repair-btn text-btn colored-text">Repair</div>
|
|
301
|
-
|
|
301
|
+
|
|
302
302
|
</div>
|
|
303
303
|
<div class="map-layers"></div>
|
|
304
304
|
<div class="basemap-container"><div class="basemap"></div></div>
|
package/www/mapshaper-gui.js
CHANGED
|
@@ -5812,6 +5812,7 @@
|
|
|
5812
5812
|
var ctrlDown = false;
|
|
5813
5813
|
var metaDown = false;
|
|
5814
5814
|
var altDown = false;
|
|
5815
|
+
var spaceDown = false;
|
|
5815
5816
|
|
|
5816
5817
|
function updateControlKeys(e) {
|
|
5817
5818
|
shiftDown = e.shiftKey;
|
|
@@ -5819,15 +5820,22 @@
|
|
|
5819
5820
|
metaDown = e.metaKey;
|
|
5820
5821
|
altDown = e.altKey;
|
|
5821
5822
|
}
|
|
5823
|
+
|
|
5824
|
+
function mouseIsPressed() {
|
|
5825
|
+
return gui.map.getMouse().isDown();
|
|
5826
|
+
}
|
|
5827
|
+
|
|
5822
5828
|
document.addEventListener('keyup', function(e) {
|
|
5823
|
-
if (!GUI.isActiveInstance(gui)) return;
|
|
5829
|
+
if (!GUI.isActiveInstance(gui) || e.repeat) return;
|
|
5824
5830
|
// this can fail to fire if keyup occurs over a context menu
|
|
5831
|
+
if (e.keyCode == 32) spaceDown = false;
|
|
5825
5832
|
updateControlKeys(e);
|
|
5826
5833
|
self.dispatchEvent('keyup', getEventData(e));
|
|
5827
5834
|
});
|
|
5828
5835
|
|
|
5829
5836
|
document.addEventListener('keydown', function(e) {
|
|
5830
|
-
if (!GUI.isActiveInstance(gui)) return;
|
|
5837
|
+
if (!GUI.isActiveInstance(gui) || e.repeat) return;
|
|
5838
|
+
if (e.keyCode == 32) spaceDown = true;
|
|
5831
5839
|
updateControlKeys(e);
|
|
5832
5840
|
self.dispatchEvent('keydown', getEventData(e));
|
|
5833
5841
|
});
|
|
@@ -5837,10 +5845,11 @@
|
|
|
5837
5845
|
updateControlKeys(e);
|
|
5838
5846
|
});
|
|
5839
5847
|
|
|
5840
|
-
this.shiftIsPressed =
|
|
5841
|
-
this.ctrlIsPressed =
|
|
5842
|
-
this.altIsPressed =
|
|
5843
|
-
this.metaIsPressed =
|
|
5848
|
+
this.shiftIsPressed = () => shiftDown;
|
|
5849
|
+
this.ctrlIsPressed = () => ctrlDown;
|
|
5850
|
+
this.altIsPressed = () => altDown;
|
|
5851
|
+
this.metaIsPressed = () => metaDown;
|
|
5852
|
+
this.spaceIsPressed = () => spaceDown;
|
|
5844
5853
|
|
|
5845
5854
|
this.onMenuSubmit = function(menuEl, cb) {
|
|
5846
5855
|
gui.on('enter_key', function(e) {
|
|
@@ -5878,7 +5887,7 @@
|
|
|
5878
5887
|
|
|
5879
5888
|
var menus = {
|
|
5880
5889
|
standard: ['info', 'selection', 'box'],
|
|
5881
|
-
empty: ['edit_points', 'edit_lines', 'edit_polygons'],
|
|
5890
|
+
empty: ['edit_points', 'edit_lines', 'edit_polygons', 'box'],
|
|
5882
5891
|
polygons: ['info', 'selection', 'box', 'edit_polygons'],
|
|
5883
5892
|
rectangles: ['info', 'selection', 'box', 'rectangles'],
|
|
5884
5893
|
lines: ['info', 'selection', 'box' , 'edit_lines'],
|
|
@@ -9282,6 +9291,14 @@
|
|
|
9282
9291
|
if (useBoxZoom()) zoomBox.turnOn();
|
|
9283
9292
|
dragStartEvt = e;
|
|
9284
9293
|
gui.dispatchEvent('shift_drag_start');
|
|
9294
|
+
} else {
|
|
9295
|
+
El('body').addClass('pan');
|
|
9296
|
+
setTimeout(function() {
|
|
9297
|
+
var body = El('body');
|
|
9298
|
+
if (body.hasClass('pan')) {
|
|
9299
|
+
body.addClass('panning');
|
|
9300
|
+
}
|
|
9301
|
+
}, 100);
|
|
9285
9302
|
}
|
|
9286
9303
|
});
|
|
9287
9304
|
|
|
@@ -9301,6 +9318,8 @@
|
|
|
9301
9318
|
shiftDrag = false;
|
|
9302
9319
|
gui.dispatchEvent('shift_drag_end', getBoxData(e));
|
|
9303
9320
|
zoomBox.turnOff();
|
|
9321
|
+
} else {
|
|
9322
|
+
El('body').removeClass('panning').removeClass('pan');
|
|
9304
9323
|
}
|
|
9305
9324
|
});
|
|
9306
9325
|
|
|
@@ -10304,7 +10323,7 @@
|
|
|
10304
10323
|
}
|
|
10305
10324
|
|
|
10306
10325
|
function pencilIsActive() {
|
|
10307
|
-
return
|
|
10326
|
+
return active() && (cmdKeyDown() || pathDrawing()) && !vertexDragging();
|
|
10308
10327
|
}
|
|
10309
10328
|
|
|
10310
10329
|
function polygonMode() {
|
|
@@ -10389,8 +10408,7 @@
|
|
|
10389
10408
|
function showInstructions() {
|
|
10390
10409
|
var isMac = navigator.userAgent.includes('Mac');
|
|
10391
10410
|
var undoKey = isMac ? '⌘' : '^';
|
|
10392
|
-
var
|
|
10393
|
-
var msg = `Instructions: Click to start a path or add a point. ${drawKey}-drag draws a path. Drag points to reshape. Type ${undoKey}Z/${undoKey}Y to undo/redo.`;
|
|
10411
|
+
var msg = `Instructions: click to start a path, click or drag to keep drawing. Drag vertices to reshape a path. Type ${undoKey}Z/${undoKey}Y to undo/redo.`;
|
|
10394
10412
|
alert = showPopupAlert(msg, null, {
|
|
10395
10413
|
non_blocking: true, max_width: '388px'});
|
|
10396
10414
|
}
|
|
@@ -10449,8 +10467,15 @@
|
|
|
10449
10467
|
drawingId = -1;
|
|
10450
10468
|
hoverVertexInfo = null;
|
|
10451
10469
|
prevClickEvent = prevHoverEvent = null;
|
|
10470
|
+
updateCursor();
|
|
10452
10471
|
}
|
|
10453
10472
|
|
|
10473
|
+
gui.keyboard.on('keydown', function(e) {
|
|
10474
|
+
if (active() && e.keyName == 'space') {
|
|
10475
|
+
e.stopPropagation(); // prevent console from opening if shift-panning
|
|
10476
|
+
}
|
|
10477
|
+
}, null, 1);
|
|
10478
|
+
|
|
10454
10479
|
hit.on('contextmenu', function(e) {
|
|
10455
10480
|
if (!active() || pathDrawing() || vertexDragging()) return;
|
|
10456
10481
|
var target = hit.getHitTarget();
|
|
@@ -10482,9 +10507,19 @@
|
|
|
10482
10507
|
});
|
|
10483
10508
|
|
|
10484
10509
|
gui.map.getMouse().on('drag', function(e) {
|
|
10485
|
-
if (!
|
|
10510
|
+
if (!pencilIsActive()) {
|
|
10511
|
+
if (!pencilPoints) {
|
|
10512
|
+
// null points signals that a path was just completed -- block panning
|
|
10513
|
+
e.stopPropagation();
|
|
10514
|
+
}
|
|
10515
|
+
return;
|
|
10516
|
+
}
|
|
10517
|
+
if (gui.keyboard.spaceIsPressed()) {
|
|
10518
|
+
// pan if dragging with spacebar down
|
|
10519
|
+
pencilPoints = []; // don't continue previous line after panning
|
|
10520
|
+
return;
|
|
10521
|
+
}
|
|
10486
10522
|
e.stopPropagation(); // prevent panning
|
|
10487
|
-
if (!pencilIsActive()) return;
|
|
10488
10523
|
hoverVertexInfo = findPathStartInfo(e);
|
|
10489
10524
|
var xy = [e.x, e.y];
|
|
10490
10525
|
var p = pixToDataCoords(e.x, e.y);
|
|
@@ -10624,9 +10659,11 @@
|
|
|
10624
10659
|
}
|
|
10625
10660
|
|
|
10626
10661
|
function updateCursor() {
|
|
10627
|
-
gui.container.findChild('.map-layers')
|
|
10662
|
+
var el = gui.container.findChild('.map-layers');
|
|
10663
|
+
el.classed('draw-tool', active());
|
|
10628
10664
|
var useArrow = hoverVertexInfo && !hoverVertexInfo.extendable && !pathDrawing();
|
|
10629
|
-
|
|
10665
|
+
el.classed('dragging', useArrow);
|
|
10666
|
+
el.classed('drawing', pathDrawing());
|
|
10630
10667
|
}
|
|
10631
10668
|
|
|
10632
10669
|
function vertexIsEndpoint(info, target) {
|
|
@@ -12063,7 +12100,7 @@
|
|
|
12063
12100
|
|
|
12064
12101
|
new SimpleButton(popup.findChild('.select-btn')).on('click', function() {
|
|
12065
12102
|
var coords = box.getDataCoords();
|
|
12066
|
-
if (!coords) return;
|
|
12103
|
+
if (!coords || noData()) return;
|
|
12067
12104
|
gui.enterMode('selection_tool');
|
|
12068
12105
|
gui.interaction.setMode('selection');
|
|
12069
12106
|
// kludge to pass bbox to the selection tool
|
|
@@ -12072,6 +12109,10 @@
|
|
|
12072
12109
|
});
|
|
12073
12110
|
});
|
|
12074
12111
|
|
|
12112
|
+
function noData() {
|
|
12113
|
+
return !gui.model.getActiveLayer();
|
|
12114
|
+
}
|
|
12115
|
+
|
|
12075
12116
|
new SimpleButton(popup.findChild('.clip-btn')).on('click', function() {
|
|
12076
12117
|
runCommand('-clip bbox=' + box.getDataCoords().join(','));
|
|
12077
12118
|
});
|
|
@@ -12129,7 +12170,9 @@
|
|
|
12129
12170
|
|
|
12130
12171
|
function showCoords() {
|
|
12131
12172
|
El(infoBtn.node()).addClass('selected-btn');
|
|
12132
|
-
|
|
12173
|
+
var bbox = box.getDataCoords();
|
|
12174
|
+
var rounded = internal.getRoundedCoords(bbox, internal.getBoundsPrecisionForDisplay(bbox));
|
|
12175
|
+
coords.text(rounded.join(','));
|
|
12133
12176
|
coords.show();
|
|
12134
12177
|
GUI.selectElement(coords.node());
|
|
12135
12178
|
}
|
package/www/mapshaper.js
CHANGED
|
@@ -39557,7 +39557,7 @@ ${svg}
|
|
|
39557
39557
|
}
|
|
39558
39558
|
|
|
39559
39559
|
function isCircleClippedProjection(P) {
|
|
39560
|
-
return inList(P, 'stere,sterea,ups,ortho,gnom,laea,nsper,tpers');
|
|
39560
|
+
return inList(P, 'stere,sterea,ups,ortho,gnom,laea,nsper,tpers,geos');
|
|
39561
39561
|
}
|
|
39562
39562
|
|
|
39563
39563
|
function getPerspectiveClipAngle(P) {
|
|
@@ -39572,7 +39572,7 @@ ${svg}
|
|
|
39572
39572
|
|
|
39573
39573
|
function getDefaultClipAngle(P) {
|
|
39574
39574
|
var slug = getCrsSlug(P);
|
|
39575
|
-
if (slug == 'nsper') return getPerspectiveClipAngle(P);
|
|
39575
|
+
if (slug == 'nsper' || slug == 'geos') return getPerspectiveClipAngle(P);
|
|
39576
39576
|
if (slug == 'tpers') {
|
|
39577
39577
|
message('Automatic clipping is not supported for the Tilted Perspective projection');
|
|
39578
39578
|
return 0;
|
|
@@ -45535,7 +45535,7 @@ ${svg}
|
|
|
45535
45535
|
});
|
|
45536
45536
|
}
|
|
45537
45537
|
|
|
45538
|
-
var version = "0.6.
|
|
45538
|
+
var version = "0.6.82";
|
|
45539
45539
|
|
|
45540
45540
|
// Parse command line args into commands and run them
|
|
45541
45541
|
// Function takes an optional Node-style callback. A Promise is returned if no callback is given.
|