On font size change, call onResize on the renderer to force update of scrollbars/wrap data

This commit is contained in:
Julian Viereck 2011-02-15 18:43:42 +08:00 • committed by Fabian Jakobs
commit b4d107284d

View file

@ -103,6 +103,7 @@ var VirtualRenderer = function(container, theme) {
_self.characterWidth = textLayer.getCharacterWidth(); _self.characterWidth = textLayer.getCharacterWidth();
_self.lineHeight = textLayer.getLineHeight(); _self.lineHeight = textLayer.getLineHeight();
_self.$updatePrintMargin(); _self.$updatePrintMargin();
_self.onResize(true);
_self.$loop.schedule(_self.CHANGE_FULL); _self.$loop.schedule(_self.CHANGE_FULL);
}); });
@ -286,7 +287,7 @@ var VirtualRenderer = function(container, theme) {
if (!this.$showPrintMargin && !this.$printMarginEl) if (!this.$showPrintMargin && !this.$printMarginEl)
return; return;
if (!this.$printMarginEl) { if (!this.$printMarginEl) {
containerEl = document.createElement("div"); containerEl = document.createElement("div");
containerEl.className = "ace_print_margin_layer"; containerEl.className = "ace_print_margin_layer";
@ -313,18 +314,18 @@ var VirtualRenderer = function(container, theme) {
return this.container; return this.container;
}; };
this.moveTextAreaToCursor = function(textarea) { this.moveTextAreaToCursor = function(textarea) {
// in IE the native cursor always shines through // in IE the native cursor always shines through
if (useragent.isIE) if (useragent.isIE)
return; return;
var pos = this.$cursorLayer.getPixelPosition(); var pos = this.$cursorLayer.getPixelPosition();
if (!pos) if (!pos)
return; return;
var bounds = this.content.getBoundingClientRect(); var bounds = this.content.getBoundingClientRect();
var offset = (this.layerConfig && this.layerConfig.offset) || 0; var offset = (this.layerConfig && this.layerConfig.offset) || 0;
textarea.style.left = (bounds.left + pos.left + this.$padding) + "px"; textarea.style.left = (bounds.left + pos.left + this.$padding) + "px";
textarea.style.top = (bounds.top + pos.top - this.scrollTop + offset) + "px"; textarea.style.top = (bounds.top + pos.top - this.scrollTop + offset) + "px";
}; };
@ -427,7 +428,7 @@ var VirtualRenderer = function(container, theme) {
if (changes & (this.CHANGE_MARKER | this.CHANGE_MARKER_FRONT)) { if (changes & (this.CHANGE_MARKER | this.CHANGE_MARKER_FRONT)) {
this.$markerFront.update(this.layerConfig); this.$markerFront.update(this.layerConfig);
} }
if (changes & (this.CHANGE_MARKER | this.CHANGE_MARKER_BACK)) { if (changes & (this.CHANGE_MARKER | this.CHANGE_MARKER_BACK)) {
this.$markerBack.update(this.layerConfig); this.$markerBack.update(this.layerConfig);
} }
@ -678,15 +679,15 @@ var VirtualRenderer = function(container, theme) {
this.$composition.className = "ace_composition"; this.$composition.className = "ace_composition";
this.content.appendChild(this.$composition); this.content.appendChild(this.$composition);
} }
this.$composition.innerHTML = " "; this.$composition.innerHTML = " ";
var pos = this.$cursorLayer.getPixelPosition(); var pos = this.$cursorLayer.getPixelPosition();
var style = this.$composition.style; var style = this.$composition.style;
style.top = pos.top + "px"; style.top = pos.top + "px";
style.left = (pos.left + this.$padding) + "px"; style.left = (pos.left + this.$padding) + "px";
style.height = this.lineHeight + "px"; style.height = this.lineHeight + "px";
this.hideCursor(); this.hideCursor();
}; };