mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2025-01-09 02:11:26 +00:00
!33896 解决slider设置了contentModifier后slider的宽度和高度变成0问题和Slider自定义builder切换undefined问题
Merge pull request !33896 from yangziyong/sliderBuilderBug
This commit is contained in:
commit
33f6e1aaf6
@ -826,6 +826,9 @@ void SliderContentModifier::SetBlockShape(const RefPtr<BasicShape>& shape)
|
||||
|
||||
void SliderContentModifier::UpdateContentDirtyRect(const SizeF& frameSize)
|
||||
{
|
||||
if (useContentModifier_->Get()) {
|
||||
return;
|
||||
}
|
||||
auto pipeline = PipelineBase::GetCurrentContext();
|
||||
CHECK_NULL_VOID(pipeline);
|
||||
auto theme = pipeline->GetTheme<SliderTheme>();
|
||||
|
@ -187,7 +187,6 @@ void SliderLayoutAlgorithm::Layout(LayoutWrapper* layoutWrapper)
|
||||
CHECK_NULL_VOID(pattern);
|
||||
if (pattern->UseContentModifier()) {
|
||||
BoxLayoutAlgorithm::Layout(layoutWrapper);
|
||||
host->GetGeometryNode()->Reset();
|
||||
return;
|
||||
}
|
||||
PerformLayout(layoutWrapper);
|
||||
|
@ -200,9 +200,6 @@ void SliderPattern::OnWindowSizeChanged(int32_t width, int32_t height, WindowSiz
|
||||
|
||||
void SliderPattern::InitClickEvent(const RefPtr<GestureEventHub>& gestureHub)
|
||||
{
|
||||
if (UseContentModifier()) {
|
||||
return;
|
||||
}
|
||||
if (clickListener_) {
|
||||
return;
|
||||
}
|
||||
@ -214,6 +211,10 @@ void SliderPattern::InitClickEvent(const RefPtr<GestureEventHub>& gestureHub)
|
||||
void SliderPattern::InitTouchEvent(const RefPtr<GestureEventHub>& gestureHub)
|
||||
{
|
||||
if (UseContentModifier()) {
|
||||
if (touchEvent_) {
|
||||
gestureHub->RemoveTouchEvent(touchEvent_);
|
||||
touchEvent_ = nullptr;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (touchEvent_) {
|
||||
@ -694,6 +695,13 @@ void SliderPattern::InitPanEvent(const RefPtr<GestureEventHub>& gestureHub)
|
||||
|
||||
void SliderPattern::InitOnKeyEvent(const RefPtr<FocusHub>& focusHub)
|
||||
{
|
||||
if (UseContentModifier()) {
|
||||
focusHub->SetInnerFocusPaintRectCallback(nullptr);
|
||||
focusHub->SetOnKeyEventInternal(nullptr);
|
||||
focusHub->SetOnFocusInternal(nullptr);
|
||||
focusHub->SetOnBlurInternal(nullptr);
|
||||
return;
|
||||
}
|
||||
auto getInnerPaintRectCallback = [wp = WeakClaim(this)](RoundRect& paintRect) {
|
||||
auto pattern = wp.Upgrade();
|
||||
CHECK_NULL_VOID(pattern);
|
||||
@ -927,6 +935,14 @@ bool SliderPattern::MoveStep(int32_t stepCount)
|
||||
void SliderPattern::InitMouseEvent(const RefPtr<InputEventHub>& inputEventHub)
|
||||
{
|
||||
if (UseContentModifier()) {
|
||||
if (hoverEvent_) {
|
||||
inputEventHub->RemoveOnHoverEvent(hoverEvent_);
|
||||
hoverEvent_ = nullptr;
|
||||
}
|
||||
if (mouseEvent_) {
|
||||
inputEventHub->RemoveOnMouseEvent(mouseEvent_);
|
||||
mouseEvent_ = nullptr;
|
||||
}
|
||||
return;
|
||||
}
|
||||
auto hoverEvent = [weak = WeakClaim(this)](bool isHover) {
|
||||
|
@ -142,6 +142,9 @@ public:
|
||||
return;
|
||||
}
|
||||
makeFunc_ = std::move(makeFunc);
|
||||
if (sliderContentModifier_) {
|
||||
sliderContentModifier_->SetUseContentModifier(true);
|
||||
}
|
||||
}
|
||||
|
||||
bool UseContentModifier()
|
||||
|
Loading…
Reference in New Issue
Block a user