[OpenLayers-Dev] Re size & Rotate Feature

Arnd Wippermann arnd.wippermann at web.de
Tue Jul 22 17:56:05 EDT 2008


Hi,

to rotate a feature I take the center of the bounds of the feature:

function RotateFeature(feature, angle)
{
    var objBounds = feature.geometry.getBounds();

    var x = (objBounds.left+objBounds.right )/2;
    var y = (objBounds.top +objBounds.bottom)/2;

    var origin = {};

    origin.x = x;
    origin.y = y;

    feature.geometry.rotate(angle, origin);
    feature.layer.drawFeature(feature);
}

Arnd Wippermann


Brian Levy-2 wrote:
> 
> When resizing and rotating a feature, would it be possible to anchor from
> the center of the polygon?  Currently the anchor point is on the first
> vertex.  Any thoughts on this would be greatly appreciated!  
> 
>  
> 
> Thanks!
> 
>  
> 
> Brian
> 
>  
> 
> 
> _______________________________________________
> Dev mailing list
> Dev at openlayers.org
> http://openlayers.org/mailman/listinfo/dev
> 
> 

-- 
View this message in context: http://www.nabble.com/Resize---Rotate-Feature-tp18578507p18599624.html
Sent from the OpenLayers Dev mailing list archive at Nabble.com.




More information about the Dev mailing list