[OpenLayers-Users] How to access mouse modifier during "featureselected"

Marcel Ruff mr at marcelruff.info
Wed Feb 10 09:39:49 EST 2010


The openlayers lib should be extended to deliver all details:

evt.element
evt.feature
evt.object
evt.type="featureselected"
evt.button=1; // 1==left mouse,  2==middle mouse, 3==right mouse
evt.modifier=1; // Shift==1, Ctrl==2 , WindowsKey==8. Alt==3 etc

or probably human readable convenience methods:

  e.isLeftPressed()
  e.isMiddlePressed()
  e.isRightPressed()
  e.isAltPressed()
  e.isCtrlPressed()
...

Marcel
> On Wed, Feb 10, 2010 at 12:10:10PM +0100, Marcel Ruff wrote:
>   
>> Ivan Grcic schrieb:
>>     
>>> Oh yes, as i see feature handler doesnt have same evt attribs as click
>>> handler does... so you need to catch click handler of feature handler
>>> somehow :|
>>>   
>>>       
>> Yes, this is all I get, so no chance to detect which mouse button was 
>> pressed:
>>
>>   evt.element
>>   evt.feature
>>   evt.object
>>   evt.type="featureselected"
>>
>> If I use "click" I need to somehow compute myself which feature was hit ...
>>
>> There is no simple solution available?
>>     
>
> When you click, the browser doesn't *know* which feature was hit. So
> no, there is not.
>
> -- Chris
>
>   
>>




More information about the Users mailing list