Hi all
I'm trying something simple but doesn't work. I want to add a new property
to the scale control, for allow to choose between abbreviate or not the
scale.
What I did is:
OpenLayers.Control.Scale = OpenLayers.Class(OpenLayers.Control, {
[...]
/**
* Property: abreviate
* modificantion for abreviate or not the scale value
* {Boolean}
* default : false
*/
abbreviate: false,
[...]
/**
* Method: updateScale
*/
updateScale: function() {
var scale = this.map.getScale();
if (!scale) {
return;
}
if (this.abbreviate){
if (scale >= 9500 && scale <= 950000) {
scale = Math.round(scale / 1000) + "K";
} else if (scale >= 950000) {
scale = Math.round(scale / 1000000) + "M";
} else {
scale = Math.round(scale);
}
}else{
scale = Math.round(scale);
}
this.element.innerHTML = OpenLayers.i18n("scale", {'scaleDenom':scale});
},
[...]
It works fine until I call the scale control with the property
map.addControl(new OpenLayers.Control.Scale({'abbreviate':true}));
Anybody colud sayme what I'm doing wrong.
Thank's in advance
_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users