mirror of
https://github.com/FoggedLens/iD.git
synced 2026-03-31 01:09:22 +02:00
Fix lasso and add it to select
This commit is contained in:
@@ -22,8 +22,8 @@ iD.behavior.Select = function(context) {
|
||||
|
||||
function mousedown() {
|
||||
var datum = d3.event.target.__data__;
|
||||
pos = [d3.event.x, d3.event.y];
|
||||
if (datum instanceof iD.Entity || (datum && datum.type === 'midpoint')) {
|
||||
pos = [d3.event.x, d3.event.y];
|
||||
selection
|
||||
.on('mousemove.select', mousemove)
|
||||
.on('touchmove.select', mousemove);
|
||||
@@ -46,8 +46,6 @@ iD.behavior.Select = function(context) {
|
||||
// save the event for the click handler
|
||||
})(d3.event), 200);
|
||||
}
|
||||
} else {
|
||||
context.enter(iD.modes.Browse(context));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,6 +59,10 @@ iD.behavior.Select = function(context) {
|
||||
|
||||
function mouseup() {
|
||||
selection.on('mousemove.select', null);
|
||||
if (d3.event.x === pos[0] && d3.event.y === pos[1] &&
|
||||
!(d3.event.target.__data__ instanceof iD.Entity)) {
|
||||
context.enter(iD.modes.Browse(context));
|
||||
}
|
||||
}
|
||||
|
||||
selection
|
||||
|
||||
@@ -9,6 +9,7 @@ iD.modes.Select = function(context, selection, initial) {
|
||||
behaviors = [
|
||||
iD.behavior.Hover(),
|
||||
iD.behavior.Select(context),
|
||||
iD.behavior.Lasso(context),
|
||||
iD.behavior.DragNode(context)],
|
||||
radialMenu;
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@ describe("iD.behavior.Select", function() {
|
||||
context.enter(iD.modes.Select(context, [a.id]));
|
||||
happen.click(context.surface().node());
|
||||
happen.mousedown(context.surface().node());
|
||||
happen.mouseup(context.surface().node());
|
||||
window.setTimeout(function() {
|
||||
expect(context.selection()).to.eql([]);
|
||||
done();
|
||||
|
||||
Reference in New Issue
Block a user