Add new mehtods to (de)activate keyboard, setZoom

This commit is contained in:
Tarjei Huse 2012-03-19 11:44:59 +01:00
parent 6408fc4b82
commit 01db50c1bd

View File

@ -64,6 +64,18 @@ mindplot.Designer = new Class({
mindplot.TopicEditor.configure(this.isReadOnly()); mindplot.TopicEditor.configure(this.isReadOnly());
}, },
/**
* Deactivates the keyboard events so you can enter text into forms
*/
deactivateKeyboard: function() {
mindplot.DesignerKeyboard.getInstance().deactivate();
this.deselectAll();
},
activateKeyboard: function() {
mindplot.DesignerKeyboard.getInstance().activate();
},
_registerEvents : function() { _registerEvents : function() {
// Register mouse events ... // Register mouse events ...
this._registerMouseEvents(); this._registerMouseEvents();
@ -283,6 +295,23 @@ mindplot.Designer = new Class({
}); });
}, },
/**
* Set the zoom of the map.
* @param: zoom: number between 0.3 and 1.9
*/
setZoom: function(zoom) {
if (zoom > 1.9 || zoom < 0.3) {
$notify("Zoom too high. Cannot apply zoom above 1.9 or below 0.3");
console.log("Tried to set zoom to " + zoom + " which is utside allowed range.");
return;
}
this.getModel().setZoom(zoom);
this._workspace.setZoom(zoom);
},
zoomOut : function(factor) { zoomOut : function(factor) {
if (!factor) if (!factor)
factor = 1.2; factor = 1.2;