Fix _getContentPosition, the position was miscalculated if a positioned container had a border.

This commit is contained in:
Yannick Croissant 2012-07-17 13:14:49 +03:00
parent 20adf7e036
commit e46dfdb565

View File

@ -781,17 +781,13 @@ Kinetic.Stage = Kinetic.Container.extend({
* get container position
*/
_getContentPosition: function() {
var obj = this.content;
var top = 0;
var left = 0;
while(obj && obj.tagName !== 'BODY') {
top += obj.offsetTop - obj.scrollTop;
left += obj.offsetLeft - obj.scrollLeft;
obj = obj.offsetParent;
}
var
rect = this.content.getBoundingClientRect(),
root = document.documentElement
;
return {
top: top,
left: left
top: rect.top + root.scrollTop,
left: rect.left + root.scrollLeft
};
},
/**