[Solved] Cloning windows sets rotation
Posted: Wed Nov 26, 2014 09:27
When you clone a window, all of the properties from the source window are cloned to the new window.
This includes intrinsic properties as defined in Element::addElementProperties().
Amongst these is "Rotation".
However, when the rotation is set this results in Window::onRotated being called, and this in turn turns on autorender surface support, even though the rotation is identity rotation.
The end result of this is that all cloned elements (and their children if you want a deep clone) gets autorender surface support. Which you don't want.
So, there are a couple of different solutions to this:
* alter Window::onRotated to only turn on autorender surface support if rotation is other than identity
* alter Element::setRotation to only call into onRotated if the new rotation differs from the existing rotation
* alter Window::clonePropertiesTo to only call target.setProperty if the property is different
The first two are easiest, but I'm thinking that this might affect other intrinsic properties than Render, which makes the last approach perhaps the most solid.
Thoughts?
This includes intrinsic properties as defined in Element::addElementProperties().
Amongst these is "Rotation".
However, when the rotation is set this results in Window::onRotated being called, and this in turn turns on autorender surface support, even though the rotation is identity rotation.
The end result of this is that all cloned elements (and their children if you want a deep clone) gets autorender surface support. Which you don't want.
So, there are a couple of different solutions to this:
* alter Window::onRotated to only turn on autorender surface support if rotation is other than identity
* alter Element::setRotation to only call into onRotated if the new rotation differs from the existing rotation
* alter Window::clonePropertiesTo to only call target.setProperty if the property is different
The first two are easiest, but I'm thinking that this might affect other intrinsic properties than Render, which makes the last approach perhaps the most solid.
Thoughts?