mirror of
https://github.com/openharmony/ace_ace_engine.git
synced 2026-07-18 20:54:27 -04:00
修改inspector属性显示问题
Signed-off-by: peter <zhuzijia@huawei.com> Change-Id: I4529148961f4c03fb60b9ed853377e92d2e08bf9
This commit is contained in:
@@ -84,6 +84,7 @@ void RenderNavigationContainer::Update(const RefPtr<Component>& component)
|
||||
hideNavigationToolBar_ = declaration->hideToolbar;
|
||||
titleMode_ = declaration->titleMode;
|
||||
toolBarItems_ = declaration->toolbarItems;
|
||||
menuItems_ = declaration->menuItems;
|
||||
}
|
||||
|
||||
} // namespace OHOS::Ace
|
||||
|
||||
@@ -73,6 +73,11 @@ public:
|
||||
return toolBarItems_;
|
||||
}
|
||||
|
||||
const std::list<RefPtr<ToolBarItem>>& GetMenuItems()
|
||||
{
|
||||
return menuItems_;
|
||||
}
|
||||
|
||||
private:
|
||||
RefPtr<RenderCollapsingNavigationBar> collapsingNavigationBar_;
|
||||
std::string title_;
|
||||
@@ -82,6 +87,7 @@ private:
|
||||
bool hideNavigationToolBar_ = false;
|
||||
NavigationTitleMode titleMode_ = NavigationTitleMode::MINI;
|
||||
std::list<RefPtr<ToolBarItem>> toolBarItems_;
|
||||
std::list<RefPtr<ToolBarItem>> menuItems_;
|
||||
};
|
||||
|
||||
} // namespace OHOS::Ace
|
||||
|
||||
@@ -244,7 +244,7 @@ void RenderSwiper::Update(const RefPtr<Component>& component)
|
||||
animationOpacity_ = swiper->IsAnimationOpacity();
|
||||
duration_ = swiper->GetDuration();
|
||||
showIndicator_ = swiper->IsShowIndicator();
|
||||
|
||||
cachedCount_ = swiper->GetCachedSize();
|
||||
lazyLoadCacheSize_ = swiper->GetCachedSize() * 2 + swiper->GetDisplayCount();
|
||||
auto lazyComponent = swiper->GetLazyForEachComponent();
|
||||
UpdateItemCount(lazyComponent ? static_cast<int32_t>(lazyComponent->TotalCount()) : itemCount_);
|
||||
|
||||
@@ -299,6 +299,11 @@ public:
|
||||
return axis_ == Axis::VERTICAL;
|
||||
}
|
||||
|
||||
int32_t GetCachedCount() const
|
||||
{
|
||||
return cachedCount_;
|
||||
}
|
||||
|
||||
bool RefuseUpdatePosition(int32_t index);
|
||||
void OnPaintFinish() override;
|
||||
protected:
|
||||
@@ -540,6 +545,7 @@ private:
|
||||
MainSwiperSize mainSwiperSize_ = MainSwiperSize::MAX;
|
||||
double prevMargin_ = 0.0;
|
||||
double nextMargin_ = 0.0;
|
||||
int32_t cachedCount_ = -1;
|
||||
|
||||
// need timer for auto play
|
||||
RefPtr<Scheduler> scheduler_;
|
||||
|
||||
@@ -27,6 +27,7 @@ const std::unordered_map<std::string, std::function<std::string(const ColumnComp
|
||||
{ "alignItems", [](const ColumnComposedElement& inspector) { return inspector.GetAlignContent(); } },
|
||||
{ "space", [](const ColumnComposedElement& inspector) { return inspector.GetSpace(); } },
|
||||
{ "selfAlign", [](const ColumnComposedElement& inspector) { return inspector.GetHorizontalAlign(); } },
|
||||
{ "justifyContent", [](const ColumnComposedElement& inspector) { return inspector.GetJustifyContent(); } },
|
||||
};
|
||||
|
||||
}
|
||||
@@ -106,6 +107,45 @@ std::string ColumnComposedElement::GetHorizontalAlign() const
|
||||
return "HorizontalAlign::Center";
|
||||
}
|
||||
|
||||
std::string ColumnComposedElement::GetJustifyContent() const
|
||||
{
|
||||
auto node = GetRenderColumn();
|
||||
if (!node) {
|
||||
return "FlexAlign.Start";
|
||||
}
|
||||
auto flexAlign = node->GetJustifyContent();
|
||||
return ConvertFlexAlignToString(flexAlign);
|
||||
}
|
||||
|
||||
std::string ColumnComposedElement::ConvertFlexAlignToString(FlexAlign flexAlign) const
|
||||
{
|
||||
std::string result = "";
|
||||
switch (flexAlign) {
|
||||
case FlexAlign::FLEX_START:
|
||||
result = "FlexAlign.Start";
|
||||
break;
|
||||
case FlexAlign::FLEX_END:
|
||||
result = "FlexAlign.End";
|
||||
break;
|
||||
case FlexAlign::CENTER:
|
||||
result = "FlexAlign.Center";
|
||||
break;
|
||||
case FlexAlign::SPACE_BETWEEN:
|
||||
result = "FlexAlign.SpaceBetween";
|
||||
break;
|
||||
case FlexAlign::SPACE_AROUND:
|
||||
result = "FlexAlign.SpaceAround";
|
||||
break;
|
||||
case FlexAlign::SPACE_EVENLY:
|
||||
result = "FlexAlign.SpaceEvenly";
|
||||
break;
|
||||
default:
|
||||
result = "FlexAlign.Start";
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
RefPtr<RenderFlex> ColumnComposedElement::GetRenderColumn() const
|
||||
{
|
||||
auto node = GetInspectorNode(ColumnElement::TypeId());
|
||||
|
||||
@@ -37,6 +37,8 @@ public:
|
||||
std::string GetSpace() const;
|
||||
std::string GetHorizontalAlign() const;
|
||||
std::unique_ptr<JsonValue> ToJsonObject() const override;
|
||||
std::string GetJustifyContent() const;
|
||||
std::string ConvertFlexAlignToString(FlexAlign flexAlign) const;
|
||||
RefPtr<RenderFlex> GetRenderColumn() const;
|
||||
void AddChildWithSlot(int32_t slot, const RefPtr<Component>& newComponent) override;
|
||||
void UpdateChildWithSlot(int32_t slot, const RefPtr<Component>& newComponent) override;
|
||||
|
||||
@@ -111,7 +111,8 @@ const std::unordered_map<std::string, StringJsonFunc> CREATE_JSON_STRING_MAP {
|
||||
{ "align", [](const InspectorNode& inspector) { return inspector.GetAlign(); } },
|
||||
{ "direction", [](const InspectorNode& inspector) { return inspector.GetDirectionStr(); } },
|
||||
{ "bindPopup", [](const InspectorNode& inspector) { return inspector.GetBindPopup(); } },
|
||||
{ "bindContextMenu", [](const InspectorNode& inspector) { return inspector.GetBindContextMenu(); } }
|
||||
{ "bindContextMenu", [](const InspectorNode& inspector) { return inspector.GetBindContextMenu(); } },
|
||||
{ "colorBlend", [](const InspectorNode& inspector) { return inspector.GetColorBlend(); } },
|
||||
};
|
||||
|
||||
const std::unordered_map<std::string, BoolJsonFunc> CREATE_JSON_BOOL_MAP {
|
||||
@@ -1376,6 +1377,16 @@ std::string InspectorComposedElement::GetBindContextMenu() const
|
||||
return "-";
|
||||
}
|
||||
|
||||
std::string InspectorComposedElement::GetColorBlend() const
|
||||
{
|
||||
auto node = GetRenderBox();
|
||||
if (!node) {
|
||||
return "";
|
||||
}
|
||||
auto colorBlend = node->GetColorBlend();
|
||||
return colorBlend.ColorToString();
|
||||
}
|
||||
|
||||
void InspectorComposedElement::UpdateEventTarget(BaseEventInfo& info) const
|
||||
{
|
||||
auto area = GetCurrentRectAndOrigin();
|
||||
|
||||
@@ -186,7 +186,8 @@ public:
|
||||
double GetSepia() const override;
|
||||
double GetGrayScale() const override;
|
||||
double GetHueRotate() const override;
|
||||
|
||||
std::string GetColorBlend() const override;
|
||||
|
||||
// shape clip
|
||||
std::string GetClip() const override;
|
||||
bool GetClipFlag() const;
|
||||
|
||||
@@ -161,7 +161,8 @@ public:
|
||||
virtual double GetSepia() const = 0;
|
||||
virtual double GetGrayScale() const = 0;
|
||||
virtual double GetHueRotate() const = 0;
|
||||
|
||||
virtual std::string GetColorBlend() const = 0;
|
||||
|
||||
// shape clip
|
||||
virtual std::string GetClip() const = 0;
|
||||
virtual std::unique_ptr<JsonValue> GetMask() const = 0;
|
||||
|
||||
@@ -46,6 +46,11 @@ const std::unordered_map<std::string, std::function<bool(const NavigationCompose
|
||||
[](const NavigationComposedElement& inspector) { return inspector.GetNavigationHideToolBar(); } }
|
||||
};
|
||||
|
||||
using JsonFuncType = std::function<std::unique_ptr<JsonValue>(const NavigationComposedElement&)>;
|
||||
const std::unordered_map<std::string, JsonFuncType> CREATE_JSON_VALUE_MAP {
|
||||
{ "menus", [](const NavigationComposedElement& inspector) { return inspector.GetMenus(); } }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
void NavigationComposedElement::Dump()
|
||||
@@ -77,6 +82,9 @@ std::unique_ptr<JsonValue> NavigationComposedElement::ToJsonObject() const
|
||||
for (const auto& value : CREATE_JSON_BOOL_MAP) {
|
||||
resultJson->Put(value.first.c_str(), value.second(*this));
|
||||
}
|
||||
for (const auto& value : CREATE_JSON_VALUE_MAP) {
|
||||
resultJson->Put(value.first.c_str(), value.second(*this));
|
||||
}
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
@@ -170,6 +178,30 @@ bool NavigationComposedElement::GetNavigationHideToolBar() const
|
||||
return render->GetHideNavigationToolBar();
|
||||
}
|
||||
|
||||
std::unique_ptr<JsonValue> NavigationComposedElement::GetMenus() const
|
||||
{
|
||||
auto render = GetRenderNavigation();
|
||||
auto menusArray = JsonUtil::CreateArray(false);
|
||||
if (!render) {
|
||||
return menusArray;
|
||||
}
|
||||
auto menuItems = render->GetMenuItems();
|
||||
if (!menuItems.empty()) {
|
||||
std::list<RefPtr<ToolBarItem>>::iterator iter;
|
||||
int32_t i = 0;
|
||||
for (iter = menuItems.begin(); iter != menuItems.end(); ++iter, i++) {
|
||||
auto jsonMenusItem = JsonUtil::CreateArray(false);
|
||||
auto menus = *iter;
|
||||
jsonMenusItem->Put("value", menus->value.c_str());
|
||||
jsonMenusItem->Put("icon", menus->icon.c_str());
|
||||
auto index = std::to_string(i);
|
||||
menusArray->Put(index.c_str(), jsonMenusItem);
|
||||
}
|
||||
return menusArray;
|
||||
}
|
||||
return menusArray;
|
||||
}
|
||||
|
||||
RefPtr<RenderNavigationContainer> NavigationComposedElement::GetRenderNavigation() const
|
||||
{
|
||||
auto node = GetInspectorNode(NavigationContainerElement::TypeId());
|
||||
|
||||
@@ -40,6 +40,7 @@ public:
|
||||
bool GetNavigationHideToolBar() const;
|
||||
bool GetHideNavigationBackButton() const;
|
||||
bool GetHideNavigationBar() const;
|
||||
std::unique_ptr<JsonValue> GetMenus() const;
|
||||
|
||||
AceType::IdType GetTargetTypeId() const override
|
||||
{
|
||||
|
||||
@@ -27,6 +27,7 @@ const std::unordered_map<std::string, std::function<std::string(const RowCompose
|
||||
{ "alignItems", [](const RowComposedElement& inspector) { return inspector.GetAlignItems(); } },
|
||||
{ "space", [](const RowComposedElement& inspector) { return inspector.GetSpace(); } },
|
||||
{ "selfAlign", [](const RowComposedElement& inspector) { return inspector.GetVerticalAlign(); } },
|
||||
{ "justifyContent", [](const RowComposedElement& inspector) { return inspector.GetJustifyContent(); } },
|
||||
};
|
||||
|
||||
}
|
||||
@@ -109,6 +110,49 @@ std::string RowComposedElement::GetVerticalAlign() const
|
||||
return "verticalAlign::Center";
|
||||
}
|
||||
|
||||
std::string RowComposedElement::GetJustifyContent() const
|
||||
{
|
||||
auto node = GetInspectorNode(RowElement::TypeId());
|
||||
if (!node) {
|
||||
return "FlexAlign.Start";
|
||||
}
|
||||
auto renderRow = AceType::DynamicCast<RenderFlex>(node);
|
||||
if (!renderRow) {
|
||||
return "FlexAlign.Start";
|
||||
}
|
||||
auto flexAlign = renderRow->GetJustifyContent();
|
||||
return ConvertFlexAlignToString(flexAlign);
|
||||
}
|
||||
|
||||
std::string RowComposedElement::ConvertFlexAlignToString(FlexAlign flexAlign) const
|
||||
{
|
||||
std::string result = "";
|
||||
switch (flexAlign) {
|
||||
case FlexAlign::FLEX_START:
|
||||
result = "FlexAlign.Start";
|
||||
break;
|
||||
case FlexAlign::FLEX_END:
|
||||
result = "FlexAlign.End";
|
||||
break;
|
||||
case FlexAlign::CENTER:
|
||||
result = "FlexAlign.Center";
|
||||
break;
|
||||
case FlexAlign::SPACE_BETWEEN:
|
||||
result = "FlexAlign.SpaceBetween";
|
||||
break;
|
||||
case FlexAlign::SPACE_AROUND:
|
||||
result = "FlexAlign.SpaceAround";
|
||||
break;
|
||||
case FlexAlign::SPACE_EVENLY:
|
||||
result = "FlexAlign.SpaceEvenly";
|
||||
break;
|
||||
default:
|
||||
result = "FlexAlign.Start";
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void RowComposedElement::AddChildWithSlot(int32_t slot, const RefPtr<Component>& newComponent)
|
||||
{
|
||||
auto rowElement = GetContentElement<FlexElement>(RowElement::TypeId());
|
||||
|
||||
@@ -34,6 +34,8 @@ public:
|
||||
std::string GetAlignItems() const;
|
||||
std::string GetSpace() const;
|
||||
std::string GetVerticalAlign() const;
|
||||
std::string GetJustifyContent() const;
|
||||
std::string ConvertFlexAlignToString(FlexAlign flexAlign) const;
|
||||
void AddChildWithSlot(int32_t slot, const RefPtr<Component>& newComponent) override;
|
||||
void UpdateChildWithSlot(int32_t slot, const RefPtr<Component>& newComponent) override;
|
||||
void DeleteChildWithSlot(int32_t slot) override;
|
||||
|
||||
@@ -35,7 +35,8 @@ const std::unordered_map<std::string, std::function<std::string(const SwiperComp
|
||||
{ "disableSwipe", [](const SwiperComposedElement& inspector) { return inspector.GetDisableSwipe(); } },
|
||||
{ "itemSpace", [](const SwiperComposedElement& inspector) { return inspector.GetItemSpace(); } },
|
||||
{ "curve", [](const SwiperComposedElement& inspector) { return inspector.GetCurve(); } },
|
||||
{ "indicatorStyle", [](const SwiperComposedElement& inspector) { return inspector.GetIndicatorStyle(); } }
|
||||
{ "indicatorStyle", [](const SwiperComposedElement& inspector) { return inspector.GetIndicatorStyle(); } },
|
||||
{ "cachedCount", [](const SwiperComposedElement& inspector) { return inspector.GetCachedCount(); } },
|
||||
};
|
||||
|
||||
} // namespace
|
||||
@@ -239,6 +240,13 @@ RefPtr<RenderSwiper> SwiperComposedElement::GetRenderSwiper() const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::string SwiperComposedElement::GetCachedCount() const
|
||||
{
|
||||
auto renderSwiper = GetRenderSwiper();
|
||||
auto cachedCount = renderSwiper ? renderSwiper->GetCachedCount() : 1;
|
||||
return std::to_string(cachedCount);
|
||||
}
|
||||
|
||||
void SwiperComposedElement::AddChildWithSlot(int32_t slot, const RefPtr<Component>& newComponent)
|
||||
{
|
||||
auto swiperElement = GetContentElement<SwiperElement>(SwiperElement::TypeId());
|
||||
|
||||
@@ -51,6 +51,7 @@ public:
|
||||
std::string GetSwiperRight() const;
|
||||
std::string GetSwiperBottom() const;
|
||||
std::string GetSwiperSize() const;
|
||||
std::string GetCachedCount() const;
|
||||
|
||||
AceType::IdType GetTargetTypeId() const override
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user