Move controller to own file

This commit is contained in:
John Firebaugh
2012-11-08 15:45:39 -08:00
parent a7e8466328
commit 68ee31ea29
3 changed files with 21 additions and 21 deletions

View File

@@ -47,6 +47,8 @@
<script type='text/javascript' src='js/iD/actions/actions.js'></script>
<script type='text/javascript' src='js/iD/actions/operations.js'></script>
<script type='text/javascript' src='js/iD/controller/controller.js'></script>
<script type='text/javascript' src='js/iD/format/format.js'></script>
<script type='text/javascript' src='js/iD/format/GeoJSON.js'></script>
<script type='text/javascript' src='js/iD/format/XML.js'></script>

View File

@@ -177,23 +177,3 @@ iD.actions.Move = {
},
exit: function() { }
};
// 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;
};

View File

@@ -1 +1,19 @@
iD.controller = {};
// 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;
};