Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Circles (part 1)

Description

Implements circles

Screenshots

Technical details

When using Circle in Mapbox / MapLibre, its size can only be specified in pixels, not in meters: https://github.com/mapbox/mapbox-gl-native/issues/4312#issuecomment-466420652

Therefore, approximate the circle using a polygon. Use the Turf library to generate an approximation.

A workaround for the issue that looks like https://github.com/mapbox/mapbox-gl-js/issues/11235 is implemented.

TODO: Implement stroke pattern. For this some changes to org.maplibre.gl:android-plugin-annotation-v9 are necessary. some messy code is necessary, to be implemented in part 2.

Tests

  1. Long-clicking on map adds a circle.
  2. Circles reflect hue and opacity from the sliders at the top.
  3. Circles storkes reflect hue and stroke width from the sliders at the top.
  4. A circle that spans across either north or south pole does not draw an incorrect horizontal line (see GH issue linked above). It is expected not to fill, Google Maps would also not fill it according to docs.

Note: Dragging the marker crashes the app. When a marker is dragged, the sample app wants to update the circle, so the source is changed by the annotation plugin to reflect the changed radius. This means that the marker is re-inserted to the map by the annotation plugin. This means that the drag is stopped. This means that the app wants to update the circle, so the source is changed by the annotation plugin. … Possible workaround is delaying the drag callbacks to next UI draw, however this still makes dragging very laggy. This is however not really related to this MR and needs separate fixing of dragging functionality (!57 (merged) fixes other issues, not this one – it doesn't make it worse).

Note: stroke pattern cannot be picked yet. Not yet implemented as stated above.

Issues

10 commandments of code reviews

👪 https://gitlab.e.foundation/internal/wiki/-/wikis/development/code-review

Edited by Fynn Godau

Merge request reports

Loading