add a wrapper around all layers to fix mouse selection in IE
This commit is contained in:
parent
d83854e5bc
commit
1ed310d5d2
1 changed files with 11 additions and 7 deletions
|
|
@ -12,16 +12,19 @@ ace.VirtualRenderer = function(container) {
|
||||||
this.gutter.className = "gutter";
|
this.gutter.className = "gutter";
|
||||||
this.container.appendChild(this.gutter);
|
this.container.appendChild(this.gutter);
|
||||||
|
|
||||||
this.gutterLayer = new ace.layer.Gutter(this.gutter);
|
this.content = document.createElement("div");
|
||||||
this.markerLayer = new ace.layer.Marker(this.scroller);
|
this.scroller.appendChild(this.content)
|
||||||
|
|
||||||
var textLayer = this.textLayer = new ace.layer.Text(this.scroller);
|
this.gutterLayer = new ace.layer.Gutter(this.gutter);
|
||||||
|
this.markerLayer = new ace.layer.Marker(this.content);
|
||||||
|
|
||||||
|
var textLayer = this.textLayer = new ace.layer.Text(this.content);
|
||||||
this.canvas = textLayer.element;
|
this.canvas = textLayer.element;
|
||||||
|
|
||||||
this.characterWidth = textLayer.getCharacterWidth();
|
this.characterWidth = textLayer.getCharacterWidth();
|
||||||
this.lineHeight = textLayer.getLineHeight();
|
this.lineHeight = textLayer.getLineHeight();
|
||||||
|
|
||||||
this.cursorLayer = new ace.layer.Cursor(this.scroller);
|
this.cursorLayer = new ace.layer.Cursor(this.content);
|
||||||
|
|
||||||
this.layers = [ this.markerLayer, textLayer, this.cursorLayer ];
|
this.layers = [ this.markerLayer, textLayer, this.cursorLayer ];
|
||||||
|
|
||||||
|
|
@ -62,8 +65,7 @@ ace.VirtualRenderer = function(container) {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.getMouseEventTarget = function() {
|
this.getMouseEventTarget = function() {
|
||||||
// return top most layer
|
return this.content;
|
||||||
return this.cursorLayer.element;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.getFirstVisibleRow = function() {
|
this.getFirstVisibleRow = function() {
|
||||||
|
|
@ -127,6 +129,7 @@ ace.VirtualRenderer = function(container) {
|
||||||
var charCount = this.doc.getWidth();
|
var charCount = this.doc.getWidth();
|
||||||
if (this.$showInvisibles)
|
if (this.$showInvisibles)
|
||||||
charCount += 1;
|
charCount += 1;
|
||||||
|
|
||||||
var longestLine = Math.max(this.scroller.clientWidth, Math.round(charCount * this.characterWidth));
|
var longestLine = Math.max(this.scroller.clientWidth, Math.round(charCount * this.characterWidth));
|
||||||
|
|
||||||
var lineCount = Math.ceil(minHeight / this.lineHeight);
|
var lineCount = Math.ceil(minHeight / this.lineHeight);
|
||||||
|
|
@ -141,11 +144,12 @@ ace.VirtualRenderer = function(container) {
|
||||||
characterWidth : this.characterWidth
|
characterWidth : this.characterWidth
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.content.style.marginTop = (-offset) + "px";
|
||||||
|
|
||||||
for ( var i = 0; i < this.layers.length; i++) {
|
for ( var i = 0; i < this.layers.length; i++) {
|
||||||
var layer = this.layers[i];
|
var layer = this.layers[i];
|
||||||
|
|
||||||
var style = layer.element.style;
|
var style = layer.element.style;
|
||||||
style.marginTop = (-offset) + "px";
|
|
||||||
style.height = minHeight + "px";
|
style.height = minHeight + "px";
|
||||||
style.width = longestLine + "px";
|
style.width = longestLine + "px";
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue