Open karlTGA opened 5 years ago
When the GeoJSON source is added to the map at https://github.com/mapbox/mapbox-gl-draw/blob/5b2280817c901d93b05c937a7bdb2efb8afefe0c/src/setup.js#L84-L99 you need to use 'lineMetrics: true'.
Mapbox GL Draw could probably provide an option for this so you can easily enable it.
Aha ok.
Maybe you can add an optional parameter to the add
function and give the options to mapbox through.
add(geojson: Object, options?: Object)
So every special option is useable.
mapbox-gl-js version: 0.52 mapbox-gl-draw version: 1.1.1
Steps to Trigger Behavior
Expected Behavior
Get a nice line with a gradient from green to red.
Actual Behavior
Get an error message: Error: layers.gl-draw-line-static-gradient.cold: layer "gl-draw-line-static-gradient.cold" specifies a line-gradient, which requires a GeoJSON source with)
at Object.addLayers (setup.js:101)
at r.connect (setup.js:35)
at r.ht.fire (mapbox-gl.js:29)
lineMetrics
enabled. at Object.Jr [as emitValidationErrors] (mapbox-gl.js:29) at De (mapbox-gl.js:33) at i._validate (mapbox-gl.js:33) at i.addLayer (mapbox-gl.js:33) at r.addLayer (mapbox-gl.js:33) at ctx.options.styles.forEach.style (setup.js:102) at Array.forEach (