mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-24 09:04:02 +02:00
bba14c2cba
Design overhaul
38 lines
981 B
JavaScript
38 lines
981 B
JavaScript
iD.modes.AddPlace = function() {
|
|
var mode = {
|
|
id: 'add-place',
|
|
title: 'Place',
|
|
description: 'Restaurants, monuments, and postal boxes are points.'
|
|
};
|
|
|
|
mode.enter = function() {
|
|
var map = mode.map,
|
|
history = mode.history,
|
|
controller = mode.controller;
|
|
|
|
map.hint('Click on the map to add a place.');
|
|
|
|
map.surface.on('click.addplace', function() {
|
|
var node = iD.Node({loc: map.mouseCoordinates(), _poi: true});
|
|
|
|
history.perform(
|
|
iD.actions.AddNode(node),
|
|
'added a place');
|
|
|
|
controller.enter(iD.modes.Select(node));
|
|
});
|
|
|
|
map.keybinding().on('⎋.addplace', function() {
|
|
controller.exit();
|
|
});
|
|
};
|
|
|
|
mode.exit = function() {
|
|
mode.map.hint(false);
|
|
mode.map.surface.on('click.addplace', null);
|
|
mode.map.keybinding().on('⎋.addplace', null);
|
|
};
|
|
|
|
return mode;
|
|
};
|