mirror of
https://github.com/XITRIX/NXKit.git
synced 2026-05-30 11:46:52 +00:00
UIBlurView improvement
This commit is contained in:
@@ -16,9 +16,14 @@ public:
|
||||
void setBlurValue(NXFloat blurValue);
|
||||
[[nodiscard]] NXFloat blurValue() const { return _blurValue; }
|
||||
|
||||
void setBackgroundTintColor(UIColor backgroundTintColor) { _backgroundTintColor = backgroundTintColor; }
|
||||
[[nodiscard]] UIColor backgroundTintColor() const { return _backgroundTintColor; }
|
||||
|
||||
std::optional<AnimatableProperty> value(std::string forKeyPath) override;
|
||||
|
||||
protected:
|
||||
void update(std::shared_ptr<CALayer> presentation, std::shared_ptr<CABasicAnimation> animation, float progress) override;
|
||||
UIColor _backgroundTintColor;
|
||||
|
||||
private:
|
||||
NXFloat _blurValue = 10;
|
||||
|
||||
@@ -12,6 +12,9 @@ public:
|
||||
void setBlurValue(NXFloat blurValue) { _blurLayer()->setBlurValue(blurValue); }
|
||||
[[nodiscard]] NXFloat blurValue() const { return _blurLayer()->blurValue(); }
|
||||
|
||||
void setBackgroundTintColor(UIColor backgroundTintColor) { _blurLayer()->setBackgroundTintColor(backgroundTintColor); }
|
||||
[[nodiscard]] UIColor backgroundTintColor() const { return _blurLayer()->backgroundTintColor(); }
|
||||
|
||||
private:
|
||||
std::shared_ptr<CABlurLayer> _blurLayer() const;
|
||||
};
|
||||
|
||||
@@ -40,7 +40,7 @@ void CABlurLayer::draw(SkCanvas* context) {
|
||||
context->saveLayer(slr);
|
||||
context->restore();
|
||||
|
||||
context->drawColor(0x40FFFFFF);
|
||||
context->drawColor(_backgroundTintColor.raw());
|
||||
context->restore();
|
||||
}
|
||||
|
||||
|
||||
@@ -155,6 +155,7 @@ void TestViewController::loadView() {
|
||||
blur->setFrame({ 80, 200, 240, 240 });
|
||||
rootView->addSubview(blur);
|
||||
blur->layer()->setCornerRadius(12);
|
||||
blur->setBackgroundTintColor(0x60DDDDDD);
|
||||
|
||||
blur->addSubview(dragMeViewLabel);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user