mirror of
https://github.com/openharmony/ace_ace_engine.git
synced 2026-07-21 01:45:30 -04:00
fix list bug
Signed-off-by: wzztoone <wangzezhen@huawei.com> Change-Id: I1a4bfd2691bfe90ecc2f7b6d4e86935930dd4a00
This commit is contained in:
@@ -104,11 +104,25 @@ void JSList::SetChainAnimation(bool enableChainAnimation)
|
||||
JSViewSetProperty(&V2::ListComponent::SetChainAnimation, enableChainAnimation);
|
||||
}
|
||||
|
||||
void JSList::JsWidth(const JSCallbackInfo& info)
|
||||
{
|
||||
JSViewAbstract::JsWidth(info);
|
||||
JSViewSetProperty(&V2::ListComponent::SetHasWidth, true);
|
||||
}
|
||||
|
||||
void JSList::JsHeight(const JSCallbackInfo& info)
|
||||
{
|
||||
JSViewAbstract::JsHeight(info);
|
||||
JSViewSetProperty(&V2::ListComponent::SetHasHeight, true);
|
||||
}
|
||||
|
||||
void JSList::JSBind(BindingTarget globalObj)
|
||||
{
|
||||
JSClass<JSList>::Declare("List");
|
||||
JSClass<JSList>::StaticMethod("create", &JSList::Create);
|
||||
|
||||
JSClass<JSList>::StaticMethod("width", &JSList::JsWidth);
|
||||
JSClass<JSList>::StaticMethod("height", &JSList::JsHeight);
|
||||
JSClass<JSList>::StaticMethod("listDirection", &JSList::SetDirection);
|
||||
JSClass<JSList>::StaticMethod("scrollBar", &JSList::SetScrollBar);
|
||||
JSClass<JSList>::StaticMethod("edgeEffect", &JSList::SetEdgeEffect);
|
||||
|
||||
@@ -26,6 +26,8 @@ public:
|
||||
static void JSBind(BindingTarget globalObj);
|
||||
static void Create(const JSCallbackInfo& args);
|
||||
|
||||
static void JsWidth(const JSCallbackInfo& info);
|
||||
static void JsHeight(const JSCallbackInfo& info);
|
||||
static void ScrollCallback(const JSCallbackInfo& args);
|
||||
static void ReachStartCallback(const JSCallbackInfo& args);
|
||||
static void ReachEndCallback(const JSCallbackInfo& args);
|
||||
|
||||
@@ -79,6 +79,8 @@ public:
|
||||
ACE_DEFINE_COMPONENT_PROP(ScrollBarProxy, RefPtr<ScrollBarProxy>);
|
||||
ACE_DEFINE_COMPONENT_PROP(ChainAnimation, bool, false);
|
||||
ACE_DEFINE_COMPONENT_PROP(MultiSelectable, bool, false);
|
||||
ACE_DEFINE_COMPONENT_PROP(HasHeight, bool, false);
|
||||
ACE_DEFINE_COMPONENT_PROP(HasWidth, bool, false);
|
||||
|
||||
ACE_DEFINE_COMPONENT_EVENT(OnScroll, void(Dimension, ScrollState));
|
||||
ACE_DEFINE_COMPONENT_EVENT(OnScrollIndex, void(int32_t, int32_t));
|
||||
|
||||
@@ -233,6 +233,8 @@ void RenderList::Update(const RefPtr<Component>& component)
|
||||
|
||||
|
||||
isMultiSelectable_ = component_->GetMultiSelectable();
|
||||
hasHeight_ = component_->GetHasHeight();
|
||||
hasWidth_ = component_->GetHasWidth();
|
||||
|
||||
MarkNeedLayout();
|
||||
}
|
||||
@@ -346,7 +348,7 @@ void RenderList::PerformLayout()
|
||||
auto layoutSize = SetItemsPosition(mainSize, innerLayout);
|
||||
|
||||
// Set layout size of list component itself
|
||||
if (fixedMainSize_) {
|
||||
if ((hasHeight_ && vertical_) || (hasWidth_ && !vertical_)) {
|
||||
SetLayoutSize(GetLayoutParam().GetMaxSize());
|
||||
} else {
|
||||
SetLayoutSize(GetLayoutParam().Constrain(layoutSize));
|
||||
|
||||
@@ -380,7 +380,8 @@ private:
|
||||
bool isMultiSelectable_ = false;
|
||||
void ClearMultiSelect();
|
||||
bool mouseIsHover_ = false;
|
||||
|
||||
bool hasHeight_ = false;
|
||||
bool hasWidth_ = false;
|
||||
bool isAxisResponse_ = true;
|
||||
|
||||
void MultiSelectWithoutKeyboard(const Rect& selectedZone);
|
||||
|
||||
Reference in New Issue
Block a user