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

Stops vs Literal value: Icon size is different for same value. #7066

Closed
bewithjonam opened this issue Aug 1, 2018 · 7 comments · Fixed by #7125
Closed

Stops vs Literal value: Icon size is different for same value. #7066

bewithjonam opened this issue Aug 1, 2018 · 7 comments · Fixed by #7125
Labels

Comments

@bewithjonam
Copy link

bewithjonam commented Aug 1, 2018

Symbol layer with

   "icon-size": 0.27,
   "icon-size": {
      type: 'interval',
      default: iconSize,
      property: "__resize_by__",
      stops: [[0, iconSize]]
    },

are rendering images at different size.

jsfiddle jsfiddle explaining the issue. In the fiddle I render a icon
at size 0.27 and then after 2 seconds I set the same size using stops.

Expected Behavior

It should render with the same size

Actual Behavior

When using stops, it is rendering smaller than when given a literal value

@mourner
Copy link
Member

mourner commented Aug 1, 2018

Your JSFiddle doesn't seem to work — I see no icons on the map there.

@bewithjonam
Copy link
Author

bewithjonam commented Aug 1, 2018

@mourner
New jsfiddle with a large png, showing the issue.

https://jsfiddle.net/bewithjonam/Lf1prz26/12/

If I am not wrong, the issue happens only on decimal icon-sizes. And the previous image that i used from the sprite was very small.

@zoltan-mihalyi
Copy link
Contributor

I think the same problem causes my issue: #7017

@jfirebaugh
Copy link
Contributor

Yes, this has the same underlying cause as #7017: to minimize vertex buffer memory, data-driven icon-size values are packed into a Uint16 vertex attribute component with a precision limit of 0.1 (the floating point value is multiplied by 10 when populating the vertex array, converted to an integer, and divided by 10 in the shader).

@ChrisLoer @ansis Should we just switch a_data to use Float32?

@ansis
Copy link
Contributor

ansis commented Aug 2, 2018

Float32 is an option but we could also just multiply and divide by 256 instead if we don't want to use more bytes per vertex. We don't really have any memory benchmarks right now so this is hard to measure how significant the change would be

@bewithjonam
Copy link
Author

I removed the jsfiddle accidently. Here is an equivalent one: http://jsfiddle.net/bewithjonam/41g8jwco/

@zoltan-mihalyi
Copy link
Contributor

Is it possible to use 256 instead of 10?

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

Successfully merging a pull request may close this issue.

5 participants