From 01db50c1bd8745b891a1d449e7864afdeb23acc3 Mon Sep 17 00:00:00 2001 From: Tarjei Huse Date: Mon, 19 Mar 2012 11:44:59 +0100 Subject: [PATCH] Add new mehtods to (de)activate keyboard, setZoom --- mindplot/src/main/javascript/Designer.js | 29 ++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/mindplot/src/main/javascript/Designer.js b/mindplot/src/main/javascript/Designer.js index c1987d81..656bd697 100644 --- a/mindplot/src/main/javascript/Designer.js +++ b/mindplot/src/main/javascript/Designer.js @@ -64,6 +64,18 @@ mindplot.Designer = new Class({ 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() { // Register mouse events ... this._registerMouseEvents(); @@ -282,6 +294,23 @@ mindplot.Designer = new Class({ object.setOnFocus(false); }); }, + + /** + * 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) { if (!factor)