mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-11-23 15:10:30 +00:00
!44076 【收编】button--修复用户将shadow设置为异常值,还存在阴影的问题
Merge pull request !44076 from zhangwenbin00001/button_0919
This commit is contained in:
commit
14b0b8b805
@ -387,6 +387,7 @@ void ButtonPattern::OnModifyDone()
|
||||
renderContext_ = host->GetRenderContext();
|
||||
layoutProperty_ = GetLayoutProperty<ButtonLayoutProperty>();
|
||||
buttonTheme_ = pipeline_->GetTheme<ButtonTheme>();
|
||||
shadow_ = Shadow::CreateShadow(static_cast<ShadowStyle>(buttonTheme_->GetShadowNormal()));
|
||||
HandleBorderAndShadow();
|
||||
HandleFocusStatusStyle();
|
||||
if (pipeline_->GetIsFocusActive()) {
|
||||
@ -580,11 +581,10 @@ void ButtonPattern::HandleBorderAndShadow()
|
||||
if (shadowStyle != ShadowStyle::None) {
|
||||
auto&& graphics = renderContext_->GetOrCreateGraphics();
|
||||
CHECK_NULL_VOID(graphics);
|
||||
if ((!graphics->HasBackShadow() ||
|
||||
IsDynamicSwitchButtonStyle(graphics->GetBackShadowValue())) && isApplyShadow_) {
|
||||
Shadow shadow = Shadow::CreateShadow(
|
||||
if ((!graphics->HasBackShadow() || graphics->GetBackShadowValue() == shadow_) && isApplyShadow_) {
|
||||
shadow_ = Shadow::CreateShadow(
|
||||
buttonStyle == ButtonStyleMode::TEXT ? ShadowStyle::None : shadowStyle);
|
||||
renderContext_->UpdateBackShadow(shadow);
|
||||
renderContext_->UpdateBackShadow(shadow_);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -410,15 +410,6 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IsDynamicSwitchButtonStyle(const Shadow& shadow)
|
||||
{
|
||||
ShadowStyle shadowStyle = static_cast<ShadowStyle>(buttonTheme_->GetShadowNormal());
|
||||
if (shadow == Shadow::CreateShadow(ShadowStyle::None) || shadow == Shadow::CreateShadow(shadowStyle)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected:
|
||||
bool IsNeedInitClickEventRecorder() const override
|
||||
{
|
||||
@ -449,6 +440,7 @@ private:
|
||||
RefPtr<ButtonLayoutProperty>& layoutProperty, RefPtr<TextLayoutProperty>& textLayoutProperty);
|
||||
static bool NeedAgingUpdateText(RefPtr<ButtonLayoutProperty>& layoutProperty);
|
||||
bool IsNeedToHandleHoverOpacity();
|
||||
Shadow shadow_;
|
||||
Color backgroundColor_;
|
||||
Color focusBorderColor_;
|
||||
Color themeBgColor_;
|
||||
|
Loading…
Reference in New Issue
Block a user