[OpenLayers-Users] Control.Scale fails when div or geodesic options are used

Tim Baggett tim.baggett at gmail.com
Sun Sep 18 16:51:55 EDT 2011


Hi all,

I am using OpenLayers trunk at rev 12352. I noticed that when I
attempt to create a Control.Scale object with any options, it would
fail to work:


       new OpenLayers.Control.Scale( {
         div: document.getElementById('scalediv'),
         geodesic: true
       } ),

However, if I add no options, then the Scale control would appear in
its default position inside the map.


       new OpenLayers.Control.Scale(  ),

Seeing that the ScaleLine control worked fine for me, and that
ScaleLine is a close copy of the Scale control I began looking for
differences. As a result, I deleted the Scale::initialize() function
in favor of inheriting from Control::initialize() instead just as
ScaleLine does.

The result is that I can now enable geodesic and move my Scale control
outside the map into my own div.

Patch is attached.

I greatly appreciate the work all have put into OpenLayers, and hope
this helps contribute something (however trivial) back.

Regards,
Tim
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Scale_div.patch
Type: text/x-patch
Size: 660 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/openlayers-users/attachments/20110918/8407c44a/Scale_div.bin


More information about the Users mailing list