On Mon, Sep 21, 2009 at 7:45 PM, cgp <carina_pala...@forcorp.com> wrote: > > I have the click event registered like this: > >>>>> > map.events.register('click', map, function (e) { > var params = { REQUEST: "GetFeatureInfo", > EXCEPTIONS: > "application/vnd.ogc.se_xml", > BBOX: map.getExtent().toBBOX(), > X: e.xy.x, > Y: e.xy.y, > INFO_FORMAT: 'text/html', > QUERY_LAYERS: layer_info, > FEATURE_COUNT: 50, > Styles: '', > Layers: layer_info, > srs: 'EPSG:900913', > WIDTH: map.size.w, > HEIGHT: map.size.h, > format: 'image/png' }; > > OpenLayers.loadURL("http://app-serv-01-uat/geoserver/wms", params, this, > setHTML, setHTML); > OpenLayers.Event.stop(e); > }); > > But I only want the click event to happen if the layer is currently visible > (i.e. if it is checked in the Layer Switcher). Otherwise, if the user is not > currently viewing the layer, then the getFeatureInfo request should not be > called.
can't you just check layer.getVisibility() in the "click" callback? -- Eric Lemoine Camptocamp France SAS Savoie Technolac, BP 352 73377 Le Bourget du Lac, Cedex Tel : 00 33 4 79 44 44 96 Mail : eric.lemo...@camptocamp.com http://www.camptocamp.com _______________________________________________ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users