Refactor modes, use latedrag

This commit is contained in:
Tom MacWright
2012-12-06 17:54:32 -05:00
parent cd3129061c
commit 6e9d9ba274
6 changed files with 7 additions and 6 deletions
+1 -1
View File
@@ -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') {
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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);
+2 -1
View File
@@ -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);
+1 -1
View File
@@ -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) {
+1 -1
View File
@@ -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]);
}
});
}