OpenLayers event.register not registering -


ok noob openlayers. problem have this...

in javascript, after initializing map, adding base osm layer , centering, code ajax lookup of points markers add map, markers in groups, creates new layer every group , adds markers group layer. but, before adding marker layer event register of mousedown simple alert function.

the problem here when go click on marker, cursor turns hand thinks want drag map. it's there's other layer on top that's preventing click. tried console logging instead of alert make sure never triggers event click. it's hard code sample display full picture of code, here's snippet:

function createmarker(lat, lon) {     var icon = new openlayers.icon('/mapicon/icon-b.png', new openlayers.size(12, 20), new openlayers.pixel(-6, -10)); // custom image     lonlat = new openlayers.lonlat(lon, lat);     var marker = new openlayers.marker(lonlat, icon.clone());     return marker; }  marker = createmarker(lat,lon,'example title'); marker.events.register('mousedown', pin, function(evt) { alert('help!'); openlayers.event.stop(evt); }); 

i hitting wall , if weren't bald, i'd pulling hair out. have ideas?

thanks all. problem (and ol documentation horribly pathetic doesn't state anywhere) has order in create layers. in code, loop through array of layer names , creating marker layer , vector layer each name. tried creating marker layer first , creating vector layer first , had same click crippling effect. tried looping through once create of vector layers first. loop through again , create marker layers , worked.

ol great mapping system. it's shame have such poor documentation. samples useless. if ol such community driven thing, why there no ol forums? had come here because seems place ol users kind of posting.


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -