mirror of
https://github.com/konvajs/konva.git
synced 2025-05-16 21:49:34 +08:00
Merge pull request #52 from Country/master
Miscalculation of container position
This commit is contained in:
commit
148cde228a
16
src/Stage.js
16
src/Stage.js
@ -765,17 +765,13 @@ Kinetic.Stage = Kinetic.Container.extend({
|
|||||||
* get container position
|
* get container position
|
||||||
*/
|
*/
|
||||||
_getContentPosition: function() {
|
_getContentPosition: function() {
|
||||||
var obj = this.content;
|
var
|
||||||
var top = 0;
|
rect = this.content.getBoundingClientRect(),
|
||||||
var left = 0;
|
root = document.documentElement
|
||||||
while(obj && obj.tagName !== 'BODY') {
|
;
|
||||||
top += obj.offsetTop - obj.scrollTop;
|
|
||||||
left += obj.offsetLeft - obj.scrollLeft;
|
|
||||||
obj = obj.offsetParent;
|
|
||||||
}
|
|
||||||
return {
|
return {
|
||||||
top: top,
|
top: rect.top + root.scrollTop,
|
||||||
left: left
|
left: rect.left + root.scrollLeft
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user