Commit Graph

280 Commits

Author SHA1 Message Date
Andreas Hocevar cc21f92bdb Restore test coverage, fix tests 2020-02-05 13:03:21 +01:00
David Brooks 03fcf1ca70 Get all mouse wheel tests passing (#9564). 2020-02-05 11:27:10 +01:00
David Brooks 77658e5750 Ensure changes to zoom wheel handling pass tests. 2020-02-05 11:24:48 +01:00
Matt Walker eeec2b9e7d Lint: remove unused imports 2020-01-13 11:32:40 +00:00
Matt Walker 5ce532e3e4 Mock PointerEvent in tests to include target
The `target` Event property is readonly as it is set internally when an
event is dispatched. This change uses a plain object with the essential
properties that a PointerEvent has which is sufficent for map event handling
2020-01-13 10:46:40 +00:00
Andreas Hocevar 8e0a8114d7 Merge pull request #10340 from mike-000/patch-7
Draw circles and custom geometry in user coordinates
2019-12-11 10:07:12 +01:00
mike-000 2e544cb677 Circles and custom geometry in user coordinates
Pass the view projection to the geometry function so circles and other custom geometry can be given the expected shape/size in the view while being defined in user coordinates.

Add tests to draw circles in a user projection and along both axes
Draw regular polygon in a user projection
Draw box in a user projection
2019-12-10 19:47:37 +00:00
Andreas Hocevar 8911b96d3c Do not preventDefault on pointerdown 2019-12-10 12:25:23 +01:00
Greg Gianforcaro 6bada6ab98 Add test modifying circle with snap enabled 2019-11-23 16:11:27 -05:00
Frédéric Junod 9478cb1945 Merge pull request #10283 from fredj/targetNotEditable
Use the originalEvent in the targetNotEditable condition
2019-11-12 08:24:20 +01:00
Frederic Junod fc7cb5cd51 Use the originalEvent in the targetNotEditable condition 2019-11-11 14:41:39 +01:00
Frederic Junod 51c9b56254 Remove all the sketch features in abortDrawing 2019-11-06 14:18:55 +01:00
Tim Schaub 7c8b2215d4 Remove unused code 2019-09-29 07:05:48 -06:00
Tim Schaub d2b25533c2 Use the same spelling used elsewhere 2019-09-29 07:37:45 -05:00
Tim Schaub 3b02f5597e Remove called assert extension 2019-09-28 18:55:38 +02:00
Tim Schaub a996d62d46 Test snap with geographic coordinates 2019-09-27 14:12:10 +02:00
Tim Schaub 53e2f432e7 Confirm zoomByDelta calls view.animate() 2019-09-26 18:30:16 +02:00
Tim Schaub 5d4e77151c Handle event coordinate in the user projection 2019-09-26 17:24:58 +02:00
Tobias Kohr 347f5df32e Fix some cosmetics on Select interaction 2019-09-25 17:34:26 +02:00
Tobias Kohr 2ccaed0ace Add back Select interaction without Overlay 2019-09-25 16:37:28 +02:00
Tobias Kohr 38124d770b Revert delete Select interaction commit 3838b68427 2019-09-25 16:37:28 +02:00
Tim Schaub 3c38a38570 Merge pull request #9961 from KlausBenndorf/remove-select-interaction
SelectInteraction removal
2019-09-24 10:27:20 +02:00
Simon Seyock 3838b68427 Removed SelectInteraction 2019-09-24 10:12:30 +02:00
Tim Schaub c03c359a20 Separate internal and API methods for the view 2019-09-21 11:30:14 -06:00
ahocevar ebfb20440a Simplify events and store listeners only in one place 2019-09-04 16:48:43 +02:00
ahocevar d416866108 Use pointer events everywhere 2019-08-31 23:40:11 +02:00
ahocevar 74e8e013cf Use pepjs instead of our own pointerevent polyfill 2019-08-29 18:58:53 +02:00
André Garneau 7817cf31c6 Changes following code review
Add a type for FilterFunction and add tests for filter option.
2019-06-04 17:45:28 -04:00
ahocevar 070c1ec029 Resolve constraints for View#animate() API calls 2019-04-05 17:13:55 +02:00
Olivier Guyot 405e206717 View / better names for getValid* and applyParameters_ methods 2019-02-22 15:04:54 +01:00
Olivier Guyot 433bccd207 Linting and fixes for unit tests 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
jahow cd186ada7f Add new tests for View & Interaction w/ fixes 2019-02-22 15:01:30 +01:00
Olivier Guyot 1c5fd62e43 View / refactor how zoom and resolution are computed
This commit aims to simplify the computation of zoom and resolution in the
View class.

Previously zoom levels and resolution computations were mixed in different places,
ie resolution constraints, initial values, etc.

Now the View class only has the `getZoomForResolution` and `getResolutionForZoom`
methods to convert from one system to another.

Other than that, most computations use the resolution system internally.

The `constrainResolution` method also does not exist anymore, and is replaced
by `getValidResolution` and `getValidZoomLevel` public methods.
2019-02-22 15:01:30 +01:00
Olivier Guyot 1f379a06a4 View / add support for viewport extent constraint
This introduces a breaking change:

The `extent` view option now constrains the whole viewport and not just the
view center.
The option `constrainOnlyCenter` was added to keep the previous behaviour.

Constraining the whole viewport and not only the view center means
that the center and resolution constraints must be applied with a knowledge of
the viewport size.
2019-02-22 15:01:30 +01:00
ahocevar 409c962caf Reset lastDragTime when condition is not met 2018-12-21 22:26:05 +01:00
ahocevar 6cabb9dd0b Remove drag segments of removed features 2018-12-05 12:02:35 +01:00
Kevin Schmidt 07349de59b Add tests for interaction event handlers 2018-10-03 06:59: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
ahocevar 8ab1589f9a Add getOverlay method to access sketch and selection layers 2018-08-15 10:59:38 +02:00
ahocevar c74b9c1d55 Do not prevent default on pointermove
Instead, only prevent default on handled pointerdown events. This makes 
the `focus` condition work with interactions that involve dragging on 
touch devices.
2018-07-31 08:33:15 +02:00
Tim Schaub 40486a0ecc Avoid shadowing EventTarget 2018-07-26 10:14:58 -06:00
ahocevar 45cf296ed4 Simplify calculation and add tests 2018-07-21 10:22:42 +02:00
Tim Schaub b8c9125602 Remove lint 2018-07-18 10:35:54 -06:00
ahocevar 0a126b620c Use class keyword in tests 2018-07-18 16:30:09 +02:00
ahocevar e52cabcb31 Fix DragZoom tests 2018-07-18 15:41:13 +02:00
Frederic Junod 35158efbf0 Fix spelling 2018-03-12 15:18:58 +01:00
Tim Schaub 1404e9d61d Remove remaining static members from Interaction 2018-02-25 12:46:57 -07:00
Tim Schaub 3f944ef76e Remove static members from Modify 2018-02-25 09:18:44 -07:00