mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-24 09:04:02 +02:00
Merge branch 'master' into presets
This commit is contained in:
@@ -616,6 +616,14 @@ text.pointlabel {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.layer-halo rect,
|
||||
.layer-halo path,
|
||||
.layer-label text {
|
||||
-webkit-transition: opacity 100ms linear;
|
||||
transition: opacity 100ms linear;
|
||||
-moz-transition: opacity 100ms linear;
|
||||
}
|
||||
|
||||
.pathlabel .textpath {
|
||||
dominant-baseline: middle;
|
||||
}
|
||||
|
||||
@@ -98,6 +98,7 @@
|
||||
<script src='js/id/behavior/draw.js'></script>
|
||||
<script src='js/id/behavior/draw_way.js'></script>
|
||||
<script src='js/id/behavior/hover.js'></script>
|
||||
<script src='js/id/behavior/select.js'></script>
|
||||
|
||||
<script src='js/id/modes.js'></script>
|
||||
<script src='js/id/modes/add_area.js'></script>
|
||||
|
||||
@@ -32,7 +32,7 @@ iD.behavior.AddWay = function(mode) {
|
||||
};
|
||||
|
||||
addWay.cancel = function() {
|
||||
controller.exit();
|
||||
controller.enter(iD.modes.Browse());
|
||||
};
|
||||
|
||||
return d3.rebind(addWay, event, 'on');
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
iD.behavior.Select = function(mode) {
|
||||
var controller = mode.controller;
|
||||
|
||||
function click() {
|
||||
var datum = d3.select(d3.event.target).datum();
|
||||
if (datum instanceof iD.Entity) {
|
||||
controller.enter(iD.modes.Select([datum.id]));
|
||||
} else {
|
||||
controller.enter(iD.modes.Browse());
|
||||
}
|
||||
}
|
||||
|
||||
var behavior = function(selection) {
|
||||
selection.on('click.select', click);
|
||||
};
|
||||
|
||||
behavior.off = function(selection) {
|
||||
selection.on('click.select', null);
|
||||
};
|
||||
|
||||
return behavior;
|
||||
};
|
||||
@@ -19,9 +19,5 @@ iD.Controller = function(map, history) {
|
||||
event.enter(mode);
|
||||
};
|
||||
|
||||
controller.exit = function() {
|
||||
controller.enter(iD.modes.Browse());
|
||||
};
|
||||
|
||||
return d3.rebind(controller, event, 'on');
|
||||
};
|
||||
|
||||
@@ -32,7 +32,7 @@ iD.modes.AddPoint = function() {
|
||||
}
|
||||
|
||||
function cancel() {
|
||||
controller.exit();
|
||||
controller.enter(iD.modes.Browse());
|
||||
}
|
||||
|
||||
behavior = iD.behavior.Draw(map)
|
||||
|
||||
@@ -14,19 +14,13 @@ iD.modes.Browse = function() {
|
||||
|
||||
behaviors = [
|
||||
iD.behavior.Hover(),
|
||||
iD.behavior.Select(mode),
|
||||
iD.behavior.DragNode(mode),
|
||||
iD.behavior.DragMidpoint(mode)];
|
||||
|
||||
behaviors.forEach(function(behavior) {
|
||||
behavior(surface);
|
||||
});
|
||||
|
||||
surface.on('click.browse', function () {
|
||||
var datum = d3.select(d3.event.target).datum();
|
||||
if (datum instanceof iD.Entity) {
|
||||
mode.controller.enter(iD.modes.Select([datum.id]));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
mode.exit = function() {
|
||||
@@ -35,8 +29,6 @@ iD.modes.Browse = function() {
|
||||
behaviors.forEach(function(behavior) {
|
||||
behavior.off(surface);
|
||||
});
|
||||
|
||||
surface.on('click.browse', null);
|
||||
};
|
||||
|
||||
return mode;
|
||||
|
||||
@@ -16,14 +16,18 @@ iD.modes.MoveWay = function(wayId) {
|
||||
origin = d3.mouse(selection.node()),
|
||||
annotation = t('operations.move.annotation.' + way.geometry(graph));
|
||||
|
||||
// If intiated via keyboard
|
||||
if (!origin[0] && !origin[1]) origin = null;
|
||||
|
||||
history.perform(
|
||||
iD.actions.Noop(),
|
||||
annotation);
|
||||
|
||||
function move() {
|
||||
var p = d3.mouse(selection.node()),
|
||||
delta = [p[0] - origin[0],
|
||||
p[1] - origin[1]];
|
||||
delta = origin ?
|
||||
[p[0] - origin[0], p[1] - origin[1]] :
|
||||
[0, 0];
|
||||
|
||||
origin = p;
|
||||
|
||||
|
||||
+6
-18
@@ -40,6 +40,7 @@ iD.modes.Select = function(selection, initial) {
|
||||
|
||||
behaviors = [
|
||||
iD.behavior.Hover(),
|
||||
iD.behavior.Select(mode),
|
||||
iD.behavior.DragNode(mode),
|
||||
iD.behavior.DragMidpoint(mode)];
|
||||
|
||||
@@ -89,7 +90,7 @@ iD.modes.Select = function(selection, initial) {
|
||||
|
||||
inspector
|
||||
.on('changeTags', changeTags)
|
||||
.on('close', function() { mode.controller.exit(); });
|
||||
.on('close', function() { mode.controller.enter(iD.modes.Browse()); });
|
||||
|
||||
history.on('change.select', function() {
|
||||
// Exit mode if selected entity gets undone
|
||||
@@ -110,15 +111,6 @@ iD.modes.Select = function(selection, initial) {
|
||||
surface.call(radialMenu.close);
|
||||
});
|
||||
|
||||
function click() {
|
||||
var datum = d3.select(d3.event.target).datum();
|
||||
if (datum instanceof iD.Entity) {
|
||||
mode.controller.enter(iD.modes.Select([datum.id]));
|
||||
} else {
|
||||
mode.controller.enter(iD.modes.Browse());
|
||||
}
|
||||
}
|
||||
|
||||
function dblclick() {
|
||||
var target = d3.select(d3.event.target),
|
||||
datum = target.datum();
|
||||
@@ -138,13 +130,11 @@ iD.modes.Select = function(selection, initial) {
|
||||
}
|
||||
}
|
||||
|
||||
surface.on('click.select', click)
|
||||
.on('dblclick.select', dblclick);
|
||||
|
||||
d3.select(document)
|
||||
.call(keybinding);
|
||||
|
||||
surface.selectAll("*")
|
||||
surface.on('dblclick.select', dblclick)
|
||||
.selectAll("*")
|
||||
.filter(function (d) { return d && selection.indexOf(d.id) >= 0; })
|
||||
.classed('selected', true);
|
||||
|
||||
@@ -186,12 +176,10 @@ iD.modes.Select = function(selection, initial) {
|
||||
|
||||
keybinding.off();
|
||||
|
||||
surface.on('click.select', null)
|
||||
.on('dblclick.select', null);
|
||||
|
||||
history.on('change.select', null);
|
||||
|
||||
surface.selectAll(".selected")
|
||||
surface.on('dblclick.select', null)
|
||||
.selectAll(".selected")
|
||||
.classed('selected', false);
|
||||
|
||||
surface.call(radialMenu.close);
|
||||
|
||||
@@ -200,12 +200,31 @@ iD.svg.Labels = function(projection) {
|
||||
|
||||
}
|
||||
|
||||
function hideOnMouseover() {
|
||||
var mouse = d3.mouse(this),
|
||||
pad = 50,
|
||||
rect = new RTree.Rectangle(mouse[0] - pad, mouse[1] - pad, 2*pad, 2*pad),
|
||||
labels = _.pluck(rtree.search(rect, this), 'leaf'),
|
||||
selection = d3.select(this);
|
||||
|
||||
selection.selectAll('.layer-label text, .layer-halo path, .layer-halo rect')
|
||||
.style('opacity', '');
|
||||
|
||||
if (!labels.length) return;
|
||||
selection.selectAll('.layer-label text, .layer-halo path, .layer-halo rect')
|
||||
.filter(function(d) {
|
||||
return _.contains(labels, d.id);
|
||||
})
|
||||
.style('opacity', 0);
|
||||
}
|
||||
|
||||
var rtree = new RTree(),
|
||||
rectangles = {};
|
||||
|
||||
return function drawLabels(surface, graph, entities, filter, dimensions, fullRedraw) {
|
||||
|
||||
d3.select(surface.node().parentNode)
|
||||
.on('mousemove.hidelabels', hideOnMouseover);
|
||||
|
||||
var hidePoints = !d3.select('.node.point').node();
|
||||
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ iD.svg.Lines = function(projection) {
|
||||
|
||||
return function drawLines(surface, graph, entities, filter) {
|
||||
function drawPaths(group, lines, filter, classes, lineString) {
|
||||
var paths = group.selectAll('path')
|
||||
var paths = group.selectAll('path.line')
|
||||
.filter(filter)
|
||||
.data(lines, iD.Entity.key);
|
||||
|
||||
|
||||
@@ -94,6 +94,7 @@
|
||||
<script src='../js/id/behavior/draw.js'></script>
|
||||
<script src='../js/id/behavior/draw_way.js'></script>
|
||||
<script src='../js/id/behavior/hover.js'></script>
|
||||
<script src='../js/id/behavior/select.js'></script>
|
||||
|
||||
<script src='../js/id/modes.js'></script>
|
||||
<script src='../js/id/modes/add_area.js'></script>
|
||||
|
||||
Reference in New Issue
Block a user