adapt debug boundary with text, date, time picker and select

Signed-off-by: xiexiyun <xiexiyun@huawei.com>
Change-Id: I5edb573b110bb910969a56152be7d24dad4155fa
This commit is contained in:
xiexiyun
2022-04-28 20:53:36 +08:00
parent 3b6b32c414
commit 0aca2fa7c8
6 changed files with 33 additions and 6 deletions
@@ -61,6 +61,16 @@ void FlutterRenderOption::PaintBackground(RenderContext& context, const Offset&
canvas->drawPath(path.get(), paint, paintData);
paint.paint()->setColor(GetEventEffectColor().GetValue());
canvas->drawPath(path.get(), paint, paintData);
if (SystemProperties::GetDebugBoundaryEnabled()) {
// auto skCanvas = AceType::DynamicCast<FlutterRenderContext>(&context)->GetCanvas();
auto skCanvas = canvas->canvas();
if (skCanvas == nullptr) {
LOGE("Paint canvas is null.");
return;
}
DebugBoundaryPainter::PaintDebugBoundary(skCanvas, offset, GetLayoutSize());
DebugBoundaryPainter::PaintDebugCorner(skCanvas, offset, GetLayoutSize());
}
}
void FlutterRenderOption::PaintLine(RenderContext& context, const Offset& offset)
@@ -16,6 +16,7 @@
#ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_OPTION_FLUTTER_RENDER_OPTION_H
#define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_OPTION_FLUTTER_RENDER_OPTION_H
#include "core/components/common/painter/debug_boundary_painter.h"
#include "core/components/option/render_option.h"
namespace OHOS::Ace {
@@ -69,6 +69,14 @@ void RosenRenderOption::PaintBackground(RenderContext& context, const Offset& of
canvas->drawPath(path, paint);
paint.setColor(GetEventEffectColor().GetValue());
canvas->drawPath(path, paint);
if (SystemProperties::GetDebugBoundaryEnabled()) {
if (canvas == nullptr) {
LOGE("Paint canvas is null.");
return;
}
DebugBoundaryPainter::PaintDebugBoundary(canvas, offset, GetLayoutSize());
DebugBoundaryPainter::PaintDebugCorner(canvas, offset, GetLayoutSize());
}
}
void RosenRenderOption::PaintLine(RenderContext& context, const Offset& offset)
@@ -16,6 +16,7 @@
#ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_OPTION_ROSEN_RENDER_OPTION_H
#define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_OPTION_ROSEN_RENDER_OPTION_H
#include "core/components/common/painter/debug_boundary_painter.h"
#include "core/components/option/render_option.h"
namespace OHOS::Ace {
@@ -71,6 +71,10 @@ void PickerOptionComponent::Initialize()
if (isRtl) {
boxComponent_->SetAlignment(Alignment::CENTER_RIGHT);
}
if (SystemProperties::GetDebugBoundaryEnabled()) {
boxComponent_->SetEnableDebugBoundary(true);
}
SetChild(boxComponent_);
}
@@ -310,13 +310,16 @@ bool SelectPopupComponent::Initialize(const RefPtr<AccessibilityManager>& manage
AceType::MakeRefPtr<ColumnComponent>(FlexAlign::FLEX_START, FlexAlign::FLEX_START, children);
RefPtr<ScrollComponent> scroll = AceType::MakeRefPtr<ScrollComponent>(column);
RefPtr<BoxComponent> innerBox = InitializeInnerBox(scroll);
RefPtr<ClipComponent> innerClip = AceType::MakeRefPtr<ClipComponent>(innerBox);
innerClip->SetTopLeftRadius(Radius(ROUND_RADIUS_PHONE));
innerClip->SetTopRightRadius(Radius(ROUND_RADIUS_PHONE));
innerClip->SetBottomLeftRadius(Radius(ROUND_RADIUS_PHONE));
innerClip->SetBottomRightRadius(Radius(ROUND_RADIUS_PHONE));
RefPtr<Decoration> decoration = AceType::MakeRefPtr<Decoration>();
Border border;
border.SetBorderRadius(Radius(ROUND_RADIUS_PHONE));
decoration->SetBorder(border);
innerBox->SetBackDecoration(decoration);
RefPtr<BoxComponent> box = AceType::MakeRefPtr<BoxComponent>();
if (SystemProperties::GetDebugBoundaryEnabled()) {
box->SetEnableDebugBoundary(true);
}
box->SetDeliverMinToChild(false);
if (!IsTV()) {
RefPtr<Decoration> back = AceType::MakeRefPtr<Decoration>();
@@ -326,7 +329,7 @@ bool SelectPopupComponent::Initialize(const RefPtr<AccessibilityManager>& manage
box->SetBackDecoration(back);
box->SetPadding(Edge(IN_OUT_BOX_INTERVAL));
}
box->SetChild(innerClip);
box->SetChild(innerBox);
auto tweenId = TweenComponent::AllocTweenComponentId();
RefPtr<TweenComponent> tween = AceType::MakeRefPtr<TweenComponent>(tweenId, tweenId);