Closed marksmall closed 4 years ago
Figured it out, it's to do with properties, when drawing, the property radiusMetric
for instance exists, but when inactive, the feature has user_radiusMetric
. This seems like a design flaw on my part, therefore closing this issue.
mapbox-gl-js version: 1.3.0 mapbox-gl-draw version: 1.1.2
I've experienced this problem for at least a year, with other version combinations.
Steps to Trigger Behavior
RadiusMode
(seeradius.js
below, I've also included theme.js for completeness)draw_line
also creates aPoint
feature (for text) and aPolygon
feature to represent the circle. While drawing, the measurement text is visible.Expected Behavior
I expect the line,circle and text to all be retained once drawn finishes.
Actual Behavior
Line and circle retained, but text disappears. You can see the relevant code below. I initially thought it might be to do with
hot/cold
features, but I added another layer and updated thefilters
to check if the feature wasactive
or not, but it made no difference.I have managed to get this to work in a very hacky way.
symbol
source/layer to map.draw.render
function to retrieve all features and for each type handled, Point, Polygon etc create a new feature from all features.setData
function.This solution just feels wrong, if the text is rendered while drawing, I don't see why it isn't rendered when drawing completes. I'm sure I'm missing something, just can't put my finger exactly on what
Code
Radius
theme.js