KineticJS
KineticJS copied to clipboard
subsequent getAbsolutePosition function calls affects source values
Below is sample code with a group with an ellipse with an offset. In the end identical getAbsolutePosition() calls for x (or y) value give changing value 100,50,0,-50 etc. I don't think this should be the case?
var stage = new Kinetic.Stage({ container: 'canvasDiv', width: 500, height: 500, draggable: false });
var layer = new Kinetic.Layer(); stage.add(layer);
var rectGroup = new Kinetic.Group({
x: 100,
y: 100,
draggable: true
});
rect = new Kinetic.Ellipse({
x: 0,
y: 0,
width: 100,
height: 100,
fill: '#AEAEAE',
name: 'rect'
});
layer.add(rectGroup);
rectGroup.add(rect);
rect.setOffset(-100 / 2, -100 / 2);
layer.draw();
alert(rect.getAbsolutePosition().x);
alert(rect.getAbsolutePosition().x);
alert(rect.getAbsolutePosition().x);
alert(rect.getAbsolutePosition().x);
I'm unable to replicate this. I think there must be something else going on. can you create a jsfiddle demonstrating the problem?
scratch that, I am able to replicate the issue. It only occurs if you have an offset. I'll get this fixed up with v4.6.1. Thanks!