I have an image (the blue box) and ad red rectangle. The image's offset is set to the center of the image to make rotation around the center of the image. The code is similar to the following:
var image = new Kinetic.Image({
x: 200,
y: 100
});
image.offsetX(100);
image.offsetY(50);
var rect = new Kinetic.Rect();
var group = new Kinetic.Group();
group.add(image);
group.add(rect);
layer.add(group);
stage.add(layer);
The stage than looks something like this:
After I rescale the image with
image.scaleX(0.5);
image.scaleY(0.5);
I get the following:
The red rectangle is not attached to the image anymore.
I could do
rect.scaleX(0.5);
rect.scaleY(0.5);
but this would change the size of the rect.
How do I rescale the image and keep the rectangle attached to the same position as before?
Edit:
The following image shows what it should look like after the image scaling. Event after the scaling the red rectangle should be attached to the image.