Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Bharat Patel

Crop operation

Recommended Posts

Hello,

 

I am using crop feature, but facing one problem when user move the crop control, the control 's line and mask are not in sync (Refer attached image). 

 

So is there any property or settings that need to apply on control. Refer the below code. 

 

var manager:TransformManager = new TransformManager();
manager.lockPosition = false;
manager.lockRotation = false;
manager.lockScale = false;


var cropControl:FlexCrop = new FlexCrop( imageObj, manager, true);
cropControl.configureCropMode(false, 0.5, 0xFFCC12, true);

post-13261-0-73516200-1390555420_thumb.jpg

Link to post
Share on other sites

Hi Jack,

 

Don't spend time for above issue, now its working fine with following change: 

 

var cropControl:FlexCrop = new FlexCrop(cropImageObj, flxTransformManagerObj.manager, true);

 

Thanks

Bharat

  • Like 2
Link to post
Share on other sites

hello,

 

I'm trying to bound crop with image component but when i rotate image then perform crop image is shrinking and out of Transform Manager...

 

if u have any suggestion for this then plz let me know.,..

 

Thank u

 

http://i.picresize.com/kPR

Link to post
Share on other sites

KnightRider, it's very difficult to know what's happening without seeing a reduced test case that clearly demonstrates the issue (without extra code). If you still need help, please upload an FLA that we can publish (you can click the "More Reply Options" button below to attach a file). 

Link to post
Share on other sites

private function init():void
{
    //rect for bounding image within canvas
    _rect=new Rectangle(0,0,canvas.width,canvas.height);
    _manager.bounds=_rect;
    _fCrop = new FlexCrop(_imgC,_manager);
    _fCrop.configureCropMode(false,.5,0xAACCBB,true);
    _fCrop.addEventListener("enterCropMode",sCrop);
}

private function sCrop(e:Event):void
{
    //_rect=_manager.getSelectionBounds();
    //_rect for bounding crop within image component
    _rect=new Rectangle(_imgC.x,_imgC.y,_imgC.width*_imgC.scaleY,_imgC.height*_imgC.scaleY);
    _manager.lockRotation=true;//lock rotation of crop
    _manager.bounds=_rect;
}
           
 

 

before rotation its working well crop is bounded with in image

post-18453-0-61708800-1392802147_thumb.png

 

After rotation img1

post-18453-0-74495200-1392802155_thumb.png

 

After rotation img2

post-18453-0-23913700-1392802161_thumb.png

Link to post
Share on other sites

It's tough to say without a reduced case FLA, but width and height are supposed to include any scaling (at least that's what Adobe's docs say and it is how things work in Flash normally), but I know there are some Flex components that behave differently and report width/height without including scaling. When you rotate, that probably further complicates things, as you'd need to do the math to figure out sin/cos, and apply them accordingly. It looks like this isn't really a TransformManager issue at all, but rather something with your particular function and possibly a Flex quirk which we can't do much about unfortunately. I wish I had an easy answer for you. 

  • Like 1
Link to post
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.

×