[OpenLayers-Users] OpenLayers.Control.SelectFeature and shift-click in Firefox

Richard Eichhorn r.eichhorn at netbi.com.au
Mon Nov 16 22:09:37 EST 2009


Hi Pedro,

Thanks for the examples, but I was looking for an example where a handler is
defined within the selectFeature control.  I want the default behavior for a
click and shiftClick, I just want to stop the event propagating to the
browser.

I have a feeling this could be a bug, as I had a look at the selectFeature
in Firebug, and the control contains a feature handler, and the stopClick
property is set to true.  So it should stop the click reaching the browser.

On the <a> tag issue, there is no <a> tag, the images are rendered using a
styleMap and the externalGraphic property.   Openlayers uses SVG to render
the image on the map -

<image id="OpenLayers.Geometry.Point_409" cx="475.49951501144096"
cy="368.1250306600705" r="1" title="Park Road - 6 [BT000928]"
preserveAspectRatio="none" x="463" y="353" width="24" height="24"
href="/spatial/iface/images/markerBlue.png" style="opacity: 1;"
fill="undefined" fill-opacity="1" stroke="none"/>

It is just default FF behavior.

In the end I have given up using  multipleKey: "shiftKey" in the control,
and have settled for using toggle: true instead.

Thanks for the help.

Cheers,
Richard.
2009/11/16 Pedro Baracho <pedropbaracho at gmail.com>

> I have seen two examples of handlers to Click event:
> http://openlayers.org/dev/examples/click.html
> http://openlayers.org/dev/examples/click-handler.html
>
> I think you will have to create a handler to Keyboard events also, so you
> can capture the Shift+Key. In fact, I think you will only need that. Try
> adding
>      multipleKey: "shiftKey"
> to your SelectFeature control, so you override the shift+click behaviour of
> Firefox.
>
> Just a question: FF opens another window when you shift+click a link, i.e.
> <a> tag. Why is the <a> tag there on your externalGraphic in the first
> place??
>
>
> On Thu, Nov 12, 2009 at 11:10 PM, Richard Eichhorn <
> r.eichhorn at netbi.com.au> wrote:
>
>> Thanks for that.  I did come across that, but I couldn't figure out how to
>> use it in the context of OpenLayers.Control.SelectFeature.
>>
>> There is a handlers property but I can't figure out how to use it.
>>
>> Has anyone got an example of creating an OpenLayers.Control.SelectFeature
>> with a handlers property defined?
>>
>> Cheers,
>> Richard.
>>
>>
>>
>> 2009/11/13 Pedro Baracho <pedropbaracho at gmail.com>
>>
>> I am not sure if that helps, but there is a function stop on Event class
>>> for stopping event propagation.
>>>
>>> http://dev.openlayers.org/docs/files/OpenLayers/Events-js.html#OpenLayers.Event.stop
>>>
>>> On Thu, Nov 12, 2009 at 5:47 AM, Richard Eichhorn <
>>> r.eichhorn at netbi.com.au> wrote:
>>>
>>>> I am using OpenLayers.Control.SelectFeature with features which are
>>>> represented using an externalGraphic.  When I use do a shift-click to
>>>> multi-select features in Firefox, it opens up a new window with the icon of
>>>> the feature I just clicked on.
>>>>
>>>> When writing non-openlayers javascript code I have just used
>>>> preventDefault in firefox to stop the events propagating.
>>>>
>>>> How can I do it in Openlayers?
>>>>
>>>> Cheers,
>>>> Richard
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Users mailing list
>>>> Users at openlayers.org
>>>> http://openlayers.org/mailman/listinfo/users
>>>>
>>>>
>>>
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20091117/9d966ba4/attachment.html


More information about the Users mailing list