[OpenLayers-Users] IE6 / OpenLayers / Path DrawFeature and DoubleClicks

Andreas Hocevar andreas.hocevar at gmail.com
Tue May 4 03:22:50 EDT 2010


Hi,

are you using a debugger? You should get an error, and I think this is the reason for the behavior you are experiencing:

On May 4, 2010, at 06:43 , James.Sewell at lisasoft.com wrote:

> Thanks for the help Andreas,
>  
> I tried using setTimer , but this resulted in intermittent results (depending on the timing of each line draw I believe) and a flickering circle in all broswers.
>  
> A simplified version of the code I am using is as below (I have omitted the map with a toolbar).  I hope it isn’t too convoluted!
>  
> When using IE and using a polyline tool to draw a line (a circle with a diameter of 10 will be drawn around the last point) a double click will not terminate the line (single then wait then double is needed).
>  
> Please note I am using an array stored in e.feature.geometry.attributes to store the rangeCircle within the Vector (as passed to the handler in e.feature).
>  
> waypointLayer.events.on({'sketchstarted': sketchStarted});
> waypointLayer.events.on({'sketchmodified': sketchModified});
>  
> function sketchStarted(e)
> {
>       e.feature.geometry.attributes = new Array();
>       e.feature.geometry.attributes['circle'] = createCircle(e.feature.geometry.getVertices());
> }
>  
> function sketchModified(e)
> {
>       e.feature.geometry.attributes['circle'].destroy();

There is no destroy method on an Object, unless you have something that overrides Object.

Regards,
Andreas.


>       e.feature.geometry.attributes['circle'] = createCircle(e.feature.geometry.getVertices());
>       waypointLayer.addFeatures(e.feature.geometry.attributes['circle']);
> }
>  
> function createCircle(vert)
> {
>       return new OpenLayers.Feature.Vector(
>             OpenLayers.Geometry.Polygon.createRegularPolygon(vert[vert.length-1], 10, 50)
>       );
> }
>  
> Any help would be really appreciated!
> Cheers,
> 
> James Sewell
> LISAsoft Developer
> +61 (3) 8680 3200 / +61 414 688 892
>  
> -----Original Message-----
> From: andreas.hocevar at gmail.com [mailto:andreas.hocevar at gmail.com] On Behalf Of Andreas Hocevar
> Sent: Friday, 30 April 2010 8:04 PM
> To: James.Sewell at lisasoft.com
> Cc: users at openlayers.org
> Subject: Re: [OpenLayers-Users] IE6 / OpenLayers / Path DrawFeature and DoubleClicks
>  
> Hi,
>  
> On Fri, Apr 30, 2010 at 8:23 AM, James.Sewell at lisasoft.com
> <James.Sewell at lisasoft.com> wrote:
> > I am working with OpenLayers and IE6 (which is the required SOE for the
> > project) and have noticed that mouse doubleclicks are not being captured
> > correctly when drawing a Path from an OpenLayers.Control.DrawFeature  if
> > another element is drawn to any layer from a sketchmodified event.
>  
> I think the "if" part in the above sentence screws your application.
> This sounds like an application issue. You could try to draw the other
> element in the sketchmodified handler using setTimeout. If that does
> not work, try to create a minimal example that shows the issues, so it
> will be easier for others to help.
>  
> Regards,
> Andreas.
>  
> > 
> > 
> > 
> > From IE in the above situation the Path is drawn (which has a circle
> > dynamically drawn round it using the sketchmodified event to call the
> > OpenLayers.Layer.Vector.addFeatures method) but requires a single click
> > immediately followed by a double click to terminate the Path.
> > 
> > 
> > 
> > If the addFeatures call is not made (the circle is not drawn ) behavior is
> > as normal. The code works as expected in Chrome.
> > 
> > 
> > 
> > Has anyone dealt with this behavior before? Any help would really be
> > appreciated.
> > 
> > 
> > 
> > Cheers,
> > 
> > James Sewell
> > 
> > LISAsoft Developer
> > 
> > +61 (3) 8680 3200 / +61 414 688 892
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > _______________________________________________
> > Users mailing list
> > Users at openlayers.org
> > http://openlayers.org/mailman/listinfo/users
> > 
> > 
>  
>  
>  
> --
> Andreas Hocevar
> OpenGeo - http://opengeo.org/
> Expert service straight from the developers.
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users




More information about the Users mailing list