[OpenLayers-Users] Zoom bar without pan controls

Arnd Wippermann arnd.wippermann at web.de
Mon Feb 9 07:46:40 EST 2009


Hi,

It's also possible to overwrite the function with your modified version
after the OpenLayers scripts are loaded.

OpenLayers.Control.PanZoomBar.prototype.draw = function(px) {
        // initialize our internal div
        OpenLayers.Control.prototype.draw.apply(this, arguments);
        px = this.position.clone();

        // place the controls
        this.buttons = [];

        var sz = new OpenLayers.Size(18,18);
        var centered = new OpenLayers.Pixel(px.x+sz.w/2, px.y);
        var wposition = sz.w;

        if (this.zoomWorldIcon) {
            centered = new OpenLayers.Pixel(px.x+sz.w, px.y);
        }

        //this._addButton("panup", "north-mini.png", centered, sz);
        px.y = centered.y+sz.h;
        //this._addButton("panleft", "west-mini.png", px, sz);
        if (this.zoomWorldIcon) {
            this._addButton("zoomworld", "zoom-world-mini.png", px.add(sz.w,
0), sz);

            wposition *= 2;
        }
        //this._addButton("panright", "east-mini.png", px.add(wposition, 0),
sz);
        //this._addButton("pandown", "south-mini.png", centered.add(0,
sz.h*2), sz);
        this._addButton("zoomin", "zoom-plus-mini.png", centered.add(0,
sz.h*3+5), sz);
        centered = this._addZoomBar(centered.add(0, sz.h*4 + 5));
        this._addButton("zoomout", "zoom-minus-mini.png", centered, sz);
        return this.div;
}

Arnd Wippermann
 

-----Ursprüngliche Nachricht-----
Von: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] Im
Auftrag von Ivan Grcic
Gesendet: Montag, 9. Februar 2009 11:28
An: Derek Watling
Cc: users at openlayers.org
Betreff: Re: [OpenLayers-Users] Zoom bar without pan controls

hey, was just trying to point out that u can make it by urself by looking
into PanZoomBar class ;)

just take out everything related to buttons, rename file into ZoomBar.js,
and change CLASS_NAME....should work...

(or maybe to add one option inside existing PanZoomBar, something like
showPanButtons: true/false that would control if buttons are rendered ot
not)

cheers!

On Mon, Feb 9, 2009 at 10:23 AM, Derek Watling <derek at cmainfo.co.za> wrote:
>
> Thanks Ivan
>
> I don't really want to start hacking the code because when the next 
> version is released I will have to remember to go and re-hack it. 
> Hopefully Christopher and the excellent team at MetaCarta will pick up 
> on this and implement a "ZoomBar" control in a future version (wink, wink,
nudge nudge).
>
> Derek
> --
> View this message in context: 
> http://n2.nabble.com/Zoom-bar-without-pan-controls-tp2262405p2296408.h
> tml Sent from the OpenLayers Users mailing list archive at Nabble.com.
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>



--
Ivan Grcic
_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users




More information about the Users mailing list