<div><br></div><div>> I wonder if someone could help me out with some pointers or a code solution<br>> with this OpenLayers problem I've run into. I've been going round for hours<br>> trying to work out what's wrong, and I've not come across an obvious<br>
> solution in the documentation. The working example is<br>> at <a href="http://bit.ly/dcutnD" target="_blank">http://bit.ly/dcutnD</a><br>> What I'm trying to achive is:<br>> 1) Click on an icon<br>> 2) The popup comes up<br>
> 3) Click 'Choose this point'. The point will be set as the start location<br>> and the popup balloon will disappear.<br>> 4) Now if you click on another icon, the same thing should happen. BUT<br>> instead, the popup briefly appears, a red icon is set (meaning 'finish') and<br>
> the popup disappears.<br>> I thought this might be something to do with stopping click propagation,<br>> which I see can be done using OpenLayers.Handler.Feature stopClick, or<br>> presumably stopping an event passing through. But I couldn't work out how to<br>
> attach those to the SelectFeature. And anyway:<br>> I don't think it's that because the first of the two clicks works exactly as<br>> expected without me having to do anything special coding-wise. Therefore I'm<br>
> wondering if there is some implicit layer re-selection/activation going on,<br>> or something that changes the state, which somehow I have to reset.<br>> The two key files are photomap.js and itinerary.js.<br>> Also there is a second issue, whereby the green/red markers appear under the<br>
> main feature icons. I am, however, setting the zIndex and zIndexing, but to<br>> no effect - in the Chrome js inspector, both icon types get z-index=auto for<br>> the computed style. Again, any pointers would be helpful. (NB I cannot<br>
> trivially change the code order so that the feature layers are loaded in the<br>> other order.)<br>> Any help would be gratefully received!<br>><br>> Martin</div><div><br></div><br><br><div class="gmail_quote">
On 3 August 2010 10:15, Pierre wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><br>
I suspect something strange happens in the onFeatureUnselect method.<br>
I added some breakpoints using firebug and things went well which may<br>
demonstrate that the onFeatureSelect and onFeatureUnselect call has an<br>
impact.<br>
I think you're hopping that they are called in a specific order which<br>
may be wrong.<br>
<br>
I cannot easily check this but I would add console.log statements to<br>
verify that removePopup and addPopup calls are correctly called with<br>
the correct arguments, that CS.popup is not destroyed just after being<br>
created.<br>
<br>
What I would first suggest is listening to "featureselected" and<br>
"featureunselected" events instead of onFeatureSelect and<br>
onFeatureUnselect callbacks.<br>
This shouldn't radically change things. This is a more modern though.<br></blockquote><div><br></div><div>Pierre, thank you very much for your reply. I've migrated the code to using those event listeners rather than callbacks. (This hasn't fixed the problem but at least it is a more modern way.) I also believe the popup calls are being passed the correct values.</div>
<div><br></div><div>A colleague and I have spent many further hours on this, and we still can't resolve this. Can anyone provide any further suggestions or a solution? - We're tearing our hair out on this!</div><div>
<br></div><div>By way of reminder the problem is:</div><div><br></div><div><a href="http://bit.ly/dcutnD" target="_blank">http://bit.ly/dcutnD</a></div><div><br></div><div>On first click of an icon, the popup comes up fine, and clicking the box within it then dismisses the popup and sets the green marker.</div>
<div><br></div><div>Clicking on a second icon then results in the marker being selected and the popup disappearing.</div><div><br></div><div>The itinerary.js file does explicitly specify that the popup should disappear.</div>
<div><br></div><div>So I *think* what is happening on that second icon scenario is:</div><div><br></div><div>1) User clicks on the marker</div><div>2) The popup is created</div><div>3) The click-through propagates to the itinerary marker layer</div>
<div>4) The itinerary.requestNearestPoint method is called, which firstly destroys the popup, before the user has had a chance to do anything with it.</div><div><br></div><div>My hunch is that either:</div><div><br></div>
<div>a) The phase where the red itinerary marker is being placed somehow changes the layer status, whatever that is. (After all, this all works correctly for the first icon.) Or:</div><div>b) Somehow we have to stop click propagation.</div>
<div><br></div><div><br></div><div>Neither of us are experts at Javascript, and so any help would be very highly appreciated.</div><div><br></div><div><br></div><div>Martin</div><div><br></div></div>