Commit Graph

108 Commits

Author SHA1 Message Date
ahocevar
7bfa15c0fd Add click event as responsive alternative to singleclick
The singleclick event makes the application feel slow because
of the 250 ms delay that is used to rule out a dblclick.
2014-03-27 18:33:17 +01:00
Andreas Hocevar
b59fa4e8af Merge pull request #1898 from ahocevar/events
Document events
2014-03-26 14:13:59 +01:00
ahocevar
932cab12af Document stability of MapBrowserEvent properties and events 2014-03-25 22:07:14 +01:00
ahocevar
7e850ca33d Use JSDoc's stock event documentation 2014-03-25 18:21:08 +01:00
ahocevar
fcd737e62b Document MapBrowserEvent events 2014-03-24 21:53:32 +01:00
Tom Payne
35dea5e3a6 Always use === to compare with 0 2014-03-23 18:29:47 +01:00
tsauerwein
155b9b3f86 Add comment about pointercancel listener 2014-03-14 10:16:27 +01:00
tsauerwein
77aa29e6ee Remove blank lines 2014-03-14 10:16:27 +01:00
tsauerwein
52839533e6 Fix typo in POINTERDRAG constant 2014-03-14 10:16:27 +01:00
tsauerwein
6742e6a03a Fix type annotation 2014-03-14 10:16:27 +01:00
tsauerwein
51d7cb2820 Make goog.events.listen return proper listener key
When goog.events.listen receives an array of event types,
it only return null as listener key. So that calling
goog.events.unlistenByKey does not work.
2014-03-14 10:16:26 +01:00
tsauerwein
b17957b543 Fix support for legacy IE 2014-03-14 10:16:26 +01:00
tsauerwein
42f0dfa75a Use goog.dispose 2014-03-14 10:16:26 +01:00
tsauerwein
0d72f4542e Remove old event types
Pointer events for the win.
2014-03-14 10:16:26 +01:00
ahocevar
32ffb1ecae Relay pointermove events again
This will be needed for hover actions.
2014-03-14 10:16:26 +01:00
tsauerwein
fca9c50a3f PointerInteraction uses MapBrowserPointerEvent not MapBrowserEvent 2014-03-14 10:16:26 +01:00
tsauerwein
e0b345b7db add assertion 2014-03-14 10:16:26 +01:00
tsauerwein
692a68644f introduce type POINTERDRAG to make a distinction between pointer move and drag 2014-03-14 10:16:26 +01:00
tsauerwein
b52f79340d use separate pointer event handler for document when dragging 2014-03-14 10:16:26 +01:00
tsauerwein
7fbd11154b refactoring, type annotations 2014-03-14 10:16:26 +01:00
tsauerwein
d772c95ccf makes PointerEvent a plain closure class, instead of trying to mimic a mouse event, which was required for the polyfill 2014-03-14 10:16:25 +01:00
tsauerwein
a31cc3f18c only track events when "pointerdown" event was received, because on native android browser wrong move events are sent with no "pointerdown" event 2014-03-14 10:16:25 +01:00
tsauerwein
c4c1eb7d45 allow dragging for mouse/ms/native when pointer is outside map viewport element 2014-03-14 10:16:25 +01:00
tsauerwein
1c75ecc260 former touch interactions now use pointer events 2014-03-14 10:16:25 +01:00
tsauerwein
014ef96c31 base interactions for pointer events on existing touch interactions 2014-03-14 10:16:25 +01:00
tsauerwein
df4bd7c43b source for ms pointer events (IE10) 2014-03-14 10:16:25 +01:00
tsauerwein
7140f608f8 pointer events generated by mouse events 2014-03-14 10:16:25 +01:00
Tom Payne
022a7a03e0 Use oli.FrameState instead of ol.FrameState 2014-03-10 14:48:23 +01:00
Austin Hyde
298674d14f Only do the IE-safe event cloning in legacy IE 2014-02-05 10:32:14 -05:00
Austin Hyde
9ffed5bf5f Add a compile-time flag to enable legacy IE support 2014-02-05 10:32:14 -05:00
Austin Hyde
74a9a155b1 Dispose of the IE dblclick listener, add goog.require 2014-02-05 10:32:14 -05:00
Austin Hyde
c9ca219286 Fix the root cause of the IE mouseup event bug.
When the event object is reference outside the call stack of the
original event handler (like in a setTimeout), accessing its
properties results in a "member not found" error. The solution is to
clone the event object and use the clone.
2014-02-05 10:32:14 -05:00
Tom Payne
318fc68159 Convert ol.MapBrowserEvent#get* methods into properties 2014-01-29 14:51:27 +01:00
Frederic Junod
80cae77161 Add 'const' annotation to ol.MapBrowserEvent.browserEvent 2014-01-09 10:32:30 +01:00
Éric Lemoine
0e75e971d9 Conditionally deregister touchend listener 2013-12-18 15:55:11 +01:00
Éric Lemoine
3877f87a26 Add ol.MapBrowserEvent#getBrowserEvent 2013-12-09 12:29:05 +01:00
oterral
22ac512507 Fix map navigation on android native browsers 2013-11-29 09:06:19 +01:00
Tim Schaub
85500fb616 Merge pull request #1252 from tschaub/expose-down
Add a getter for the most recent down event.
2013-11-11 11:27:19 -08:00
Olivier Terral
67d3b4527a Modify comments 2013-11-08 17:15:58 +01:00
Olivier Terral
726a04ce3e Forbid right click to trigger singleclick events on IE10 2013-11-08 13:30:58 +01:00
Olivier Terral
d0b0d0470b Fix singleclick and doubleclick on windows Surface 2013-11-08 13:30:58 +01:00
Tim Schaub
22fb418236 Provide a method to get the most recent down type event
This will allow interactions to conditionally handle later events based on the down event.
2013-11-07 11:21:01 -07:00
Tim Schaub
812cb7fb12 Leave the down_ event set
The other "up" type listeners (for touch and pointer) do not set this to null.  This event can be of use to a click listener that might want to compare the down position to the click event's position.
2013-11-07 11:02:04 -07:00
Tim Schaub
d5d005ba3f Allow interactions to deal directly with browser events
The relayEvent_ method wraps goog's browser events in our MapBrowserEvent.  This allows interactions to deal with real browser events in addition to our emulated events.
2013-11-01 13:07:44 -06:00
Éric Lemoine
d81fe5ac95 Map browser event handler refactoring
This commit refactors the code of the map browser event handler. The changes are the following:

Previously the `handleTouch*_` listener functions handled both `touch*` and `mspointer*` events. With this commit we use per-event type listeners. This duplicates some code (could be avoidable), but makes it easier to introduce mouse/touch/pointer specific treatments in the future.

We now listen to pointermove, pointerup, touchmove and touchend only when needed. In this way we're assured that a `down` event was received (and that `this.down_` is set) when the `up` or `move` listeners are called. This fixes the bug @oterral reported on the mailing list: https://groups.google.com/d/msg/ol3-dev/jR844F7Nlg8/eN9dt4uATK0J.

To avoid problems in browsers that trigger different types of events (e.g. both mouse and pointer events) the `down` listeners unregister the other `down` listeners. For example, the `pointerdown` listener unregisters the `mousedown` and `touchstart` listeners, for ever.
2013-10-31 13:35:01 +01:00
Éric Lemoine
8402eee0c3 Map "click" event renamed to "singleclick"
As discussed with @tschaub in #1195.
2013-10-31 09:37:16 +01:00
Éric Lemoine
0fa66cc7e7 Remove mousedown listener on first touchstart 2013-10-30 13:16:09 +01:00
Éric Lemoine
9f7ead5ef4 Remove unused ol.MapBrowserEventHandler#relayEvent_ func 2013-10-30 13:16:09 +01:00
Éric Lemoine
a85b82090d Emulate click events only on mouse "action"
`click` events are fired only if the mouse action button is pressed. This prevents `click` events from being fired when the middle mouse button is used.

Also, without this commit, in Chrome with emulated touch events enabled, double-clicking the map doesn't zoom the map. This is because `ol.BrowserFeature.HAS_TOUCH` is `false` in that environment. The commit fixes it by testing `isMouseActionButton` on mouse devices only.
2013-10-30 13:16:09 +01:00
Éric Lemoine
0c212fdcb5 Emulated click events on mouse devices
The map already emits emulated `click` and `dblclick` events on touch and pointer devices. With this commit the map emits emulated `click` and `dblclick` events on mouse devices as well.
2013-10-30 13:16:09 +01:00