mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-23 14:14:11 +00:00
42 lines
956 B
JavaScript
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;
|
|
};
|