#237 Add optional useOffset parameter to getCellFromPixel.

This commit is contained in:
d 2016-02-22 10:56:49 -05:00
commit 78803147c6
6 changed files with 13 additions and 9 deletions

View file

@ -1300,8 +1300,9 @@
return Math.ceil(o.outerWidth() / o.attr('data-gs-width'));
};
GridStack.prototype.getCellFromPixel = function(position) {
var containerPos = this.container.position();
GridStack.prototype.getCellFromPixel = function(position, useOffset) {
var containerPos = (typeof useOffset != 'undefined' && useOffset) ?
this.container.offset() : this.container.position();
var relativeLeft = position.left - containerPos.left;
var relativeTop = position.top - containerPos.top;