Merge pull request #814 from ajaxorg/ui/optimize-experimental
Ui/optimize experimental
This commit is contained in:
commit
c634e9c17b
3 changed files with 32 additions and 11 deletions
|
|
@ -92,7 +92,7 @@ exports.multiSelectCommands = [{
|
|||
bindKey: "esc",
|
||||
exec: function(editor) { editor.exitMultiSelectMode(); },
|
||||
readonly: true,
|
||||
isAvailable: function(editor) {return editor.inMultiSelectMode}
|
||||
isAvailable: function(editor) {return editor && editor.inMultiSelectMode}
|
||||
}];
|
||||
|
||||
var HashHandler = require("../keyboard/hash_handler").HashHandler;
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
.ace_scroller {
|
||||
position: absolute;
|
||||
overflow: hidden;
|
||||
width : 100%;
|
||||
}
|
||||
|
||||
.ace_content {
|
||||
|
|
|
|||
|
|
@ -263,8 +263,13 @@ var VirtualRenderer = function(container, theme) {
|
|||
*
|
||||
* Triggers a full update of all the layers, for all the rows.
|
||||
**/
|
||||
this.updateFull = function() {
|
||||
this.$loop.schedule(this.CHANGE_FULL);
|
||||
this.updateFull = function(force) {
|
||||
if (force){
|
||||
this.$renderChanges(this.CHANGE_FULL, true);
|
||||
}
|
||||
else {
|
||||
this.$loop.schedule(this.CHANGE_FULL);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -282,11 +287,19 @@ var VirtualRenderer = function(container, theme) {
|
|||
*
|
||||
* [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 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) {
|
||||
size.height = height;
|
||||
|
||||
|
|
@ -300,20 +313,27 @@ var VirtualRenderer = function(container, theme) {
|
|||
}
|
||||
}
|
||||
|
||||
var width = dom.getInnerWidth(this.container);
|
||||
if (force || size.width != width) {
|
||||
if (!width)
|
||||
width = dom.getInnerWidth(this.container);
|
||||
if (force || this.resizing > 1 || size.width != width) {
|
||||
size.width = width;
|
||||
|
||||
var gutterWidth = this.showGutter ? this.$gutter.offsetWidth : 0;
|
||||
this.scroller.style.left = gutterWidth + "px";
|
||||
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)
|
||||
changes = changes | this.CHANGE_FULL;
|
||||
}
|
||||
|
||||
this.$loop.schedule(changes);
|
||||
if (force)
|
||||
this.$renderChanges(changes, true);
|
||||
else
|
||||
this.$loop.schedule(changes);
|
||||
|
||||
if (force)
|
||||
delete this.resizing;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -642,8 +662,8 @@ var VirtualRenderer = function(container, theme) {
|
|||
this.scrollBar.setScrollTop(this.scrollTop);
|
||||
};
|
||||
|
||||
this.$renderChanges = function(changes) {
|
||||
if (!changes || !this.session || !this.container.offsetWidth)
|
||||
this.$renderChanges = function(changes, force) {
|
||||
if (!force && (!changes || !this.session || !this.container.offsetWidth))
|
||||
return;
|
||||
|
||||
// text, scrolling and resize changes can cause the view port size to change
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue