-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow custom mousemove conditions for Select interaction #3033
Conversation
@tsauerwein, you may be interested in reviewing this. |
@@ -179,7 +179,7 @@ ol.interaction.Select.prototype.handleMapBrowserEvent = | |||
} | |||
features.extend(selected); | |||
} | |||
return this.condition_ == ol.events.condition.mouseMove; | |||
return mapBrowserEvent.originalEvent.type == 'mousemove'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or return ol.events.condition.mouseMouve(mapBrowserEvent)
to avoid duplication?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What duplication? Sorry I'm not getting it :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the test is the exact content of the mouseMove condition function, no?
On 15 December 2014 at 11:36, Éric Lemoine notifications@github.com wrote:
In src/ol/interaction/selectinteraction.js
#3033 (diff):@@ -179,7 +179,7 @@ ol.interaction.Select.prototype.handleMapBrowserEvent =
}
features.extend(selected);
}
- return this.condition_ == ol.events.condition.mouseMove;
- return mapBrowserEvent.originalEvent.type == 'mousemove';
What duplication? Sorry I'm not getting it :-)
—
Reply to this email directly or view it on GitHub
https://github.com/openlayers/ol3/pull/3033/files#r21815875.
Antoine Abt
Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex
Tel : 00 33 4 79 44 44 94
Mail : antoine.abt@camptocamp.com
http://www.camptocamp.com
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense.
4ef882a
to
206f919
Compare
When configuring a Select interaction with a custom condition that includes mousemove, panning the map will not work any more. This is because the return value of handleMapBrowserEvent is determined by checking for a default condition function. By checking for the underlying event type instead, we gain flexibility with custom condition functions.
206f919
to
9b0b154
Compare
Don’t know what the Travis error is, otherwise looks good to me. |
Your change looks good to me, thanks! I guess we still have the problem reported in #2755? |
I think #2755 is unrelated to this. |
Allow custom mousemove conditions for Select interaction
Yes, #2755 is not related |
When configuring a Select interaction with a custom condition that includes mousemove, panning the map will not work any more. This is because the return value of handleMapBrowserEvent is determined by checking for a default condition function. By checking for the underlying event type instead, we gain flexibility with custom condition functions.
This change makes Select interaction configurations like the following work:
This configuration is useful for hover selection with a click fallback on mobile devices that do not have hover.