• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "core/interfaces/native/node/node_common_modifier_multi_thread.h"
17 namespace OHOS::Ace::NG {
SetGeometryTransitionMultiThread(ArkUINodeHandle node,ArkUI_CharPtr id,const ArkUIGeometryTransitionOptions * options)18 void SetGeometryTransitionMultiThread(ArkUINodeHandle node, ArkUI_CharPtr id,
19     const ArkUIGeometryTransitionOptions* options)
20 {
21     auto* frameNode = reinterpret_cast<FrameNode*>(node);
22     CHECK_NULL_VOID(frameNode);
23     std::string idStr(id);
24 
25     auto follow = static_cast<bool>(options->follow);
26     auto strategy = static_cast<bool>(options->hierarchyStrategy);
27     frameNode->PostAfterAttachMainTreeTask([weak = AceType::WeakClaim(frameNode), idStr, follow, strategy]() {
28         auto node = weak.Upgrade();
29         CHECK_NULL_VOID(node);
30         ViewAbstract::SetGeometryTransition(AceType::RawPtr(node), idStr, follow, strategy);
31     });
32 }
33 
ResetGeometryTransitionMultiThread(ArkUINodeHandle node)34 void ResetGeometryTransitionMultiThread(ArkUINodeHandle node)
35 {
36     auto* frameNode = reinterpret_cast<FrameNode*>(node);
37     CHECK_NULL_VOID(frameNode);
38 
39     frameNode->PostAfterAttachMainTreeTask([weak = AceType::WeakClaim(frameNode)]() {
40         auto node = weak.Upgrade();
41         CHECK_NULL_VOID(node);
42         ViewAbstract::SetGeometryTransition(AceType::RawPtr(node), "", false, true);
43     });
44 }
45 }