v-leaflet LWmsLayer onClick event

Is it possible to get the onClick events of a LWmsLayer?

Right now it is only in LMap that onClick events seem to work. I tried setting the LWmsLayer with a very high Zindex and set the bringToFront but I can’t still get to the event.

Thanks.

Hi, I think you should be able to get click events from the map, even though you have added layers like WMS layer to your map. If it doesn’t work, could you provide a small usage example so that I could investigate what is wrong?

cheers,
matti

Thanks Matt.

Below is the sample code. Basically what I want to do is get Click events only when a particular WMS layer is Active.

Hi,

I can’t see your sample code, but how are you adding/activating the WMSLayer? Are you using LLayers control to allow user to select particular layers? We should probably add add/remove events or something.

cheers,
matti

final VerticalLayout layout = new VerticalLayout();
layout.setMargin(true);
layout.setSpacing(true);
layout.setSizeFull();
setContent(layout);

	lMap = new LMap();
	
	wms = new LWmsLayer();
	wms.setUrl("http://localhost:8080/geoserver/tiger/wms");
	wms.setLayers("tiger:tiger_roads");
	wms.setTransparent(true);
	wms.setFormat("image/png");
	wms.setActive(true);

	//
	// lMap.addClickListener(...) works
	//
	wms.addClickListener(new LeafletClickListener() {
		
		@Override
		public void onClick(LeafletClickEvent event) {
			Notification.show("Point:"+  event.getPoint().toString() );
		}
	});
	lMap.addOverlay(wms, "TigerRoad");
	lMap.setCenter( 40.78499,-73.97751);
	lMap.setZoomLevel(10);
	
	layout.addComponent(lMap);

Apologies for not being able to post the source. Not quite familiar yet with this forum