Files
iD/js/id/modes/browse.js
2012-12-21 13:32:39 -08:00

42 lines
956 B
JavaScript

iD.modes.Browse = function() {
var mode = {
button: 'browse',
id: 'browse',
title: 'Browse',
description: 'Pan and zoom the map'
};
var behaviors;
mode.enter = function() {
var surface = mode.map.surface;
behaviors = [
iD.behavior.DragNode(mode),
iD.behavior.DragAccuracyHandle(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));
}
});
};
mode.exit = function() {
var surface = mode.map.surface;
behaviors.forEach(function(behavior) {
behavior.off(surface);
});
surface.on('click.browse', null);
};
return mode;
};