disabled move in Y

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

disabled move in Y

lenoil
This post has NOT been accepted by the mailing list yet.
Hi,

OL2  : Openlayers 2
OL3 : Openlayers 3
it possible to disabled the move in Y or in Y ? OL2 or OL3 ?
Is it possible to zoom only on the X, only on the Y  ? OL2 or OL3 ?

Thanks for your help because I 'm lost
Reply | Threaded
Open this post in threaded view
|

Re: disabled move in Y

Xavier Mamano (jorix)
Hi,

For OL2 try:

var navCtl = new OpenLayers.Control.Navigation();
map.addControl(navCtl); // this must be written before the tricks!!

// Trick for pan
var evtTrick = function (evt) {
    evt.xy = new OpenLayers.Pixel(evt.xy.x, this.last.y);
};
var navCtlPanHnd = navCtl.dragPan.handler;
navCtlPanHnd.move = evtTrick;
navCtlPanHnd.up = evtTrick;
navCtlPanHnd.out = evtTrick;

// Trick for zoom
var evtTrick2 = function (evt) {
    evt.xy = new OpenLayers.Pixel(this.last.x, evt.xy.y);
};
var navCtlZboxHnd = navCtl.zoomBox.handler.dragHandler;
navCtlZboxHnd.move = evtTrick2;
navCtlZboxHnd.up = evtTrick2;
navCtlZboxHnd.out = evtTrick2;

regards,


lenoil wrote
Hi,

OL2  : Openlayers 2
OL3 : Openlayers 3
it possible to disabled the move in Y or in Y ? OL2 or OL3 ?
Is it possible to zoom only on the X, only on the Y  ? OL2 or OL3 ?

Thanks for your help because I 'm lost