diff options
author | Ananya Sen | 2012-04-23 15:58:33 -0700 |
---|---|---|
committer | Ananya Sen | 2012-04-23 15:58:33 -0700 |
commit | 78b87d056fd2f43e9e8801c859274a1b00b35c33 (patch) | |
tree | 9ffbe8a88af62a0a1427cad6e22fb552fe0a7086 /js/controllers | |
parent | 46c3c16d0a7c737a2669b1684cdb1ede74a628c0 (diff) | |
download | ninja-78b87d056fd2f43e9e8801c859274a1b00b35c33.tar.gz |
IKNINJA-1529 : zooming to fix font overlap issue
Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
Diffstat (limited to 'js/controllers')
-rw-r--r-- | js/controllers/code-editor-controller.js | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/js/controllers/code-editor-controller.js b/js/controllers/code-editor-controller.js index 08320db7..683cbd94 100644 --- a/js/controllers/code-editor-controller.js +++ b/js/controllers/code-editor-controller.js | |||
@@ -45,24 +45,15 @@ var CodeEditorController = exports.CodeEditorController = Montage.create(Compone | |||
45 | set: function(value){this._editorTheme = value;} | 45 | set: function(value){this._editorTheme = value;} |
46 | }, | 46 | }, |
47 | 47 | ||
48 | originalEditorFont:{ | 48 | _zoomFactor:{ |
49 | value:"13"//px | ||
50 | }, | ||
51 | |||
52 | _editorFont:{ | ||
53 | value:null | 49 | value:null |
54 | }, | 50 | }, |
55 | 51 | ||
56 | editorFont:{ | 52 | zoomFactor:{ |
57 | get: function(){return this._editorFont;}, | 53 | get: function(){return this._zoomFactor;}, |
58 | set: function(value){//gets a zoom % | 54 | set: function(value){ |
59 | var codeLineElems = null, i=0; | 55 | this._zoomFactor = value; |
60 | this._editorFont = (value/100) * CodeEditorController.originalEditorFont; | 56 | this.application.ninja.documentController.activeDocument.container.style.zoom = ""+value+"%"; |
61 | //set the font size | ||
62 | codeLineElems = document.getElementsByClassName("CodeMirror-lines"); | ||
63 | for(i=0;i<codeLineElems.length;i++){ | ||
64 | codeLineElems[i].style.fontSize = ""+this._editorFont+"px"; | ||
65 | } | ||
66 | } | 57 | } |
67 | }, | 58 | }, |
68 | 59 | ||
@@ -224,14 +215,12 @@ var CodeEditorController = exports.CodeEditorController = Montage.create(Compone | |||
224 | 215 | ||
225 | applySettings:{ | 216 | applySettings:{ |
226 | value:function(){ | 217 | value:function(){ |
227 | var codeLineElem = null, i=0; | ||
228 | //set theme | 218 | //set theme |
229 | this.handleThemeSelection(); | 219 | this.handleThemeSelection(); |
230 | //check autocomplete support | 220 | //check autocomplete support |
231 | this.handleCodeCompletionSupport(this.application.ninja.documentController.activeDocument.editor.getOption("mode")); | 221 | this.handleCodeCompletionSupport(this.application.ninja.documentController.activeDocument.editor.getOption("mode")); |
232 | //set zoom | 222 | //set zoom |
233 | codeLineElem = this.application.ninja.documentController.activeDocument.container.getElementsByClassName("CodeMirror-lines")[0]; | 223 | this.application.ninja.documentController.activeDocument.container.style.zoom = ""+this.zoomFactor+"%"; |
234 | codeLineElem.style.fontSize = ""+this._editorFont+"px"; | ||
235 | } | 224 | } |
236 | } | 225 | } |
237 | }); \ No newline at end of file | 226 | }); \ No newline at end of file |