Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Values from interpolate-hcl can be negative #10054

Open
akre54 opened this issue Oct 27, 2020 · 1 comment
Open

Values from interpolate-hcl can be negative #10054

akre54 opened this issue Oct 27, 2020 · 1 comment
Labels

Comments

@akre54
Copy link

akre54 commented Oct 27, 2020

mapbox-gl-js version: v1.12.0

browser: Node, Chrome

Steps to Trigger Behavior

Create an expression using interpolate-hcl between red and white.

const {expression} = require('mapbox-gl/dist/style-spec')
expression.createExpression(['interpolate-hcl', ['linear'], 2 / 9, 0, 'red', 1, 'white'], {type: 'color'}).value.expression

Sometimes the values are negative. Perhaps this is due to floating point errors? I'm trying to create a map legend with 10 stops, so often the label value is 2/9, 4/9, etc.

Link to Demonstration

https://jsbin.com/boxanun/edit?html,output

Expected Behavior

Returned RGB values should be positive, in the range of 0..1.

Actual Behavior

RGB values can be negative

@akre54
Copy link
Author

akre54 commented Oct 28, 2020

Assuming relevant: d3/d3-color#39

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants