mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-14 21:28:11 +02:00
Refactor modes, use latedrag
This commit is contained in:
@@ -13,7 +13,7 @@ iD.modes.AddArea = function() {
|
||||
mode.map.surface.on('click.addarea', function() {
|
||||
var datum = d3.select(d3.event.target).datum() || {},
|
||||
node,
|
||||
way = iD.Way({tags: { building: 'yes', area: 'yes', elastic: 'true' }});
|
||||
way = iD.Way({tags: { building: 'yes', area: 'yes' }});
|
||||
|
||||
// connect a way to an existing way
|
||||
if (datum.type === 'node') {
|
||||
|
||||
@@ -16,7 +16,7 @@ iD.modes.AddRoad = function() {
|
||||
node,
|
||||
direction = 'forward',
|
||||
start = true,
|
||||
way = iD.Way({ tags: { highway: 'residential', elastic: 'true' } });
|
||||
way = iD.Way({ tags: { highway: 'residential' } });
|
||||
|
||||
if (datum.type === 'node') {
|
||||
// continue an existing way
|
||||
|
||||
@@ -12,7 +12,7 @@ iD.modes.DrawRoad = function(way_id, direction) {
|
||||
'end the road.');
|
||||
|
||||
var index = (direction === 'forward') ? undefined : -1,
|
||||
node = iD.Node({loc: mode.map.mouseCoordinates(), tags: { elastic: true } }),
|
||||
node = iD.Node({loc: mode.map.mouseCoordinates() }),
|
||||
way = mode.history.graph().entity(way_id),
|
||||
firstNode = way.nodes[0],
|
||||
lastNode = _.last(way.nodes);
|
||||
|
||||
@@ -154,7 +154,8 @@ iD.Map = function() {
|
||||
});
|
||||
handles.attr('transform', function(entity) {
|
||||
var p = projection(entity.loc);
|
||||
return 'translate(' + [~~p[0], ~~p[1]] + ') translate(-3, -3) rotate(45, 3, 3)';
|
||||
return 'translate(' + [~~p[0], ~~p[1]] +
|
||||
') translate(-3, -3) rotate(45, 3, 3)';
|
||||
})
|
||||
.classed('active', classActive)
|
||||
.sort(olderOnTop);
|
||||
|
||||
@@ -50,7 +50,7 @@ iD.Style.markerimage = function(d) {
|
||||
|
||||
iD.Style.TAG_CLASSES = iD.util.trueObj([
|
||||
'highway', 'railway', 'motorway', 'amenity', 'natural',
|
||||
'landuse', 'building', 'oneway', 'bridge', 'elastic'
|
||||
'landuse', 'building', 'oneway', 'bridge'
|
||||
]);
|
||||
|
||||
iD.Style.styleClasses = function(pre) {
|
||||
|
||||
@@ -7,7 +7,7 @@ d3.latedrag = function() {
|
||||
selection.on('mousedown.latedrag', function() {
|
||||
var datum = d3.select(d3.event.target).datum();
|
||||
if (datum && filter(datum)) {
|
||||
mousedown.apply(d3.event.target, [datum]);
|
||||
mousedown.apply(selection.node(), [datum]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user