do not use event.target for determining clicked gutter region

breakpoints/numbers/foldwidgets
This commit is contained in:
nightwing 2012-07-06 13:15:09 +04:00
commit 78471317f6
4 changed files with 27 additions and 9 deletions

View file

@ -174,12 +174,32 @@ var Gutter = function(parentEl) {
dom.removeCssClass(this.element, "ace_folding-enabled");
this.$showFoldWidgets = show;
this.$padding = null;
};
this.getShowFoldWidgets = function() {
return this.$showFoldWidgets;
};
this.$computePadding = function() {
if (!this.element.firstChild)
return {left: 0, right: 0};
var style = dom.computedStyle(this.element.firstChild);
this.$padding = {}
this.$padding.left = parseInt(style.paddingLeft) + 1;
this.$padding.right = parseInt(style.paddingRight);
return this.$padding;
};
this.getRegion = function(point) {
var padding = this.$padding || this.$computePadding();
var rect = this.element.getBoundingClientRect();
if (point.x < padding.left + rect.left)
return "markers";
if (this.$showFoldWidgets && point.x > rect.right - padding.right)
return "foldWidgets";
};
}).call(Gutter.prototype);
exports.Gutter = Gutter;