kingyiren / flex-object-handles

Automatically exported from code.google.com/p/flex-object-handles
0 stars 0 forks source link

Rotation doesn,t work smoothly if add x offset to shift the handle right. #44

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.I am using objecthandle library version 2 (oh2) evrything working fine.
2.Everything working (rotate,resize,move) fine if there is no offset.
3.Rotation does not work smoothly with offset thats my requirement.

What is the expected output? What do you see instead?
Rotaion doesn't work properly if I shift handles that is my requirement.

What version of the product are you using? On what operating system?
ObjectHandles-2.0,  

Please provide any additional information below.

I have changed the function in ObjectHandle.as as follow

protected function updateHandlePositions( model:Object ) : void
        {
            var h:Array = handles[model]
            var scroll:Point = getContainerScrollAmount();
            var offset:Number = 
Application.application.currentPage=='rightcan'?400:0;
            if( ! h ) { return; }
            for each ( var handle:IHandle in h )
            {                      
                if( model.hasOwnProperty("rotation") )
                {
                    var a:Number =  (model.width * 
handle.handleDescriptor.percentageOffset.x / 100) + 
handle.handleDescriptor.offset.x+ 
handle.handleDescriptor.borderthick.x+handle.handleDescriptor.shift.x + 
offset; 
                    var b:Number =  (model.height * 
handle.handleDescriptor.percentageOffset.y / 100)  + 
handle.handleDescriptor.offset.y+ 
handle.handleDescriptor.borderthick.y+handle.handleDescriptor.shift.y;  

                    tempMatrix.identity();
                    tempMatrix.translate(a,b); // The 
tX & ty
                    tempMatrix.rotate( toRadians( 
model.rotation ) );                 
                    tempMatrix.translate( model.x, 
model.y);

                    var p2:Point = 
tempMatrix.transformPoint( zero );                  

                    handle.rotation = model.rotation;
                    handle.x = p2.x  - scroll.x ;
                    handle.y = p2.y  - scroll.y ; 
                }
                else
                {
                    handle.x =  model.x  + (model.width * 
handle.handleDescriptor.percentageOffset.x / 100)  + 
handle.handleDescriptor.offset.x - scroll.x + 
handle.handleDescriptor.borderthick.x+handle.handleDescriptor.shift.x;  
                    handle.y =  model.y  + (model.height * 
handle.handleDescriptor.percentageOffset.y / 100)  + 
handle.handleDescriptor.offset.y - scroll.y+ 
handle.handleDescriptor.borderthick.y+handle.handleDescriptor.shift.y;  

                }
            }   
        }

Original issue reported on code.google.com by premkan...@gmail.com on 7 Jun 2010 at 6:44

Attachments: