Commit Graph

1236 Commits

Author SHA1 Message Date
Stéphane Brunner 889b6a9f43 Removes unnecessary type cast 2019-05-27 11:34:33 +02:00
Frederic Junod ec811bfa1f Add primaryAction condition to DragPan interaction 2019-05-22 15:21:17 +02:00
Tim Schaub 0f998b4522 Link to the extent event instead of the extent event type 2019-04-28 16:36:33 -06:00
ahocevar 86fac0937b Set the interacting flag on pointerdrag instead of pointerdown 2019-04-19 09:42:12 -07:00
Frederic Junod 238fbca650 Add new maxDelta property to MouseWheelZoom constructor 2019-04-08 15:02:21 +02:00
ahocevar 070c1ec029 Resolve constraints for View#animate() API calls 2019-04-05 17:13:55 +02:00
Olivier Guyot 0f73f16cfa View / apply constraints when an interaction starts
Previously, an interaction could begin while target values
(center/resolution) were out of the allowed range, causing a
glitch where the view zoom/position would jump suddenly.
2019-04-05 11:55:35 +02:00
Olivier Guyot f67baa0dc0 Interactions / fix zoom level when a zoom interaction ends 2019-02-22 15:04:54 +01:00
Olivier Guyot 405e206717 View / better names for getValid* and applyParameters_ methods 2019-02-22 15:04:54 +01:00
Olivier Guyot 78e8f23df5 View / add getValidCenter method to improve interactions
The DragPan, KeyboardPan and DragZoom interactions now make sure to
animate to a valid center/resolution target to avoid
a chained "resolve" animation which looks weird.

The `View.fit` method was also fixed to use this.
2019-02-22 15:01:30 +01:00
Olivier Guyot 433bccd207 Linting and fixes for unit tests 2019-02-22 15:01:30 +01:00
Olivier Guyot ef6d17d817 View / add a 'smoothResolutionConstraint' options
When enabled (true by default), the resolution min/max values will be applied with
a smoothing effect for a better user experience.
2019-02-22 15:01:30 +01:00
Olivier Guyot e023c144bb View / add adjust* methods to manipulate the view more easily
API changes:
* (breaking) the `rotate` method is gone
* the `adjustRotation`, `adjustResolution` and `adjustZoom` methods are now
  available and allow using an anchor.

This means interactions do not have to do the anchor computation themselves
and this also fix anchor computation when constraints must be applied.
2019-02-22 15:01:30 +01:00
Olivier Guyot 49662b019c View / add a constrainResolution option
This introduces a breaking change.

This options replaces the various `constrainResolution` options on interactions
and the `fit` method.

Since constraints are now the responsibility of the View, the fact that intermediary
zoom levels are allowed or not is now set in the view options.

By default, the view resolution is unconstrained.
2019-02-22 15:01:30 +01:00
jahow 48ad1ffcbf View / implement a smooth rebound effect when a max extent is given
This is done by applying the center constraint differently when we're in the
middle of an interaction/animation or not.

When the view is moving, the center constraint will restrain the given value
in an "elastic" way, using a logarithmic function.

This can be disabled using the `smoothCenterConstrain` view parameter.
2019-02-22 15:01:30 +01:00
jahow cd186ada7f Add new tests for View & Interaction w/ fixes 2019-02-22 15:01:30 +01:00
Olivier Guyot a6f65df8c4 View / add a resolveConstraints method to end interactions
This will help making sure that the view will come back to a "rested" state
once the interactions are over.

Interactions no longer need to handle the animation back to a rested state,
they simply call `endInteraction` with the desired duration and direction.
2019-02-22 15:01:30 +01:00
jahow d991dfa54a View / remove constrainCenter method 2019-02-22 15:01:30 +01:00
jahow c2c1aa01d3 View / removed the constrainRotation method 2019-02-22 15:01:30 +01:00
Olivier Guyot e6c4b2ffd1 View / make the constrainResolution function private
Other classes should not need to worry about constraining the resolution
or not, as the View will eventually do this on its own.
2019-02-22 15:01:30 +01:00
Olivier Guyot 3c1e3779e2 View / add a method to compute a valid zoom level
The `getValidZoomLevel` apply the current resolution constraint to return
a value that is guaranteed valid.

This is used for interactions & controls which need a target value to work:
the +/- buttons, the zoom clider, the dragbox zoom and the mouse wheel zoom.
2019-02-22 15:01:30 +01:00
Olivier Guyot 4e1ece16ed View / implemented begin- and endInteraction methods 2019-02-22 15:01:30 +01:00
Frederic Junod 0b53a3229b Remove unneeded type cast 2019-02-04 09:58:49 +01:00
simonseyock c18a833880 event chain documentation 2019-01-28 20:50:33 +01:00
ahocevar 409c962caf Reset lastDragTime when condition is not met 2018-12-21 22:26:05 +01:00
Andreas Hocevar 6967e5b60b Merge pull request #9070 from ludvigeriksson/remove-point-return-value
Modify.removePoint returns true only when a vertex was removed
2018-12-18 21:57:02 +01:00
Ludvig Eriksson 412d9a9713 Modify.removePoint returns true only when a vertex was removed 2018-12-17 16:02:16 +01:00
Frederic Junod 701e19c1c9 Remove type cast in ol/interaction/Snap 2018-12-12 14:43:51 +01:00
Frédéric Junod bbbed30848 Merge pull request #9044 from openlayers/indent
Fix comments indentation
2018-12-07 13:06:27 +01:00
Frederic Junod 1be17e44a2 Fix comments indentation 2018-12-07 11:57:58 +01:00
Frederic Junod bade38ecc8 Change onBoxEnd property in DragBox options to optional 2018-12-07 09:17:34 +01:00
Niklas Alt 4bc9216e41 Add ': void' to non returning functions (error TS7014) 2018-12-06 19:57:45 +01:00
ahocevar 6cabb9dd0b Remove drag segments of removed features 2018-12-05 12:02:35 +01:00
Ludvig Eriksson a50fda5ac8 Call insertVertexCondition only when a vertex acually can be inserted 2018-12-04 09:55:31 +01:00
Frederic Junod 0189e8345d Remove WebGL references in comments 2018-11-16 14:05:06 +01:00
Frederic Junod 6d608c361a Simplify import path in ol/interaction/ 2018-11-05 16:26:45 +01:00
Frederic Junod 3746ba99cf Change target type from Element to HTMLElement
Same as the parent class type for `MousePosition` and the type returned by the
`getViewport` function.
2018-10-23 09:17:17 +02:00
Frederic Junod 041836c645 Change getUid return type from number to string 2018-10-17 10:22:53 +02:00
Andreas Hocevar 9285b283c0 Merge pull request #8787 from ahocevar/no-instanceof
Replace instanceof checks with other logic
2018-10-12 20:44:41 +02:00
ahocevar 9163558511 Replace instanceof checks with other logic 2018-10-12 20:35:59 +02:00
Frederic Junod 69dfbb9e54 Fix spelling 2018-10-08 08:30:10 +02:00
Kevin Schmidt 9d4821aafc Fix type check errors in ol/interaction/Snap 2018-10-03 11:20:56 -06:00
Kevin Schmidt 909869b8b9 Fix type check errors in ol/interaction/Extent 2018-10-03 06:35:18 -06:00
Kevin Schmidt 942a0976be Move interaction event handlers to class methods 2018-10-03 06:30:09 -06:00
ahocevar 9586c7cbc7 Get rid of private handler members 2018-10-03 05:06:01 -06:00
Kevin Schmidt 18570841d8 Move interaction event handlers to class methods 2018-10-03 05:06:01 -06:00
Andreas Hocevar 4ca75e2aab Merge pull request #8768 from schmidtk/ts-interaction-select
Fix type check errors in ol/interaction/Select
2018-10-03 11:10:50 +02:00
Andreas Hocevar 56f623337b Merge pull request #8764 from schmidtk/ts-interaction-draw
Fix TypeScript errors in ol/interaction/Draw
2018-10-03 11:07:59 +02:00
ahocevar 3f79edba67 Use setTimeout with any return type 2018-10-03 10:50:44 +02:00
Andreas Hocevar 2799f0c824 Merge pull request #8767 from schmidtk/ts-interaction-modify
Fix type check errors in ol/interaction/Modify
2018-10-03 10:33:50 +02:00