!33775 [NDK] fix RelativeContainer

Merge pull request !33775 from lisitao/li_1
This commit is contained in:
openharmony_ci 2024-05-23 12:42:10 +00:00 committed by Gitee
commit 48fb27ee8d
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
5 changed files with 25 additions and 8 deletions

View File

@ -976,7 +976,9 @@ struct ArkUIContext {
struct ArkUIGuidelineStyle {
ArkUI_CharPtr id;
ArkUI_Int32 direction;
ArkUI_Bool hasStart;
ArkUI_Float32 start;
ArkUI_Bool hasEnd;
ArkUI_Float32 end;
};

View File

@ -30,10 +30,19 @@ void SetGuideLine(ArkUINodeHandle node, ArkUIGuidelineStyle* values, ArkUI_Int32
std::string idStr(values[i].id);
info.id = idStr;
info.direction = static_cast<LineDirection>(values[i].direction);
CalcDimension start(values[i].start, DimensionUnit::VP);
CalcDimension end(values[i].end, DimensionUnit::VP);
info.start = start;
info.end = end;
if (values[i].hasStart && values[i].hasEnd) {
CalcDimension start(values[i].start, DimensionUnit::VP);
info.start = start;
} else if (values[i].hasStart) {
CalcDimension start(values[i].start, DimensionUnit::VP);
info.start = start;
} else if (values[i].hasEnd) {
CalcDimension end(values[i].end, DimensionUnit::VP);
info.end = end;
} else {
CalcDimension start(0.0, DimensionUnit::VP);
info.start = start;
}
guidelineInfos.push_back(info);
}
RelativeContainerModelNG::SetGuideline(frameNode, guidelineInfos);

View File

@ -52,7 +52,9 @@ struct ArkUI_GuidelineStyle {
std::string id;
ArkUI_Axis direction;
float start;
bool hasStart;
float end;
bool hasEnd;
};
struct ArkUI_GuidelineOption {

View File

@ -58,6 +58,7 @@ void OH_ArkUI_GuidelineOption_SetPositionStart(ArkUI_GuidelineOption* guideline,
if (guideline == nullptr || index < 0 || index >= static_cast<int32_t>(guideline->styles.size())) {
return;
}
guideline->styles[index].hasStart = true;
guideline->styles[index].start = value;
}
@ -66,6 +67,7 @@ void OH_ArkUI_GuidelineOption_SetPositionEnd(ArkUI_GuidelineOption* guideline, f
if (guideline == nullptr || index < 0 || index >= static_cast<int32_t>(guideline->styles.size())) {
return;
}
guideline->styles[index].hasEnd = true;
guideline->styles[index].end = value;
}

View File

@ -11232,8 +11232,10 @@ int32_t SetRelativeContainerGuideLine(ArkUI_NodeHandle node, const ArkUI_Attribu
ArkUIGuidelineStyle style;
style.id = styles->styles[i].id.c_str();
style.direction = styles->styles[i].direction;
style.hasStart = styles->styles[i].hasStart;
style.start = styles->styles[i].start;
style.end = styles->styles[i].end;
style.hasEnd = styles->styles[i].hasEnd;
guidelineStyle.push_back(style);
}
GetFullImpl()->getNodeModifiers()->getRelativeContainerModifier()->setGuideLine(
@ -13249,8 +13251,8 @@ int32_t SetNodeAttribute(ArkUI_NodeHandle node, ArkUI_NodeAttributeType type, co
SetCalendarPickerAttribute, SetSliderAttribute, SetRadioAttribute, SetImageAnimatorAttribute,
SetStackAttribute, SetSwiperAttribute,
SetScrollAttribute, SetListAttribute, SetListItemAttribute, SetListItemGroupAttribute, SetColumnAttribute,
SetRowAttribute, SetFlexAttribute, SetRefreshAttribute, SetWaterFlowAttribute, nullptr, SetGridAttribute,
nullptr, SetRelativeContainerAttribute};
SetRowAttribute, SetFlexAttribute, SetRefreshAttribute, SetWaterFlowAttribute, nullptr,
SetRelativeContainerAttribute, SetGridAttribute };
int32_t subTypeClass = type / MAX_NODE_SCOPE_NUM;
int32_t subTypeId = type % MAX_NODE_SCOPE_NUM;
int32_t nodeSubTypeClass =
@ -13280,7 +13282,7 @@ const ArkUI_AttributeItem* GetNodeAttribute(ArkUI_NodeHandle node, ArkUI_NodeAtt
GetCalendarPickerAttribute, GetSliderAttribute, GetRadioAttribute, GetImageAnimatorAttribute,
GetStackAttribute, GetSwiperAttribute,
GetScrollAttribute, GetListAttribute, nullptr, nullptr, GetColumnAttribute, GetRowAttribute, GetFlexAttribute,
GetRefreshAttribute, GetWaterFlowAttribute, nullptr, GetGridAttribute, nullptr, GetRelativeContainerAttribute };
GetRefreshAttribute, GetWaterFlowAttribute, nullptr, GetRelativeContainerAttribute, GetGridAttribute };
int32_t subTypeClass = type / MAX_NODE_SCOPE_NUM;
int32_t subTypeId = type % MAX_NODE_SCOPE_NUM;
int32_t nodeSubTypeClass =
@ -13307,7 +13309,7 @@ int32_t ResetNodeAttribute(ArkUI_NodeHandle node, ArkUI_NodeAttributeType type)
ResetImageAnimatorAttribute,
ResetStackAttribute, ResetSwiperAttribute, ResetScrollAttribute, ResetListAttribute, ResetListItemAttribute,
ResetListItemGroupAttribute, ResetColumnAttribute, ResetRowAttribute, ResetFlexAttribute, ResetRefreshAttribute,
ResetWaterFlowAttribute, nullptr, ResetGridAttribute, nullptr, ResetRelativeContainerAttribute};
ResetWaterFlowAttribute, nullptr, ResetRelativeContainerAttribute, ResetGridAttribute };
int32_t subTypeClass = type / MAX_NODE_SCOPE_NUM;
int32_t subTypeId = type % MAX_NODE_SCOPE_NUM;
int32_t nodeSubTypeClass =