Merge pull request #814 from ajaxorg/ui/optimize-experimental

Ui/optimize experimental
This commit is contained in:
Garen Torikian 2012-06-19 01:38:17 -07:00
commit c634e9c17b
3 changed files with 32 additions and 11 deletions

View file

@ -92,7 +92,7 @@ exports.multiSelectCommands = [{
bindKey: "esc", bindKey: "esc",
exec: function(editor) { editor.exitMultiSelectMode(); }, exec: function(editor) { editor.exitMultiSelectMode(); },
readonly: true, readonly: true,
isAvailable: function(editor) {return editor.inMultiSelectMode} isAvailable: function(editor) {return editor && editor.inMultiSelectMode}
}]; }];
var HashHandler = require("../keyboard/hash_handler").HashHandler; var HashHandler = require("../keyboard/hash_handler").HashHandler;

View file

@ -8,6 +8,7 @@
.ace_scroller { .ace_scroller {
position: absolute; position: absolute;
overflow: hidden; overflow: hidden;
width : 100%;
} }
.ace_content { .ace_content {

View file

@ -263,8 +263,13 @@ var VirtualRenderer = function(container, theme) {
* *
* Triggers a full update of all the layers, for all the rows. * Triggers a full update of all the layers, for all the rows.
**/ **/
this.updateFull = function() { this.updateFull = function(force) {
if (force){
this.$renderChanges(this.CHANGE_FULL, true);
}
else {
this.$loop.schedule(this.CHANGE_FULL); this.$loop.schedule(this.CHANGE_FULL);
}
}; };
/** /**
@ -282,11 +287,19 @@ var VirtualRenderer = function(container, theme) {
* *
* [Triggers a resize of the editor.]{: #VirtualRenderer.onResize} * [Triggers a resize of the editor.]{: #VirtualRenderer.onResize}
**/ **/
this.onResize = function(force) { this.onResize = function(force, gutterWidth, width, height) {
var changes = this.CHANGE_SIZE; var changes = this.CHANGE_SIZE;
var size = this.$size; var size = this.$size;
var height = dom.getInnerHeight(this.container); if (this.resizing > 2)
return;
else if (this.resizing > 1)
this.resizing++;
else
this.resizing = force ? 1 : 0;
if (!height)
height = dom.getInnerHeight(this.container);
if (force || size.height != height) { if (force || size.height != height) {
size.height = height; size.height = height;
@ -300,20 +313,27 @@ var VirtualRenderer = function(container, theme) {
} }
} }
var width = dom.getInnerWidth(this.container); if (!width)
if (force || size.width != width) { width = dom.getInnerWidth(this.container);
if (force || this.resizing > 1 || size.width != width) {
size.width = width; size.width = width;
var gutterWidth = this.showGutter ? this.$gutter.offsetWidth : 0; var gutterWidth = this.showGutter ? this.$gutter.offsetWidth : 0;
this.scroller.style.left = gutterWidth + "px"; this.scroller.style.left = gutterWidth + "px";
size.scrollerWidth = Math.max(0, width - gutterWidth - this.scrollBar.getWidth()); size.scrollerWidth = Math.max(0, width - gutterWidth - this.scrollBar.getWidth());
this.scroller.style.width = size.scrollerWidth + "px"; //this.scroller.style.width = size.scrollerWidth + "px";
if (this.session.getUseWrapMode() && this.adjustWrapLimit() || force) if (this.session.getUseWrapMode() && this.adjustWrapLimit() || force)
changes = changes | this.CHANGE_FULL; changes = changes | this.CHANGE_FULL;
} }
if (force)
this.$renderChanges(changes, true);
else
this.$loop.schedule(changes); this.$loop.schedule(changes);
if (force)
delete this.resizing;
}; };
/** /**
@ -642,8 +662,8 @@ var VirtualRenderer = function(container, theme) {
this.scrollBar.setScrollTop(this.scrollTop); this.scrollBar.setScrollTop(this.scrollTop);
}; };
this.$renderChanges = function(changes) { this.$renderChanges = function(changes, force) {
if (!changes || !this.session || !this.container.offsetWidth) if (!force && (!changes || !this.session || !this.container.offsetWidth))
return; return;
// text, scrolling and resize changes can cause the view port size to change // text, scrolling and resize changes can cause the view port size to change