Skip to content

Generate collision circles in foreground #5474

@ChrisLoer

Description

@ChrisLoer

This is a follow-up to PR #5150.

We currently generate "collision circle" geometry in the background using tile coordinates (in collision_feature.js). After #5150, most collision detection logic is run in the foreground using viewport coordinates. At render time, we figure out how much space a label will take up, and then decide which of the pre-generated collision circles to use based on how far the edges of the label are from the label anchor. This step is awkward and relies on an approximation to convert back from "viewport unit distance" to "tile unit distance".

It would be cleaner to generate the collision circle geometry on the fly at render time, using viewport coordinates. Ideally we could do the circle generation at the same time we were calling placeFirstAndLastGlyph, although there are some challenges to deal with (the "label plane" used for glyph placement is not necessarily the same as the viewport plane, so some extra projection might be necessary).

/cc @ansis @anandthakker

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions