Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
trishrempel

Selection incorrect on object with child positioned < 0,0

Recommended Posts

Hello,

 

In my implementation of TransformManager, the transform objects have children that can sometimes be positioned below 0,0. This causes the TransformManager selection anchor points to be positioned unexpectedly; one would expect that the selection anchor points would begin at the parent object's 0,0 point, but they actually begin at the child object's 0,0 point.

 

Here is some example code. In this example, the parent object is imageGroup1, and it contains an image that is larger than the parent object and positioned at -20,-20. It also contains a white box, to illustrate where the bounds of the parent object actually are. When you select the object, you would expect the selection handles to be around the white box, but they actually start at the child image.

 

<?xml version="1.0" encoding="utf-8"?>
		   xmlns:s="library://ns.adobe.com/flex/spark"
		   xmlns:mx="library://ns.adobe.com/flex/halo"
		   xmlns:transform="com.greensock.transform.*">













 

Do you have any suggestions?

 

Regards,

 

Trish Rempel

Link to comment
Share on other sites

That actually points to a bug in the Flex framework, not TransformManager. Allow me to explain...

 

Flex has this nasty habit of not reporting or handling sizes correctly. In your case, you've got a child with negative x/y values and the selection box should indeed include that child, so it's starting in the correct place. The problem is actually that the Flex group is reporting its width and height incorrectly, so instead of reporting 120x120 (which is the 100x100 original size plus the 20 in each direction that is caused by the fact that you're offsetting the x/y of one of its children), it just reports 100x100. So when TransformManager draws the selection box, it starts in the correct place but doesn't extend far enough over because of the Flex bug in reporting the width/height. See what I mean?

 

One solution would be to extend the Flex class and override the necessary methods so that it correctly reports the width/height. Another solution would be to structure your things differently so that you don't offset the child's child to negative values. Or you could alter TransformManager (as you PM'd me about) but that's the least attractive option in my view because that custom flavor of TransformManager wouldn't work correctly in some other situations plus you'd have to manually update its code each time I release an update to the main TransformManager class(es). I wish I had a super-simple fix for you off the top of my head, but the Flex framework is a nightmare in many respects and I've spent an insane number of hours trying to work around its bugs. I even spoke directly with Adobe and they acknowledged that it was their fault (the bugs) but they had not solid workarounds. Totally frustrating.

Link to comment
Share on other sites

Thanks for your quick response and also for the great tool. In my case, I might just need to modify the TransformManager in the project to suit the use cases I'm looking for; a diff merge tool should help me with the updates!

 

Cheers,

Trish Rempel

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×