[OpenLayers-Users] Fwd: SelectFeature hover control interfering with click-and-drag

Ivan Grcic ivan.grcic at geofoto.hr
Thu Nov 6 04:10:14 EST 2008


Ive put working example here:
http://dev.openlayers.org/sandbox/igrcic/playground/

so when you drag map over features it works perfect, but when i
release mouse click occurs and feature is selected. How to avoid that
selecting at the end?

 Any hints? Tnx


---------- Forwarded message ----------
From: Ivan Grcic <ivan.grcic at geofoto.hr>
Date: Tue, Nov 4, 2008 at 2:06 PM
Subject: Re: [OpenLayers-Users] SelectFeature hover control
interfering with click-and-drag
To: Robert Sanson <SansonR at asurequality.com>
Cc: Roald de Wit <roald.dewit at lisasoft.com>, "users at openlayers.org"
<users at openlayers.org>


Hi list,

in v2.7 im using next syntax to achieve this:

      mySelectFeatureControl.handlers["feature"].stopDown =false;
      mySelectFeatureControl.handlers["feature"].stopUp = false;

Now I can drag my map even if i have my mouse over features/polygons.
Sweet. But when i stop dragging and let my mouse button - click
occurs, and onSelect method from my selectFeature control occurs...and
i dont want that ;)

What would be the right way to filter only clicks (no dragging) for
selectFeature, and to leave dragging for panning the map (without
catch mouse click on end of drag) ?? Do I have to use ClickHandler
with options like this & where excatly to define it?
: new OpenLayers.Control.Click({
                      handlerOptions: {
                          "single": true,
                          "pixelTolerance": null
                      }
                  }),

Thank you,

Ivan

On Mon, Sep 8, 2008 at 6:05 AM, Robert Sanson <SansonR at asurequality.com> wrote:
> Hi Roald
>
> It was uncommented because I copied the code from another example and those
> lines were already commented out. I had since tried uncommenting those, and
> it worked! Sorry I didn't let the list know that I had solved it. Anyway,
> thanks for the response.
>
> I am still using v2.6. Haven't tried v2.7rc1 yet.
>
> Kind regards,
>
> Robert Sanson
>
>>>> Roald de Wit <roald.dewit at lisasoft.com> 8/09/2008 4:53 p.m. >>>
> Hi Robert,
>
> It seems you are/were very close to the solution of you problem: to
> allow for the map to be dragged when your mouse pointer is over a
> selectable feature, you need to override the stopDown and stopUp
> attributes of the handler, just as you have in your code below (but then
> uncommented!).
>
> Could you explain why you have these lines commented out? Have you tried
> uncommenting them? What version of OL are you using? 2.7-rc1, 2.6 or an
> older version?
>
> Today crschidt explained to me that in 2.7 the SelectFeature control
> behaves a bit differently internally and in order for the fix work,
> you'd need to rewrite the code. See [1]
>
> But this might not apply to you and you might have other reasons why it
> won't work for you.
>
> Cheers, Roald
>
> [1] http://trac.openlayers.org/wiki/SelectFeatureControlMapDragIssues
> On Wed, 2008-09-03 at 06:56 +0930, Robert Sanson wrote:
>> I have an OL map that has a GML polygon layer (loaded from a WFS
>> source). I have a SelectFeature control that operates using hover:true
>>
>>                 var options = {
>>                     hover: true,
>>                     onSelect: function(feature) {
>>                     OpenLayers.Util.getElement('selfarm').innerHTML =
>> "<strong>Farm_id:</strong>" + feature.attributes.FARM_ID + "
>> <strong>Par_no:</strong>" + feature.attributes.PAR_ID
>>                     }
>>
>>                 };
>>                 var select = new
>> OpenLayers.Control.SelectFeature(fbnd, options);
>>                 map.addControl(select);
>>                 //select.handler.stopDown = false;
>>                 //select.handler.stopUp = false;
>>                 select.activate();
>>
>> Anyway, when I hover over a polygon, I get a a couple of the
>> attributes displayed in a div below the map. The problem I have is
>> that the normal click-and-drag control used for panning the map does
>> not work when I drag on a polygon feature. It only works when I drag
>> in a part of the map without one of these polygons.
>>
>> Any clues?
>>
>> Many thanks,
>>
>> Robert Sanson
>>
>>
>>
>> ------------------------------------------------------------------
>> The contents of this email are confidential to AsureQuality. If you have
>> received this communication in error please notify the sender immediately
>> and delete the message and any attachments. The opinions expressed in this
>> email are not necessarily those of AsureQuality. This message has been
>> scanned for known viruses before delivery. AsureQuality supports the
>> Unsolicited Electronic Messages Act 2007. If you do not wish to receive
>> similar communications in future, please notify the sender of this message.
>> ------------------------------------------------------------------
>>
>>
>>
>>
>>
>>     This message has been scanned for malware by SurfControl plc.
>>                          www.surfcontrol.com
>>
>>
>>
> --
> Roald de Wit
> Software Engineer
> roald.dewit at lisasoft.com
>
> Commercial Support for Open Source GIS Software
> http://lisasoft.com/LISAsoft/SupportedProducts/
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
>
>
>
> ------------------------------------------------------------------
> The contents of this email are confidential to AsureQuality. If you have received this communication in error please notify the sender immediately and delete the message and any attachments. The opinions expressed in this email are not necessarily those of AsureQuality. This message has been scanned for known viruses before delivery. AsureQuality supports the Unsolicited Electronic Messages Act 2007. If you do not wish to receive similar communications in future, please notify the sender of this message.
> ------------------------------------------------------------------
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
>



--
Ivan Grcic



--
Ivan Grcic



-- 
Ivan Grcic



More information about the Users mailing list