1- import { type Container , type IEffectDrawer , type IShapeDrawData } from "@tsparticles/engine" ;
1+ import { type Container , type IEffectDrawer , type IShapeDrawData , isNull } from "@tsparticles/engine" ;
22import type { FilterParticle } from "./FilterParticle.js" ;
33import type { IFilterData } from "./IFilterData.js" ;
44
@@ -15,27 +15,27 @@ export class FilterDrawer implements IEffectDrawer<FilterParticle> {
1515 context . save ( ) ;
1616
1717 const blurValue = typeof particle . filterBlur === "number" ? `${ particle . filterBlur } px` : particle . filterBlur ,
18- blurString = blurValue ? `blur(${ blurValue } )` : "" ,
1918 brightnessValue = particle . filterBrightness ,
20- brightnessString = brightnessValue ? `brightness(${ brightnessValue } )` : "" ,
2119 contrastValue = particle . filterContrast ,
22- contrastString = contrastValue ? `contrast(${ contrastValue } )` : "" ,
2320 dropShadowValue = particle . filterDropShadow ,
24- dropShadowString = dropShadowValue ? "drop-shadow(dropShadowValue)" : "" ,
2521 grayscaleValue = particle . filterGrayscale ,
26- grayscaleString = grayscaleValue ? `grayscale(${ grayscaleValue } )` : "" ,
2722 hueRotateValue =
2823 typeof particle . filterHueRotate === "number" ? `${ particle . filterHueRotate } deg` : particle . filterHueRotate ,
29- hueRotateString = hueRotateValue ? `hue-rotate(${ hueRotateValue } )` : "" ,
3024 invertValue = particle . filterInvert ,
31- invertString = invertValue ? `invert(${ invertValue } )` : "" ,
3225 opacityValue = particle . filterOpacity ,
33- opacityString = opacityValue ? `opacity(${ opacityValue } )` : "" ,
3426 saturateValue = particle . filterSaturate ,
35- saturateString = saturateValue ? `saturate(${ saturateValue } )` : "" ,
3627 sepiaValue = particle . filterSepia ,
37- sepiaString = sepiaValue ? `sepia(${ sepiaValue } )` : "" ,
3828 urlValue = particle . filterUrl ,
29+ blurString = blurValue ? `blur(${ blurValue } )` : "" ,
30+ brightnessString = isNull ( brightnessValue ) ? "" : `brightness(${ brightnessValue } )` ,
31+ contrastString = isNull ( contrastValue ) ? "" : `contrast(${ contrastValue } )` ,
32+ dropShadowString = dropShadowValue ? `drop-shadow(${ dropShadowValue } )` : "" ,
33+ grayscaleString = isNull ( grayscaleValue ) ? "" : `grayscale(${ grayscaleValue } )` ,
34+ hueRotateString = isNull ( hueRotateValue ) ? "" : `hue-rotate(${ hueRotateValue } )` ,
35+ invertString = isNull ( invertValue ) ? "" : `invert(${ invertValue } )` ,
36+ opacityString = isNull ( opacityValue ) ? "" : `opacity(${ opacityValue } )` ,
37+ saturateString = isNull ( saturateValue ) ? "" : `saturate(${ saturateValue } )` ,
38+ sepiaString = isNull ( sepiaValue ) ? "" : `sepia(${ sepiaValue } )` ,
3939 urlString = urlValue ? `url(${ urlValue } )` : "" ;
4040
4141 context . filter =
0 commit comments