[OpenLayers-Users] Javascript Error - ScrollWheel disabled - IE
- scroll on map
Roald de Wit
roald.dewit at lisasoft.com
Fri Feb 20 01:48:45 EST 2009
Hi David and list,
Today I looked a bit deeper into the matter and I think I know what is
going on.
In the function getMousePosition an event listener gets created that
will clear the mouse cache on a 'scroll' event.
My suspicion is that clearMouseCache gets called (by that listener) just
after this.element.scrolls = [] has been executed, causing
this.element.scrolls to be null directly after it got created!
The easiest solution I've come up with is the following. Instead of:
this.element.scrolls = [];
this.element.scrolls[0] = (document.documentElement.scrollLeft
|| document.body.scrollLeft);
this.element.scrolls[1] = (document.documentElement.scrollTop
|| document.body.scrollTop);
You do this:
this.element.scrolls = [
(document.documentElement.scrollLeft
|| document.body.scrollLeft),
(document.documentElement.scrollTop
|| document.body.scrollTop)
];
And to be on the safe side, we'd probably need to do that for the other
elements (lefttop and offsets) as well.
If this would be an appropriate solution for inclusion in 2.8, I'm more
than happy to create a ticket and provide a patch for it.
Regards, Roald
David Martin wrote:
> Roald,
>
> No tidy solution - I have just left the try-catch solution in my production system and it seems to be working well. I do understand the problem and will work on it some more in due course. At the moment I am focused on many other projects however a major product update in one of my OpenLayers apps will be starting in about 4 weeks. I will get onto this error again then when I load up the latest build and start afresh.
>
> Do you need a copy of the mod? I installed it directly in the single file build and could copy out the lines if you need it.
>
> David
>
> -----Original Message-----
> From: Roald de Wit [mailto:roald.dewit at lisasoft.com]
> Sent: Tuesday, 3 February 2009 1:23 PM
> To: David Martin
> Cc: users
> Subject: Re: [OpenLayers-Users] Javascript Error - ScrollWheel disabled - IE - scroll on map
>
> Hi David,
>
> Coincidentally, today I bumped into the same problem as you describe
> below. Did you manage to find a solution or did you stick to the
> workaround with the try-catch construction?
>
> Do you feel like creating an issue in Trac [1] (with a simplified
> example that can reproduce the error)?
>
> Kind regards,
>
> Roald
>
> [1] http://trac.openlayers.org/wiki/FilingTickets
>
> On Mon, 2008-12-22 at 11:50 +1030, David Martin wrote:
>
>> I have been having an on-going problem with OL (using 2.7 and same in
>> the trunk). The issue seems to only occur when using IE. If you
>> disable the zoomWheel in the Navigation control and then load a
>> Control.Click with an event script to capture clicks and mouse
>> positions in a map. Show this map in IE and then scroll with the wheel
>> over the map panel itself the browser throws a this.element.scrolls is
>> null or not an object.
>>
>>
>>
>> I looked at the event script and I believe that during the
>> getMousePosition function the evt is being destroyed with the
>> this.clearMouseCache event (caused be scrolling using the wheel over
>> the map). I know I am close because I wrapped the whole
>> getMousePosition function is a try { { catch{} and the error has gone
>> away. I would debug it further however I cannot use Firebug in IE as I
>> do in Firefox. I also find that IE does not launch my debuggers
>> correctly in this instance.
>>
>>
>>
>> I know it is killing the event (this) because if I comment out the
>> this.element.scrolls section lines 777 – 783 the error is reported
>> then against the this.element.lefttop. Is there a better solution?
>>
>>
>>
>> Regards
>> David Martin
>> Managing Director
>> I.T. Beyond Pty Ltd
>>
>> Postal:
>>
>>
>> PO BOX 967
>> HILLARYS WA 6923
>>
>>
>> Ph:
>>
>>
>> (08) 9403 3737
>>
>>
>> Mobile:
>>
>>
>> 0417 677 275
>>
>>
>> Fax:
>>
>>
>> (08) 9403 3738
>>
>>
>> Skype:
>>
>>
>> itbeyond_david
>>
>>
>>
>> ______________________________________________________________________
>>
>> Check out our websites: www.ExplorOz.com and www.itbeyond.com.au
>>
>>
>> ______________________________________________________________________
>>
> --
> Roald de Wit
> Software Engineer
> roald.dewit at lisasoft.com
>
> Commercial Support for Open Source GIS Software
> http://lisasoft.com/LISAsoft/SupportedProducts/
>
>
> The contents of this email are confidential and may be subject to legal or professional privilege and copyright. No representation is made that this email is free of viruses or other defects. If you have received this communication in error, you may not copy or distribute any part of it or otherwise disclose its contents to anyone. Please advise the sender of your incorrect receipt of this correspondence.
>
The contents of this email are confidential and may be subject to legal or professional privilege and copyright. No representation is made that this email is free of viruses or other defects. If you have received this communication in error, you may not copy or distribute any part of it or otherwise disclose its contents to anyone. Please advise the sender of your incorrect receipt of this correspondence.
More information about the Users
mailing list