Eliminate Map#{perform,undo,redo}

Map binds to history changes instead.
This commit is contained in:
John Firebaugh
2012-12-03 18:36:16 -05:00
parent 0a1e0bdfe4
commit da5239b98d
4 changed files with 42 additions and 58 deletions
+4 -1
View File
@@ -1,16 +1,19 @@
// A controller holds a single action at a time and calls `.enter` and `.exit`
// to bind and unbind actions.
iD.Controller = function(map) {
iD.Controller = function(map, history) {
var event = d3.dispatch('enter', 'exit');
var controller = { mode: null };
controller.enter = function(mode) {
mode.controller = controller;
mode.history = history;
mode.map = map;
if (controller.mode) {
controller.mode.exit();
event.exit(controller.mode);
}
mode.enter();
controller.mode = mode;
event.enter(mode);