Jump to content
GreenSock

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

Only show handles on some MCs? and other handle questions

Recommended Posts

Is it possible to only show handles on some movie clips?

 

For example, I have text and images...

 

I want to be able to use the handles on the images, but NOT on the text. However, I do want to use TransformManager on the text movieclip containers since I want the features it offers to drag multile selections as a group with boundary detection. So, if they select only text, I want no resize handles, or if they select text+images I want no handles, but if they have only images, I want the handles showing. Is this possible?

 

For the text I'd also like to be able to rotate, but not resize... is that possible? The reason for this is that I already have code and UI controls to resize the text and it's container, and it's TLF text and it's a big hassle to mess with that.

 

Also, I don't see a default way to hide the left/right top/bottom resize buttons, but I don't want these showing. If I'm going to attempt to remove them where do I start looking to disable those?

Link to comment
Share on other sites

You can certainly prevent scaling by setting the lockScale property to true. That would allow rotation and x/y movement but prevent scaling. I'm a little confused, though, by the fact that you want to hide the handles and yet you want the user to be able to rotate things - how would they do that without handles?

 

To get rid of the handles, you can simply set the "handleSize" property to 0.

 

Does that get you what you're looking for?

Link to comment
Share on other sites

Thanks for the response.

 

To elaborate a bit more, the reason I wanted the users to be able to rotate but not scale is for the TLF text fields I'm using. I recently convinced my company to purchase TransformManager for my project and the end result is for print. I have a separate UI tool that is used to adjust the font size (which in turn resizes the container's width/height to match the font). I'm unsure if it's possible to print inbetween font point sizes, like we go 8, 9, 10, 11, 12, 14, 16.... but if I let them size the text with this tool, it would in theory allow font point sizes any number in between that such as 13.1245 or something and I'm not sure that the TLF or the printing process supports that. I'm also not sure if it's possible for Transform Manager to tell me what font size of the TLF text field inside the container would be after adjusting the scale? I kind of assumed it wouldn't be able to tell me that, but if it can somehow, I'll try to play around with it.

 

I'll check out the lockScale value to see how it works. That will probably help me some, but you haven't mentioned where I might look to hide the middle resize buttons, could you point me to where I might start to look to turn those off? I know it's not just a value, it's something I will have to manually comment out or otherwise modify. On multi-line text fields or images they're nice but on small single line text fields it just looks like too many buttons on the container, so I'm trying to hide them.

Link to comment
Share on other sites

You're correct about TransformManager not being built to report info like font sizes.

 

As for removing the center handles along the edges, look at the initSelection() private method. Those are named "t", "r", "b", "l" (for top, right, bottom, left).

 

I hope that helps.

Link to comment
Share on other sites

As for removing the center handles along the edges, look at the initSelection() private method. Those are named "t", "r", "b", "l" (for top, right, bottom, left).

 

Yes, that did help. I was able to accomplish what I wanted to do in the following manner:

 

in private function redrawHandles() in the TransformManager class, I added this to the end,

(green text is pre-existing code)

} else if (_handles.type == "center") {

s.visible = !_hideCenterHandle;

} else if (_handles.type == "stretchH" || _handles.type == "stretchV") {

s.visible = !_hideCenterHandle;

}

 

That basically hides the middle resize handles if the center resize handle is hidden, and it seems to work pretty well. I could make a new attribute to only hide the middle handles based off how the _hideCenterHandle works, but for my purposes if I'm hiding that then I wanted those hidden as well. Thanks again for the help here, this is a cool code base to work with!

Link to comment
Share on other sites

Excellent, glad you figured it out and are enjoying the code base. Have fun.

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.
×