Jump to content
Search Community

Problems transforming Shapes with Stroke

mattsonl test
Moderator Tag

Recommended Posts

Hi, I am having some problems transforming shapes w/ stroke using TransformManager for my application. Any help would be great!

 

I have an app where I am letting users drag shapes out onto the stage, and be able to manipulate their size, x, y, color, stroke, etc. The problem I am running in to is when TransformManager scales a shape graphic:

 

mySprite.graphics.lineStyle(1, 0x000000, 1);
mySprite.graphics.beginFill(0xCCCCCC, 1);
mySprite.graphics.drawRoundRect(0,0,50,50,0,0);
mySprite.graphics.endFill();
mySprite.graphics.moveTo(0,0);
mySprite.graphics.lineTo(0, 0);

When resizing the shape, not only does the shape transform size but the stroke also transforms size. It is obviously scaling the entire shape, which includes the stroke/border (lineStyle). I need to be able to scale the shape, but keep the stoke from scaling. I did find one solution...setting the lineStyle scaleMode to "none".

 

mySprite.graphics.lineStyle(1, 0x000000, 1, false, "none");

This works fine, but my app also allows the user to zoom up on the entire stage. I do this by changing the scaleX and scaleY of the parent container. When I zoom on the stage and the shape stoke has scaling set to "none", then my stoke does not scale. I DO NOT want the stoke to scale on resize using the TransformManger, but I DO want the stoke to scale when the user zooms the stage. I cannot for the life of me find a way to get around this without having to re-write a bunch of code. Please help!

Link to comment
Share on other sites

I'm not aware of a way to have the line behave two completely different ways like that other than redrawing it using the different lineStyle() each time you need to change the behavior, and of course you'd need to calculate the new thickness of the line when you draw it. Again, sorry I don't know of any magic solutions for ya. Wish I had better news.

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.
×
×
  • Create New...