I'm actually using a pieces of a DHTML library called x so it has a cross 
browser wrapper. I figured there was a way to do it with the event utility
class. I need the events used with mouse movement too as I've got
coordinate display tied to them.

Steve

>>> Tim Schaub <[EMAIL PROTECTED]> 11/29/07 6:02 PM >>>
Hey-

Steve Lime wrote:
> What I ended up with is a div that covers the map and then I did something 
> like:
> 
>   var elem = document.getElementById('myDiv');
>   elem.addEventListener( 'click', stopPropagation, false);
>   elem.addEventListener( 'mousedown', stopPropagation, false);
>   elem.addEventListener( 'mousemove', stopPropagation, false);
>   elem.addEventListener('mouseup', stopPropagation, false);
>   elem.addEventListener('mouseover', stopPropagation, false);
>   elem.addEventListener('mouseout', stopPropagation, false);
> 
> where stopPropagation is:
> 
>  function stopPropagation(e) { 
>    if (e && e.stopPropagation) evt.stopPropagation();
>    else if (window.event) window.event.cancelBubble = true;
>  }
> 

Since addEventListener isn't available cross-browser, you might want to 
try OpenLayers.Event.observe instead.

As in:

function block(evt) {
     OpenLayers.Event.stop(evt);
}
OpenLayers.Event.observe(elem, "mousedown", block);

etc.

Note it's probably enough to stop just mousedown, click, and dblclick. 
I haven't really followed what you're doing, but you might actually want 
to let mouseup and mousemove through.  Also, memory management (with 
stopObservingElement) is up to you since event listeners on elements 
with circular references are trouble for garbage collectors.

Tim

> Then I just hide/show the overlayed div as necessary. Works like a charm.
> 
> Steve
> 
>>>> On 11/29/2007 at 10:42 AM, in message
> <[EMAIL PROTECTED]>, "Jeff Dege"
> <[EMAIL PROTECTED]> wrote:
>> I had a similar problem, and I hacked in a little kludge to allow me to turn 
>> off event propogation entirely:
>>
>>      var map = new OpenLayers.Map('map', mapOptions);
>>      
>>      //This is a serious kludge, to allow us to turn off event handling on 
>> the 
>> map,
>>      //when OpenLayers supports no such functionality.
>>      map.events.idle = false;
>>      map.events.originalTriggerEvent = openLayersMap.events.triggerEvent;
>>      map.events.triggerEvent = function(type, evt) {
>>              if (this.idle) return;
>>              this.originalTriggerEvent(type, evt);
>>      };
>>
>> It's ugly, and it may get me into real trouble, some time in the future, but 
>> it works.
>>
>> If I set map.events.idle = true, no events fire at all.
>>
>>
>> -----Original Message-----
>> From: Steve Lime [mailto:[EMAIL PROTECTED] 
>> Sent: Wed 11/28/2007 5:12 PM
>> To: Jeff Dege; [email protected] 
>> Subject: RE: [OpenLayers-Users] OT: Event propagation problem...
>>  
>> No response at all, the content covers the whole map interface at the 
>> moment. Whether that works as a design (from a user perspective) is yet to 
>> be 
>> seen.
>>
>> Steve
>>
>>>>> On 11/28/2007 at 5:01 PM, in message
>> <[EMAIL PROTECTED]>, "Jeff Dege"
>> <[EMAIL PROTECTED]> wrote:
>>> Do you want the map to not respond to clicks on your help or legend div?
>>>
>>> If so, you'll need to define event handlers, the way Popups do.
>>>
>>> Or do you want the map to not respond at all, while your help or legend is 
>>> visible?
>>>
>>>
>>> -----Original Message-----
>>> From: [EMAIL PROTECTED] on behalf of Steve Lime
>>> Sent: Wed 11/28/2007 4:56 PM
>>> To: [email protected] 
>>> Subject: [OpenLayers-Users] OT: Event propagation problem...
>>>  
>>> Hi all: Slightly off-topic question. I'm working on an interface that plops 
>>> help and legend content over the top of an OpenLayers
>>> map. Problem is that mouse events continue to propagate through the help or 
>>> legend content to OpenLayers. Anyone aware of
>>> an easy way to stop that or do I need to go ahead and define event handlers 
>>> (that do nothing) for the div that holds this other
>>> content?
>>>
>>> Steve
>>>
>>> _______________________________________________
>>> Users mailing list
>>> [email protected] 
>>> http://openlayers.org/mailman/listinfo/users
> 
> _______________________________________________
> Users mailing list
> [email protected]
> http://openlayers.org/mailman/listinfo/users
> 
> !DSPAM:4033,474ef0b5293991628642973!
> 

_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users

_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users

Reply via email to