From 6e84d69eb4deaa81a3791c53148376817586bb06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E6=B8=85=E4=BA=91?= Date: Sun, 7 Sep 2025 16:43:56 +0800 Subject: [PATCH] =?UTF-8?q?onVisibleAreaChange:=20=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=8F=AF=E8=A7=81=E5=8C=BA=E5=9F=9F=E8=B6=85=E5=87=BA=E7=88=B6?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E8=BE=B9=E7=95=8C=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 胡清云 --- arkui/ace_engine/native/libace.ndk.json | 8 ++++++ arkui/ace_engine/native/native_node.h | 17 ++++++++++++ arkui/ace_engine/native/native_type.h | 35 +++++++++++++++++++++++++ 3 files changed, 60 insertions(+) diff --git a/arkui/ace_engine/native/libace.ndk.json b/arkui/ace_engine/native/libace.ndk.json index 1e0b4c4dfee..be3d276e074 100644 --- a/arkui/ace_engine/native/libace.ndk.json +++ b/arkui/ace_engine/native/libace.ndk.json @@ -2979,6 +2979,10 @@ "first_introduced": "17", "name": "OH_ArkUI_VisibleAreaEventOptions_SetExpectedUpdateInterval" }, + { + "first_introduced": "21", + "name": "OH_ArkUI_VisibleAreaEventOptions_SetMeasureFromViewport" + }, { "first_introduced": "17", "name": "OH_ArkUI_VisibleAreaEventOptions_GetRatios" @@ -2987,6 +2991,10 @@ "first_introduced": "17", "name": "OH_ArkUI_VisibleAreaEventOptions_GetExpectedUpdateInterval" }, + { + "first_introduced": "21", + "name": "OH_ArkUI_VisibleAreaEventOptions_GetMeasureFromViewport" + }, { "first_introduced": "17", "name": "OH_ArkUI_UIInputEvent_GetEventTargetWidth" diff --git a/arkui/ace_engine/native/native_node.h b/arkui/ace_engine/native/native_node.h index d9516d4064c..f2f8aeced39 100644 --- a/arkui/ace_engine/native/native_node.h +++ b/arkui/ace_engine/native/native_node.h @@ -1828,6 +1828,23 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[...].f32: threshold array. \n * + * @since 12 + */ + /** + * @brief Defines the visible area ratio (visible area/total area of the component) threshold for invoking the + * visible area change event of the component, this enum extends the configuration capability. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[...].f32: threshold array. The value range is 0 to 1. + * .?object: pass in one {@link ArkUI_VisibleAreaEventOptions} object for configuring the ratio or other options. + * Please note, when use this param, the ratios set through .value[...].f32 will be ignored, and the update + * interval from it is always ignored too. + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[...].f32: threshold array. \n + * .object: the {@link ArkUI_VisibleAreaEventOptions} object. + * + * @since 21 */ NODE_VISIBLE_AREA_CHANGE_RATIO = 93, diff --git a/arkui/ace_engine/native/native_type.h b/arkui/ace_engine/native/native_type.h index e43a92fa2e6..6646a8ce2f1 100644 --- a/arkui/ace_engine/native/native_type.h +++ b/arkui/ace_engine/native/native_type.h @@ -5314,6 +5314,31 @@ int32_t OH_ArkUI_VisibleAreaEventOptions_SetRatios(ArkUI_VisibleAreaEventOptions int32_t OH_ArkUI_VisibleAreaEventOptions_SetExpectedUpdateInterval( ArkUI_VisibleAreaEventOptions *option, int32_t value); +/** +* @brief Sets the flag for controlling if the child components can exceed the parent's bounds. +* if set to false, the part that exceeds the parent's bounds will be considered as invisible area, +* set to true to allow the exceeding, the part that exceeds will be considered as visible area. +* +* Please note that if the parent component set clip(true), the measureFromViewport configuration +* will be ignored. +* +* @param option Instance of visible area change event parameters. +* @param measureFromViewport When this parameter is set to true, the parts of the component +* that exceed the parent component's area will also be included in the visible area calculation. However, this +* only applies if the parent component does not explicitly set the clip property to true. If the parent component +* sets clip to true, regardless of the value of this parameter, the parts that exceed the parent component's area +* will still be treated as invisible in the visible area calculation. +* Default measureFromViewport: false. +* @return Returns the result code. +* Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. +* Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. +* If an error code is returned, it may be due to a failure in parameter validation; +* the parameter must not be null. +* @since 21 +*/ +int32_t OH_ArkUI_VisibleAreaEventOptions_SetMeasureFromViewport( + ArkUI_VisibleAreaEventOptions* option, bool measureFromViewport); + /** * @brief Obtains the threshold ratios for visible area changes. * @@ -5339,6 +5364,16 @@ int32_t OH_ArkUI_VisibleAreaEventOptions_GetRatios(ArkUI_VisibleAreaEventOptions */ int32_t OH_ArkUI_VisibleAreaEventOptions_GetExpectedUpdateInterval(ArkUI_VisibleAreaEventOptions* option); +/** + * @brief Obtains the value set through {@link OH_ArkUI_VisibleAreaEventOptions_SetMeasureFromViewport} . + * + * @param option Instance of visible area change event parameters. + * @return Returns the flag for controlling of the visible area calculation. Default value: false. + * + * @since 21 + */ +bool OH_ArkUI_VisibleAreaEventOptions_GetMeasureFromViewport(ArkUI_VisibleAreaEventOptions* option); + /** *@brief Creates a TextPickerRangeContent instance. * -- Gitee