Skip to content

Commit

Permalink
Update website
Browse files Browse the repository at this point in the history
  • Loading branch information
mbloch committed Apr 5, 2024
1 parent 1799c7c commit b328f8b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
24 changes: 12 additions & 12 deletions mapshaper-gui.js
Original file line number Diff line number Diff line change
Expand Up @@ -5811,29 +5811,29 @@
var altDown = false;
var spaceDown = false;

function updateControlKeys(e) {
function updateControlKeys(e, evtName) {
shiftDown = e.shiftKey;
ctrlDown = e.ctrlKey;
metaDown = e.metaKey;
altDown = e.altKey;
if (e.keyCode == 32) {
spaceDown = evtName == 'keydown';
}
}

function mouseIsPressed() {
return gui.map.getMouse().isDown();
}

document.addEventListener('keyup', function(e) {
if (!GUI.isActiveInstance(gui) || e.repeat) return;
// this can fail to fire if keyup occurs over a context menu
if (e.keyCode == 32) spaceDown = false;
updateControlKeys(e);
if (!GUI.isActiveInstance(gui) || e.repeat && e.keyCode == 32) return;
updateControlKeys(e, 'keyup');
self.dispatchEvent('keyup', getEventData(e));
});

document.addEventListener('keydown', function(e) {
if (!GUI.isActiveInstance(gui) || e.repeat) return;
if (e.keyCode == 32) spaceDown = true;
updateControlKeys(e);
if (!GUI.isActiveInstance(gui) || e.repeat && e.keyCode == 32) return;
updateControlKeys(e, 'keyup');
self.dispatchEvent('keydown', getEventData(e));
});

Expand Down Expand Up @@ -5886,7 +5886,7 @@
standard: ['info', 'selection', 'box'],
empty: ['edit_points', 'edit_lines', 'edit_polygons', 'box'],
polygons: ['info', 'selection', 'box', 'edit_polygons'],
rectangles: ['info', 'selection', 'box', 'rectangles'],
rectangles: ['info', 'selection', 'box', 'rectangles', 'edit_polygons'],
lines: ['info', 'selection', 'box' , 'edit_lines'],
table: ['info', 'selection'],
labels: ['info', 'selection', 'box', 'labels', 'edit_points'],
Expand Down Expand Up @@ -10387,6 +10387,7 @@

gui.on('redo_path_extend', function(e) {
var target = hit.getHitTarget();

if (pathDrawing() && prevHoverEvent) {
updatePathEndpoint(e.p);
appendVertex$1(target, pixToDataCoords(prevHoverEvent.x, prevHoverEvent.y));
Expand Down Expand Up @@ -10651,8 +10652,6 @@
var p = pixToDataCoords(e.x, e.y);
if (pathDrawing()) {
extendCurrentPath(hoverVertexInfo?.point || p);
} else if (gui.keyboard.shiftIsPressed()) {
deleteActiveVertex(e);
} else if (hoverVertexInfo?.type == 'interpolated') {
// don't start new path if hovering along a segment -- this is
// likely to be an attempt to add a new vertex, not start a new path
Expand Down Expand Up @@ -10754,7 +10753,8 @@
if (!pathDrawing()) return;
var target = hit.getHitTarget();
if (getLastArcLength(target) <= 2) { // includes hover point
deleteLastPath(target);
// deleteLastPath(target);
gui.undo.undo(); // assume previous undo event was path_add
} else {
deleteLastVertex(target);
}
Expand Down
6 changes: 5 additions & 1 deletion mapshaper.js
Original file line number Diff line number Diff line change
Expand Up @@ -4236,12 +4236,16 @@
function pathIsRectangle(ids, arcs) {
var bbox = arcs.getSimpleShapeBounds(ids).toArray();
var iter = arcs.getShapeIter(ids);
var count = 0;
while (iter.hasNext()) {
if (iter.x != bbox[0] && iter.x != bbox[2] ||
iter.y != bbox[1] && iter.y != bbox[3]) {
return false;
}
count++;
}
if (count < 5) return false;
if (bbox[2] > bbox[0] === false || bbox[3] > bbox[1] === false) return false;
return true;
}

Expand Down Expand Up @@ -45574,7 +45578,7 @@ ${svg}
});
}

var version = "0.6.86";
var version = "0.6.87";

// Parse command line args into commands and run them
// Function takes an optional Node-style callback. A Promise is returned if no callback is given.
Expand Down

0 comments on commit b328f8b

Please sign in to comment.