coerce opacity to valid value

This commit is contained in:
Thomas Neirynck 2016-09-23 13:09:31 -04:00
parent b02bbad6c8
commit 8d10852a73

View file

@ -235,7 +235,7 @@ export default function DispatchClass(Private, config) {
$('[data-label]', element.parentNode)
.css('opacity', 1)//Opacity 1 is needed to avoid the css application
.not((els, el) => `${$(el).data('label')}` === label)
.css('opacity', dimming);
.css('opacity', justifyOpacity(dimming));
}
/**
@ -311,5 +311,11 @@ export default function DispatchClass(Private, config) {
}
function justifyOpacity(opacity) {
const decimalNumber = parseFloat(opacity, 10);
return (0 <= decimalNumber && decimalNumber <= 1) ? decimalNumber : 0.5;
}
return Dispatch;
};