mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-24 17:14:04 +02:00
Rename and update
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
// A controller holds a single action at a time and calls `.enter` and `.exit`
|
||||
// to bind and unbind actions.
|
||||
iD.Controller = function(map) {
|
||||
var event = d3.dispatch('enter', 'exit');
|
||||
var controller = { mode: null };
|
||||
|
||||
controller.enter = function(mode) {
|
||||
mode.controller = controller;
|
||||
mode.map = map;
|
||||
if (controller.mode) {
|
||||
controller.mode.exit();
|
||||
event.exit(controller.mode);
|
||||
}
|
||||
mode.enter();
|
||||
controller.mode = mode;
|
||||
event.enter(mode);
|
||||
};
|
||||
|
||||
controller.enter(iD.modes.Move);
|
||||
|
||||
return d3.rebind(controller, event, 'on');
|
||||
};
|
||||
Reference in New Issue
Block a user