[OpenLayers-Users] Re: Right click on map disables the left click functionallity

coastalrocket andy at planetnomad.com
Thu Mar 8 11:25:47 EST 2012


I found this didn't fix it for OL2.11. Deactivate and activate the
wmsgetfeatureinfo control (clickControl).
turn it off and on again :-)

 	OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, {                
		defaultHandlerOptions: {
			'single': true,
			'double': true,
			'pixelTolerance': null,
			'stopSingle': false,
			'stopDouble': false
		},
		handleRightClicks:true,
		initialize: function(options) {
			this.handlerOptions = OpenLayers.Util.extend(
				{}, this.defaultHandlerOptions
			);
			OpenLayers.Control.prototype.initialize.apply(this, arguments); 
			this.handler = new OpenLayers.Handler.Click(
				this, this.eventMethods, this.handlerOptions
			);
		},
		CLASS_NAME: "OpenLayers.Control.Click"
	});
	// Add an instance of the Click control that listens to various click
events:
	var oClick = new OpenLayers.Control.Click({eventMethods:{
		'rightclick': function(e) {
			clickControl.deactivate();
			clickControl.activate();
			//alert('rightclick at '+e.xy.x+','+e.xy.y);
		},
		'click': function(e) {
			//alert('click at '+e.xy.x+','+e.xy.y);
		},
		'dblclick': function(e) {
			//alert('dblclick at '+e.xy.x+','+e.xy.y);
		},
		'dblrightclick': function(e) {
			//alert('dblrightclick at '+e.xy.x+','+e.xy.y);
		}
	}});
	
	map.addControl(oClick);
	oClick.activate();	

--
View this message in context: http://osgeo-org.1560.n6.nabble.com/Right-click-on-map-disables-the-left-click-functionallity-tp3922601p4558870.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list