Fix opacity handling for tile and vector layers

This commit is contained in:
Andreas Hocevar
2021-09-15 19:18:04 +02:00
parent cb6995d71a
commit 2f5e6906b9
5 changed files with 31 additions and 12 deletions
+8
View File
@@ -114,3 +114,11 @@ export const getFontParameters = function (fontSpec) {
style.families = style.family.split(/,\s?/);
return style;
};
/**
* @param {number} opacity Opacity (0..1).
* @return {string} CSS opacity.
*/
export function cssOpacity(opacity) {
return opacity === 1 ? '' : String(Math.round(opacity * 100) / 100);
}