aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorAnanya Sen2012-04-23 15:58:33 -0700
committerAnanya Sen2012-04-23 15:58:33 -0700
commit78b87d056fd2f43e9e8801c859274a1b00b35c33 (patch)
tree9ffbe8a88af62a0a1427cad6e22fb552fe0a7086 /js
parent46c3c16d0a7c737a2669b1684cdb1ede74a628c0 (diff)
downloadninja-78b87d056fd2f43e9e8801c859274a1b00b35c33.tar.gz
IKNINJA-1529 : zooming to fix font overlap issue
Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
Diffstat (limited to 'js')
-rw-r--r--js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.js2
-rw-r--r--js/controllers/code-editor-controller.js25
2 files changed, 8 insertions, 19 deletions
diff --git a/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.js b/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.js
index 237be46c..41fd991e 100644
--- a/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.js
+++ b/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.js
@@ -24,7 +24,7 @@ var CodeEditorViewOptions = exports.CodeEditorViewOptions = Montage.create(Compo
24 24
25 Object.defineBinding(this.zoomHottext , "value", { 25 Object.defineBinding(this.zoomHottext , "value", {
26 boundObject: this.application.ninja.codeEditorController, 26 boundObject: this.application.ninja.codeEditorController,
27 boundObjectPropertyPath: "editorFont", 27 boundObjectPropertyPath: "zoomFactor",
28 oneway : false 28 oneway : false
29 }); 29 });
30 30
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