microsoft / XamlBehaviors

This is the official home for UWP XAML Behaviors on GitHub.
MIT License
702 stars 112 forks source link

Changing instanse of RenderTransform #46

Open shersh opened 8 years ago

shersh commented 8 years ago

In DragPositionBehavior.cs after pointer is pressed RenderTransform will be replaced by TranslateTransform. That is bad. Because if we have already changed it for example to ScaleTransform or CompositeTransform it will be replaced and we can't using old version.

davidezordan commented 8 years ago

I agree with you, Roman, we should reuse the current instance of the Transform. I've just submitted a PR with a potential fix.

skendrot commented 8 years ago

If the Transform was been made a ScaleTransform than why would you want to use the DragPositionBehavior?

davidezordan commented 8 years ago

Hi Shawn: for the specific case of the DragPosition Behavior the transform must be a TranslateTransform for obvious reasons. However in the future we could take the DragPositionBehavior as a starting point for other Behaviors like Zoom / Rotate, and in that case the tranform will have to change.

skendrot commented 8 years ago

I think I misunderstood the original statement. You want to do scaling and moving of an object? If that is the case then the behavior should set the transform to a CompositeTransform IFF the transform is null, it should not reset it

davidezordan commented 8 years ago

The proposed fix is initializing the RenderTransform with a new CompositeTransform when the DragPositionBehavior is attached:

Is this solution solving the issue Roman?