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

setColor public method for Icon styles #15670

Open
danw-mpl opened this issue Mar 26, 2024 · 2 comments
Open

setColor public method for Icon styles #15670

danw-mpl opened this issue Mar 26, 2024 · 2 comments

Comments

@danw-mpl
Copy link

I'd like to have a setColor public method on an Icon image associated with a Style so I can make use of traditional style caching approaches with dynamic data.

For example;
myStyle.getImage()?.setColor('rgb(200, 200, 200)')

@ahocevar
Copy link
Member

Style caching would be inefficient here, because setColor() would mean to recreate the icon image internally.

There is a style icon cache, it is only very small. You can increase it though: https://openlayers.org/en/latest/apidoc/module-ol_style_IconImageCache-IconImageCache.html#setSize

import { shared as iconCache } from `ol/style/IconImageCache.js`;
iconCache.setSize(1024);

@danw-mpl
Copy link
Author

Fair enough. I'm actually using style 'caching' to avoid redrawing the style on every pan/zoom which causes significant declutter flickering.

So ignoring the caching topic, I'd still be interested in a setColor().

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

No branches or pull requests

2 participants