[OpenLayers-Users] new OpenLayers.Layer.Text with autosize

Marc Jansen jansen at terrestris.de
Tue Dec 22 08:05:03 EST 2009


Hi Jan,

you should be able to override the popup generation function (I didn't 
test it, though):

OpenLayers.Feature.prototype.createPopup = function (closeBox) {
    if (this.lonlat != null) {
        var id = this.id + "_popup";
        var anchor = this.marker ? this.marker.icon : null;
        if (!this.popup) {
            this.popup = new (this.popupClass)(id, this.lonlat, 
this.data.popupSize, this.data.popupContentHTML, anchor, closeBox);
            // the next line is different from the current implementation
            this.popup.autoSize = true;
        }
        if (this.data.overflow != null) {
            this.popup.contentDiv.style.overflow = this.data.overflow;
        }
        this.popup.feature = this;
    }
    return this.popup;
}*;
*
(I only added the "this.popup.autoSize = true"-line)

Include the above JavaScript right after loading the OpenLayers-library, 
this is an application wide change.

Regards,
Marc
*

*

Jan Tappenbeck wrote:
> Hi !
>
> i used in [1] following command:
>
>   var caravan = new OpenLayers.Layer.Text( "Caravan", { 
> location:"data/data_camping_mv/caravan.txt", projection: new 
> OpenLayers.Projection("EPSG:4326")} ); map.addLayer(caravan);
> is there a possiblity to autosize this popup ??
>
> i only found informations about the addmarker-function.
>
> regards Jan :-)
>
> [1] http://www.tappenbeck.net/osm/mv1/index.php?id=1
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
>   




More information about the Users mailing list