From 40f6f55e725b1536852cb4aeaa5b1942ccc24531 Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Tue, 4 Dec 2012 13:15:15 -0500 Subject: [PATCH] More cleanup --- js/id/renderer/map.js | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/js/id/renderer/map.js b/js/id/renderer/map.js index 7b5649ece..a5112703b 100644 --- a/js/id/renderer/map.js +++ b/js/id/renderer/map.js @@ -348,21 +348,12 @@ iD.Map = function() { selection = null; } - function selectEntity(entity) { - selection = entity.id; - d3.select('.inspector-wrap') - .style('display', 'block') - .datum(history.graph().fetch(entity.id)) - .call(inspector); - redraw(); - } - function selectClick() { var entity = d3.select(d3.event.target).data(); if (entity) entity = entity[0]; if (!entity || selection === entity.id || (entity.tags && entity.tags.elastic)) return; if (entity.type === 'way') d3.select(d3.event.target).call(waydragbehavior); - selectEntity(entity); + map.selectEntity(entity); } function removeEntity(entity) { @@ -505,9 +496,17 @@ iD.Map = function() { return map; }; + map.selectEntity = function(entity) { + selection = entity.id; + d3.select('.inspector-wrap') + .style('display', 'block') + .datum(history.graph().fetch(entity.id)) + .call(inspector); + redraw(); + }; + map.background = background; map.projection = projection; - map.selectEntity = selectEntity; return d3.rebind(map, dispatch, 'on', 'move'); };