Files
iD/js/iD/controller/Controller.js
2012-11-17 15:27:10 +01:00

20 lines
474 B
JavaScript

// A controller holds a single action at a time and calls `.enter` and `.exit`
// to bind and unbind actions.
iD.Controller = function(map) {
var controller = { action: null };
controller.go = function(x) {
x.controller = controller;
x.map = map;
if (controller.action) {
controller.action.exit();
}
x.enter();
controller.action = x;
};
controller.go(iD.actions.Move);
return controller;
};