Small refactoring

This commit is contained in:
Antoine Mercadal committed 2015-08-13 21:29:33 -07:00
1 parent 7be2325a95
commit 6bf6f82cad
1 file changed
+6 -18
+6 -18
View File
@@ -119,28 +119,16 @@ CPVisualEffectStateInactive = 2;
- (void)_setEffectEnabled:(BOOL)shouldEnable
{
var dark = [[self appearance] isEqual:[CPAppearance appearanceNamed:CPAppearanceNameVibrantDark]],
darkColor = [CPColor colorWithHexString:@"1e1e1e"],
lightColor = [CPColor whiteColor],
prop;
prop = CPBrowserStyleProperty("backdrop-filter"),
color = (dark ? [CPColor colorWithHexString:@"1e1e1e"] : [CPColor whiteColor]),
finalColor = shouldEnable ? [color colorWithAlphaComponent:0.6] : color;
[self setBackgroundColor:finalColor];
#if PLATFORM(DOM)
prop = CPBrowserStyleProperty("backdrop-filter");
self._DOMElement.style[prop] = shouldEnable ? "blur(30px)" : nil;
#endif
if (shouldEnable)
{
if (prop)
self._DOMElement.style[prop] = "blur(30px)";
[self setBackgroundColor:[(dark ? darkColor : lightColor) colorWithAlphaComponent:0.6]];
}
else
{
if (prop)
self._DOMElement.style[prop] = nil;
[self setBackgroundColor:(dark ? darkColor : lightColor)];
}
}
- (void)_applyVibrancyState