mapshaper 0.6.85 → 0.6.87
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 +5 -1
- package/package.json +1 -1
- package/www/images/thumb-satellite.jpg +0 -0
- package/www/mapshaper-gui.js +19 -17
- package/www/mapshaper.js +5 -1
- package/www/page.css +2 -2
package/mapshaper.js
CHANGED
|
@@ -4236,12 +4236,16 @@
|
|
|
4236
4236
|
function pathIsRectangle(ids, arcs) {
|
|
4237
4237
|
var bbox = arcs.getSimpleShapeBounds(ids).toArray();
|
|
4238
4238
|
var iter = arcs.getShapeIter(ids);
|
|
4239
|
+
var count = 0;
|
|
4239
4240
|
while (iter.hasNext()) {
|
|
4240
4241
|
if (iter.x != bbox[0] && iter.x != bbox[2] ||
|
|
4241
4242
|
iter.y != bbox[1] && iter.y != bbox[3]) {
|
|
4242
4243
|
return false;
|
|
4243
4244
|
}
|
|
4245
|
+
count++;
|
|
4244
4246
|
}
|
|
4247
|
+
if (count < 5) return false;
|
|
4248
|
+
if (bbox[2] > bbox[0] === false || bbox[3] > bbox[1] === false) return false;
|
|
4245
4249
|
return true;
|
|
4246
4250
|
}
|
|
4247
4251
|
|
|
@@ -45574,7 +45578,7 @@ ${svg}
|
|
|
45574
45578
|
});
|
|
45575
45579
|
}
|
|
45576
45580
|
|
|
45577
|
-
var version = "0.6.
|
|
45581
|
+
var version = "0.6.87";
|
|
45578
45582
|
|
|
45579
45583
|
// Parse command line args into commands and run them
|
|
45580
45584
|
// Function takes an optional Node-style callback. A Promise is returned if no callback is given.
|
package/package.json
CHANGED
|
Binary file
|
package/www/mapshaper-gui.js
CHANGED
|
@@ -2428,7 +2428,7 @@
|
|
|
2428
2428
|
function error() {
|
|
2429
2429
|
var msg = GUI.formatMessageArgs(arguments);
|
|
2430
2430
|
console.error(msg);
|
|
2431
|
-
gui.alert('An
|
|
2431
|
+
gui.alert('An unknown error occured');
|
|
2432
2432
|
throw new Error(msg);
|
|
2433
2433
|
}
|
|
2434
2434
|
|
|
@@ -5811,11 +5811,14 @@
|
|
|
5811
5811
|
var altDown = false;
|
|
5812
5812
|
var spaceDown = false;
|
|
5813
5813
|
|
|
5814
|
-
function updateControlKeys(e) {
|
|
5814
|
+
function updateControlKeys(e, evtName) {
|
|
5815
5815
|
shiftDown = e.shiftKey;
|
|
5816
5816
|
ctrlDown = e.ctrlKey;
|
|
5817
5817
|
metaDown = e.metaKey;
|
|
5818
5818
|
altDown = e.altKey;
|
|
5819
|
+
if (e.keyCode == 32) {
|
|
5820
|
+
spaceDown = evtName == 'keydown';
|
|
5821
|
+
}
|
|
5819
5822
|
}
|
|
5820
5823
|
|
|
5821
5824
|
function mouseIsPressed() {
|
|
@@ -5823,17 +5826,14 @@
|
|
|
5823
5826
|
}
|
|
5824
5827
|
|
|
5825
5828
|
document.addEventListener('keyup', function(e) {
|
|
5826
|
-
if (!GUI.isActiveInstance(gui) || e.repeat) return;
|
|
5827
|
-
|
|
5828
|
-
if (e.keyCode == 32) spaceDown = false;
|
|
5829
|
-
updateControlKeys(e);
|
|
5829
|
+
if (!GUI.isActiveInstance(gui) || e.repeat && e.keyCode == 32) return;
|
|
5830
|
+
updateControlKeys(e, 'keyup');
|
|
5830
5831
|
self.dispatchEvent('keyup', getEventData(e));
|
|
5831
5832
|
});
|
|
5832
5833
|
|
|
5833
5834
|
document.addEventListener('keydown', function(e) {
|
|
5834
|
-
if (!GUI.isActiveInstance(gui) || e.repeat) return;
|
|
5835
|
-
|
|
5836
|
-
updateControlKeys(e);
|
|
5835
|
+
if (!GUI.isActiveInstance(gui) || e.repeat && e.keyCode == 32) return;
|
|
5836
|
+
updateControlKeys(e, 'keyup');
|
|
5837
5837
|
self.dispatchEvent('keydown', getEventData(e));
|
|
5838
5838
|
});
|
|
5839
5839
|
|
|
@@ -5886,7 +5886,7 @@
|
|
|
5886
5886
|
standard: ['info', 'selection', 'box'],
|
|
5887
5887
|
empty: ['edit_points', 'edit_lines', 'edit_polygons', 'box'],
|
|
5888
5888
|
polygons: ['info', 'selection', 'box', 'edit_polygons'],
|
|
5889
|
-
rectangles: ['info', 'selection', 'box', 'rectangles'],
|
|
5889
|
+
rectangles: ['info', 'selection', 'box', 'rectangles', 'edit_polygons'],
|
|
5890
5890
|
lines: ['info', 'selection', 'box' , 'edit_lines'],
|
|
5891
5891
|
table: ['info', 'selection'],
|
|
5892
5892
|
labels: ['info', 'selection', 'box', 'labels', 'edit_points'],
|
|
@@ -8817,7 +8817,9 @@
|
|
|
8817
8817
|
}
|
|
8818
8818
|
});
|
|
8819
8819
|
element.addEventListener('contextmenu', function(e) {
|
|
8820
|
-
|
|
8820
|
+
if (!e.ctrlKey) {
|
|
8821
|
+
_self.dispatchEvent('contextmenu', procMouseEvent(e));
|
|
8822
|
+
}
|
|
8821
8823
|
});
|
|
8822
8824
|
|
|
8823
8825
|
this.enable = function() {
|
|
@@ -10385,6 +10387,7 @@
|
|
|
10385
10387
|
|
|
10386
10388
|
gui.on('redo_path_extend', function(e) {
|
|
10387
10389
|
var target = hit.getHitTarget();
|
|
10390
|
+
|
|
10388
10391
|
if (pathDrawing() && prevHoverEvent) {
|
|
10389
10392
|
updatePathEndpoint(e.p);
|
|
10390
10393
|
appendVertex$1(target, pixToDataCoords(prevHoverEvent.x, prevHoverEvent.y));
|
|
@@ -10404,12 +10407,12 @@
|
|
|
10404
10407
|
} else {
|
|
10405
10408
|
deleteLastVertex(target);
|
|
10406
10409
|
}
|
|
10407
|
-
if (getLastArcLength(target) < 2) {
|
|
10408
|
-
gui.undo.undo(); // remove the path
|
|
10409
|
-
}
|
|
10410
10410
|
if (e.shapes) {
|
|
10411
10411
|
replaceDrawnShapes(e.shapes);
|
|
10412
10412
|
}
|
|
10413
|
+
if (getLastArcLength(target) < 2) {
|
|
10414
|
+
gui.undo.undo(); // remove the path
|
|
10415
|
+
}
|
|
10413
10416
|
});
|
|
10414
10417
|
|
|
10415
10418
|
function turnOn() {
|
|
@@ -10649,8 +10652,6 @@
|
|
|
10649
10652
|
var p = pixToDataCoords(e.x, e.y);
|
|
10650
10653
|
if (pathDrawing()) {
|
|
10651
10654
|
extendCurrentPath(hoverVertexInfo?.point || p);
|
|
10652
|
-
} else if (gui.keyboard.shiftIsPressed()) {
|
|
10653
|
-
deleteActiveVertex(e);
|
|
10654
10655
|
} else if (hoverVertexInfo?.type == 'interpolated') {
|
|
10655
10656
|
// don't start new path if hovering along a segment -- this is
|
|
10656
10657
|
// likely to be an attempt to add a new vertex, not start a new path
|
|
@@ -10752,7 +10753,8 @@
|
|
|
10752
10753
|
if (!pathDrawing()) return;
|
|
10753
10754
|
var target = hit.getHitTarget();
|
|
10754
10755
|
if (getLastArcLength(target) <= 2) { // includes hover point
|
|
10755
|
-
deleteLastPath(target);
|
|
10756
|
+
// deleteLastPath(target);
|
|
10757
|
+
gui.undo.undo(); // assume previous undo event was path_add
|
|
10756
10758
|
} else {
|
|
10757
10759
|
deleteLastVertex(target);
|
|
10758
10760
|
}
|
package/www/mapshaper.js
CHANGED
|
@@ -4236,12 +4236,16 @@
|
|
|
4236
4236
|
function pathIsRectangle(ids, arcs) {
|
|
4237
4237
|
var bbox = arcs.getSimpleShapeBounds(ids).toArray();
|
|
4238
4238
|
var iter = arcs.getShapeIter(ids);
|
|
4239
|
+
var count = 0;
|
|
4239
4240
|
while (iter.hasNext()) {
|
|
4240
4241
|
if (iter.x != bbox[0] && iter.x != bbox[2] ||
|
|
4241
4242
|
iter.y != bbox[1] && iter.y != bbox[3]) {
|
|
4242
4243
|
return false;
|
|
4243
4244
|
}
|
|
4245
|
+
count++;
|
|
4244
4246
|
}
|
|
4247
|
+
if (count < 5) return false;
|
|
4248
|
+
if (bbox[2] > bbox[0] === false || bbox[3] > bbox[1] === false) return false;
|
|
4245
4249
|
return true;
|
|
4246
4250
|
}
|
|
4247
4251
|
|
|
@@ -45574,7 +45578,7 @@ ${svg}
|
|
|
45574
45578
|
});
|
|
45575
45579
|
}
|
|
45576
45580
|
|
|
45577
|
-
var version = "0.6.
|
|
45581
|
+
var version = "0.6.87";
|
|
45578
45582
|
|
|
45579
45583
|
// Parse command line args into commands and run them
|
|
45580
45584
|
// Function takes an optional Node-style callback. A Promise is returned if no callback is given.
|
package/www/page.css
CHANGED