1 /*
2 * Copyright (c) 2021-2022 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/components/select_popup/render_select_popup.h"
17
18 #include "core/components/flex/flex_component.h"
19 #include "core/components/flex/render_flex.h"
20 #include "core/components/option/render_option.h"
21 #include "core/components/select/select_theme.h"
22 #include "core/components/select_popup/select_popup_component.h"
23 #include "core/components/stack/stack_element.h"
24 #include "core/components/text/render_text.h"
25 #include "core/gestures/raw_recognizer.h"
26
27 namespace OHOS::Ace {
28 namespace {
29 constexpr int32_t DEFAULT_DISTANCE = 5;
30 } // namespace
31
RenderSelectPopup()32 RenderSelectPopup::RenderSelectPopup()
33 {
34 rawDetector_ = AceType::MakeRefPtr<RawRecognizer>();
35 rawDetector_->SetOnTouchDown([weak = WeakClaim(this)](const TouchEventInfo& info) {
36 auto selectPopup = weak.Upgrade();
37 if (selectPopup) {
38 selectPopup->ProcessTouchDown(info);
39 selectPopup->HandleRawEvent(info.GetTouches().front().GetLocalLocation());
40 }
41 });
42 }
43
OnPaintFinish()44 void RenderSelectPopup::OnPaintFinish()
45 {
46 auto pipeline = context_.Upgrade();
47 if (!selectPopup_ || !selectPopup_->GetNode() || !pipeline || !renderPositioned_) {
48 LOGE("can not get accessibility node of select popup or pipeline is null or positional is null.");
49 return;
50 }
51 auto node = selectPopup_->GetNode();
52 auto viewScale = pipeline->GetViewScale();
53 auto leftTop = renderPositioned_->GetGlobalOffset();
54 node->SetLeft(leftTop.GetX() * viewScale);
55 node->SetTop(leftTop.GetY() * viewScale);
56 auto size = renderPositioned_->GetLayoutSize();
57 node->SetWidth(size.Width() * viewScale);
58 node->SetHeight(size.Height() * viewScale);
59 #if defined(WINDOWS_PLATFORM) || defined(MAC_PLATFORM)
60 auto parentNode = node->GetParentNode();
61 if (parentNode && parentNode->GetTag() == "menu") {
62 parentNode->SetLeft(leftTop.GetX() * viewScale);
63 parentNode->SetTop(leftTop.GetY() * viewScale);
64 parentNode->SetWidth(size.Width() * viewScale);
65 parentNode->SetHeight(size.Height() * viewScale);
66 }
67 #endif
68 node->SetEnabledState(true);
69 node->SetCheckableState(false);
70 node->SetClickableState(false);
71 node->SetFocusableState(false);
72 }
73
Update(const RefPtr<Component> & component)74 void RenderSelectPopup::Update(const RefPtr<Component>& component)
75 {
76 auto popup = AceType::DynamicCast<SelectPopupComponent>(component);
77 if (!popup || !popup->GetTheme()) {
78 LOGE("select: input component is null or not SelectPopupComponent.");
79 return;
80 }
81
82 theme_ = popup->GetTheme();
83 tvBackColor_ = theme_->GetTvBackColor();
84 selectPopup_ = popup;
85 popup->GetPopupLayout(selectLeftTop_, selectRightBottom_);
86 optionSize_ = popup->GetOptionSize();
87 rrectSize_ = popup->GetPopupRRectSize();
88 optionInterval_ = theme_->GetOptionInterval();
89 minWidth_ = popup->GetPopupMinWidth();
90 horizontalSpacing_ = popup->GetHorizontalSpacing();
91 verticalSpacing_ = popup->GetVerticalSpacing();
92 contentSpacing_ = popup->GetContentSpacing();
93 isFullScreen_ = popup->IsFullScreen();
94 isContextMenu_ = popup->IsContextMenu();
95 MarkNeedLayout();
96 }
97
AdjustTvChildVerticalLayout(const Size & size,double & y,double & height)98 void RenderSelectPopup::AdjustTvChildVerticalLayout(const Size& size, double& y, double& height)
99 {
100 double bottomSpace = globalRightBottom_.GetY() - selectLeftTop_.GetY();
101 if (bottomSpace >= size.Height() + verticalSpacing_.Value()) {
102 y = selectLeftTop_.GetY();
103 height = size.Height();
104 return;
105 }
106 bottomSpace = globalRightBottom_.GetY();
107 if (bottomSpace >= size.Height() + 2.0 * verticalSpacing_.Value()) {
108 height = size.Height();
109 y = bottomSpace - verticalSpacing_.Value() - height;
110 return;
111 }
112 height = bottomSpace - 2.0 * verticalSpacing_.Value();
113 y = verticalSpacing_.Value();
114 }
115
AdjustTvChildHorizontalLayout(const Size & size,double & x,double & width)116 void RenderSelectPopup::AdjustTvChildHorizontalLayout(const Size& size, double& x, double& width)
117 {
118 double leftSpace = selectLeftTop_.GetX();
119 double rightSpace = globalRightBottom_.GetX() - selectRightBottom_.GetX();
120 if (selectPopup_ && selectPopup_->GetTextDirection() == TextDirection::RTL) {
121 if (leftSpace >= contentSpacing_.Value() + size.Width() + horizontalSpacing_.Value()) {
122 width = size.Width();
123 x = selectLeftTop_.GetX() - contentSpacing_.Value() - width;
124 return;
125 }
126 if (rightSpace <= leftSpace) {
127 width = leftSpace - contentSpacing_.Value() - horizontalSpacing_.Value();
128 x = horizontalSpacing_.Value();
129 return;
130 }
131 x = selectRightBottom_.GetX() + contentSpacing_.Value();
132 if (rightSpace >= contentSpacing_.Value() + size.Width() + horizontalSpacing_.Value()) {
133 width = size.Width();
134 return;
135 }
136 width = rightSpace - contentSpacing_.Value() - horizontalSpacing_.Value();
137 return;
138 }
139
140 if (rightSpace >= contentSpacing_.Value() + size.Width() + horizontalSpacing_.Value()) {
141 width = size.Width();
142 x = selectRightBottom_.GetX() + contentSpacing_.Value();
143 return;
144 }
145 if (leftSpace <= rightSpace) {
146 width = rightSpace - contentSpacing_.Value() - horizontalSpacing_.Value();
147 x = selectRightBottom_.GetX() + contentSpacing_.Value();
148 return;
149 }
150 if (leftSpace >= contentSpacing_.Value() + size.Width() + horizontalSpacing_.Value()) {
151 width = size.Width();
152 x = selectLeftTop_.GetX() - contentSpacing_.Value() - width;
153 return;
154 }
155 width = leftSpace - contentSpacing_.Value() - horizontalSpacing_.Value();
156 x = horizontalSpacing_.Value();
157 }
158
AdjustChildVerticalLayout(const Size & size,double & y,double & height)159 void RenderSelectPopup::AdjustChildVerticalLayout(const Size& size, double& y, double& height)
160 {
161 if (selectPopup_ && selectPopup_->IsMenu() && selectPopup_->IsTV()) {
162 AdjustTvChildVerticalLayout(size, y, height);
163 y -= NormalizeToPx(optionInterval_);
164 y -= NormalizeToPx(rrectSize_);
165 return;
166 }
167
168 double bottomSpace = globalRightBottom_.GetY() - selectRightBottom_.GetY();
169 double topSpace = selectLeftTop_.GetY();
170 // think about top padding and bottom padding
171 if (bottomSpace >= size.Height() + 2.0 * normalPadding_) {
172 y = selectRightBottom_.GetY() + normalPadding_;
173 height = size.Height();
174 return;
175 }
176
177 if (bottomSpace >= topSpace) {
178 y = selectRightBottom_.GetY() + normalPadding_;
179 // think about top padding and bottom padding
180 height = bottomSpace - 2.0 * normalPadding_;
181 return;
182 }
183
184 // think about top padding and bottom padding
185 if (topSpace >= size.Height() + 2.0 * normalPadding_) {
186 height = size.Height();
187 y = selectLeftTop_.GetY() - normalPadding_ - height;
188 return;
189 }
190
191 y = normalPadding_;
192 // think about top padding and bottom padding
193 height = topSpace - 2.0 * normalPadding_;
194 }
195
AdjustChildHorizontalLayout(const Size & size,double & x,double & width)196 void RenderSelectPopup::AdjustChildHorizontalLayout(const Size& size, double& x, double& width)
197 {
198 double rightSpace = globalRightBottom_.GetX() - selectLeftTop_.GetX();
199 if (selectRightBottom_ != selectLeftTop_) {
200 if (selectPopup_ && selectPopup_->IsMenu() && selectPopup_->IsTV()) {
201 AdjustTvChildHorizontalLayout(size, x, width);
202 return;
203 }
204 if (selectPopup_ && selectPopup_->GetTextDirection() == TextDirection::RTL) {
205 // align right for select popup dialog
206 double space = selectRightBottom_.GetX();
207 width = (space > size.Width() + normalPadding_ ? size.Width() : space - normalPadding_);
208 x = space - width;
209 } else {
210 x = selectLeftTop_.GetX();
211 width = (rightSpace > size.Width() + normalPadding_ ? size.Width() : rightSpace - normalPadding_);
212 }
213 return;
214 }
215
216 double leftSpace = selectLeftTop_.GetX();
217 // think about left padding and right padding
218 if (rightSpace >= size.Width() + 2.0 * normalPadding_) {
219 x = selectLeftTop_.GetX() + normalPadding_;
220 width = size.Width();
221 return;
222 }
223
224 if (rightSpace >= leftSpace) {
225 x = selectLeftTop_.GetX() + normalPadding_;
226 // think about left padding and right padding
227 width = rightSpace - 2.0 * normalPadding_;
228 return;
229 }
230
231 // think about left padding and right padding
232 if (leftSpace >= size.Width() + 2.0 * normalPadding_) {
233 width = size.Width();
234 x = selectLeftTop_.GetX() - normalPadding_ - width;
235 return;
236 }
237
238 x = normalPadding_;
239 // think about left padding and right padding
240 width = leftSpace - 2.0 * normalPadding_;
241 }
242
AdjustChildLayout(Size & size)243 void RenderSelectPopup::AdjustChildLayout(Size& size)
244 {
245 double x = 0.0;
246 double width = 0.0;
247 AdjustChildHorizontalLayout(size, x, width);
248 double y = 0.0;
249 double height = 0.0;
250 AdjustChildVerticalLayout(size, y, height);
251 childLayoutParam_.SetFixedSize(Size(width, height));
252 size.SetWidth(width);
253 size.SetHeight(height);
254 childPosition_.SetX(x);
255 childPosition_.SetY(y);
256 }
257
CreateAnimation()258 void RenderSelectPopup::CreateAnimation()
259 {
260 if (animationCreated_) {
261 return;
262 }
263 if (selectPopup_) {
264 // When the popup is used for contextmenu, add the animation, the same with menu.
265 CreatePopupAnimation(selectPopup_->IsMenu() || selectPopup_->IsContextMenu());
266 }
267 animationCreated_ = true;
268 }
269
CreatePopupAnimation(bool isMenu)270 void RenderSelectPopup::CreatePopupAnimation(bool isMenu)
271 {
272 if (!selectPopup_ || !selectPopup_->GetTheme()) {
273 LOGE("select theme or select popup component is null.");
274 return;
275 }
276
277 auto theme = selectPopup_->GetTheme();
278 auto showScaleAnimation = AceType::MakeRefPtr<CurveAnimation<float>>(0.9f, 1.0f, Curves::FRICTION);
279 auto showAlphaAnimation = AceType::MakeRefPtr<CurveAnimation<float>>(0.0f, 1.0f, Curves::FAST_OUT_SLOW_IN);
280 TweenOption showOption;
281 showOption.SetDuration(theme->GetShowTime(isMenu));
282 showOption.SetTransformFloatAnimation(AnimationType::SCALE, showScaleAnimation);
283 showOption.SetOpacityAnimation(showAlphaAnimation);
284 selectPopup_->SetShowOption(showOption);
285
286 auto hideScaleAnimation = AceType::MakeRefPtr<CurveAnimation<float>>(1.0f, 0.9f, Curves::FRICTION);
287 auto hideAlphaAnimation = AceType::MakeRefPtr<CurveAnimation<float>>(1.0f, 0.0f, Curves::FAST_OUT_SLOW_IN);
288 TweenOption hideOption;
289 hideOption.SetDuration(theme->GetHideTime(isMenu));
290 hideOption.SetTransformFloatAnimation(AnimationType::SCALE, hideScaleAnimation);
291 hideOption.SetOpacityAnimation(hideAlphaAnimation);
292 selectPopup_->SetHideOption(hideOption);
293 }
294
PerformLayout()295 void RenderSelectPopup::PerformLayout()
296 {
297 if (ScreenDirectionSwitched()) {
298 return;
299 }
300 if (!renderRoot_ || !renderScroll_ || (isFullScreen_ && !renderPositioned_)) {
301 LOGE("render child is null.");
302 return;
303 }
304 verticalSpacing_ = Dimension(NormalizeToPx(verticalSpacing_), DimensionUnit::PX);
305 horizontalSpacing_ = Dimension(NormalizeToPx(horizontalSpacing_), DimensionUnit::PX);
306 contentSpacing_ = Dimension(NormalizeToPx(contentSpacing_), DimensionUnit::PX);
307 normalPadding_ = NormalizeToPx(rrectSize_);
308 globalRightBottom_ = Offset() + renderRoot_->GetLayoutSize();
309 double outPadding = NormalizeToPx(4.0_vp); // the out padding is 4dp from doc.
310 Size totalSize;
311 double fixHeight = 0.0;
312 if (renderTitleBox_) {
313 renderTitleBox_->Layout(LayoutParam());
314 totalSize = renderTitleBox_->GetLayoutSize();
315 // add 8.0dp delta width for title so that it will show full title.
316 totalSize.SetWidth(totalSize.Width() + NormalizeToPx(8.0_vp));
317 fixHeight = totalSize.Height();
318 }
319 for (const auto& option : renderOptions_) {
320 if (selectLeftTop_ != selectRightBottom_ && selectPopup_ && !selectPopup_->IsMenu()) {
321 option->SetMaxWidth(
322 (selectPopup_->GetTextDirection() == TextDirection::RTL
323 ? selectRightBottom_.GetX() - normalPadding_ - 2.0 * outPadding
324 : globalRightBottom_.GetX() - selectLeftTop_.GetX() - normalPadding_ - 2.0 * outPadding));
325 } else if (selectLeftTop_ == selectRightBottom_ && selectPopup_ && selectPopup_->IsMenu()) {
326 auto leftSpace = selectLeftTop_.GetX();
327 auto rightSpace = globalRightBottom_.GetX() - leftSpace;
328 leftSpace -= 2.0 * normalPadding_ + 2.0 * outPadding;
329 rightSpace -= 2.0 * normalPadding_ + 2.0 * outPadding;
330 option->SetMaxWidth(std::max(leftSpace, rightSpace));
331 }
332
333 option->Layout(LayoutParam());
334 if (option->GetLayoutSize().Width() > totalSize.Width()) {
335 totalSize.SetWidth(option->GetLayoutSize().Width());
336 }
337 totalSize.AddHeight(option->GetLayoutSize().Height());
338 }
339 if (totalSize.Width() < NormalizeToPx(minWidth_)) {
340 totalSize.SetWidth(NormalizeToPx(minWidth_));
341 }
342 totalSize.AddHeight(2.0 * outPadding);
343 totalSize.AddWidth(2.0 * outPadding);
344
345 AdjustChildLayout(totalSize);
346 for (const auto& option : renderOptions_) {
347 // leave the space of 8.0dp for interval of innner and out box.
348 option->SetFixedWidth(totalSize.Width() - 2.0 * outPadding);
349 }
350 if (isFullScreen_) {
351 renderPositioned_->SetPosition(childPosition_);
352 renderPositioned_->Layout(childLayoutParam_);
353 } else {
354 if (GetChildren().front()) {
355 GetChildren().front()->Layout(childLayoutParam_);
356 }
357 }
358 LayoutParam scrollLayout;
359 scrollLayout.SetFixedSize(
360 Size(totalSize.Width() - 2.0 * outPadding, totalSize.Height() - fixHeight - 2.0 * outPadding));
361 renderScroll_->Layout(scrollLayout);
362 if (renderTitleBox_) {
363 LayoutParam layout;
364 layout.SetFixedSize(Size(totalSize.Width() - 2.0 * outPadding, renderTitleBox_->GetLayoutSize().Height()));
365 renderTitleBox_->Layout(layout);
366 }
367
368 if (isFullScreen_) {
369 SetLayoutSize(GetLayoutParam().GetMaxSize());
370 touchRegion_ = TouchRegion(
371 renderPositioned_->GetPosition(), renderPositioned_->GetPosition() + renderPositioned_->GetLayoutSize());
372 } else {
373 if (GetChildren().front()) {
374 SetLayoutSize(GetChildren().front()->GetLayoutSize());
375 }
376 touchRegion_ = TouchRegion(GetPosition(), GetPosition() + GetLayoutSize());
377 }
378
379 CreateAnimation();
380 }
381
HandleRawEvent(const Offset & clickPosition)382 void RenderSelectPopup::HandleRawEvent(const Offset& clickPosition)
383 {
384 LOGD("Handle Raw Event, Position is %{public}s.", clickPosition.ToString().c_str());
385 if (touchRegion_.ContainsInRegion(clickPosition.GetX(), clickPosition.GetY())) {
386 LOGI("Contains the touch region.");
387 return;
388 }
389
390 if (!selectPopup_) {
391 return;
392 }
393 if (isContextMenu_) {
394 LOGI("Hide the contextmenu.");
395 selectPopup_->CloseContextMenu();
396 return;
397 }
398 selectPopup_->HideDialog(SELECT_INVALID_INDEX);
399 }
400
ProcessTouchDown(const TouchEventInfo & info)401 void RenderSelectPopup::ProcessTouchDown(const TouchEventInfo& info)
402 {
403 LOGI("ProcessTouchDown");
404 auto touches = info.GetTouches();
405 if (touches.empty()) {
406 LOGE("touch event info is empty.");
407 return;
408 }
409
410 auto clickPosition = touches.front().GetLocalLocation();
411 if (!touchRegion_.ContainsInRegion(clickPosition.GetX(), clickPosition.GetY())) {
412 LOGI("Do not contains the touch region.");
413 return;
414 }
415
416 firstFingerDownOffset_ = touches.front().GetGlobalLocation();
417 }
418
ProcessTouchUp(const TouchEventInfo & info)419 void RenderSelectPopup::ProcessTouchUp(const TouchEventInfo& info)
420 {
421 LOGI("ProcessTouchUp");
422 auto touches = info.GetTouches();
423 if (touches.empty()) {
424 LOGE("touch event info is empty.");
425 return;
426 }
427
428 auto clickPosition = touches.front().GetLocalLocation();
429 if (!touchRegion_.ContainsInRegion(clickPosition.GetX(), clickPosition.GetY())) {
430 LOGI("Do not contains the touch region.");
431 return;
432 }
433
434 if (selectPopup_->GetSelectOptions().empty()) {
435 return;
436 }
437
438 auto firstOption = selectPopup_->GetSelectOptions().front();
439 if (!firstOption->GetCustomComponent()) {
440 return;
441 }
442
443 auto offset = touches.front().GetGlobalLocation();
444 firstFingerUpOffset_ = offset;
445 if ((offset - firstFingerDownOffset_).GetDistance() <= DEFAULT_DISTANCE) {
446 if (isContextMenu_) {
447 selectPopup_->CloseContextMenu();
448 } else {
449 selectPopup_->HideDialog(SELECT_INVALID_INDEX);
450 }
451 firstFingerDownOffset_ = Offset();
452 }
453 }
454
OnTouchTestHit(const Offset & coordinateOffset,const TouchRestrict & touchRestrict,TouchTestResult & result)455 void RenderSelectPopup::OnTouchTestHit(
456 const Offset& coordinateOffset, const TouchRestrict& touchRestrict, TouchTestResult& result)
457 {
458 if (!dragDetector_) {
459 dragDetector_ = AceType::MakeRefPtr<FreeDragRecognizer>();
460 }
461 if (!longPressDetector_) {
462 longPressDetector_ = AceType::MakeRefPtr<LongPressRecognizer>(context_);
463 }
464 if (!clickDetector_) {
465 clickDetector_ = AceType::MakeRefPtr<ClickRecognizer>();
466 }
467
468 rawDetector_->SetOnTouchUp([weak = AceType::WeakClaim(this)](const TouchEventInfo& info) {
469 auto ref = weak.Upgrade();
470 if (!ref) {
471 LOGE("renderSelectPopup upgrade fail.");
472 return;
473 }
474
475 ref->ProcessTouchUp(info);
476 });
477
478 rawDetector_->SetOnTouchCancel([weak = AceType::WeakClaim(this)](const TouchEventInfo& info) {
479 auto ref = weak.Upgrade();
480 if (!ref) {
481 LOGE("renderSelectPopup upgrade fail.");
482 return;
483 }
484
485 ref->ProcessTouchUp(info);
486 });
487
488 rawDetector_->SetCoordinateOffset(coordinateOffset);
489 dragDetector_->SetCoordinateOffset(coordinateOffset);
490 longPressDetector_->SetCoordinateOffset(coordinateOffset);
491 clickDetector_->SetCoordinateOffset(coordinateOffset);
492 result.emplace_back(rawDetector_);
493 result.emplace_back(dragDetector_);
494 result.emplace_back(longPressDetector_);
495 result.emplace_back(clickDetector_);
496 }
497
GetReferenceRenders()498 void RenderSelectPopup::GetReferenceRenders()
499 {
500 auto context = context_.Upgrade();
501 if (!context) {
502 return;
503 }
504 auto pageElement = context->GetLastStack();
505 if (!pageElement) {
506 return;
507 }
508 renderRoot_ = pageElement->GetRenderNode();
509 renderOptions_.clear();
510 GetReferenceRenders(AceType::Claim(this));
511 }
512
GetReferenceRenders(const RefPtr<RenderNode> & render)513 void RenderSelectPopup::GetReferenceRenders(const RefPtr<RenderNode>& render)
514 {
515 if (!render) {
516 return;
517 }
518
519 if (AceType::InstanceOf<RenderBox>(render)) {
520 auto boxParent = render->GetParent().Upgrade();
521 if (boxParent && AceType::InstanceOf<RenderFlex>(boxParent)) {
522 renderTitleBox_ = AceType::DynamicCast<RenderBox>(render);
523 return;
524 }
525 }
526
527 if (AceType::InstanceOf<RenderOption>(render)) {
528 renderOptions_.emplace_back(AceType::DynamicCast<RenderOption>(render));
529 return;
530 }
531
532 if (AceType::InstanceOf<RenderPositioned>(render)) {
533 renderPositioned_ = AceType::DynamicCast<RenderPositioned>(render);
534 }
535
536 if (AceType::InstanceOf<RenderScroll>(render)) {
537 renderScroll_ = AceType::DynamicCast<RenderScroll>(render);
538 }
539
540 for (const auto& child : render->GetChildren()) {
541 GetReferenceRenders(child);
542 }
543 }
544
ClearReferenceRenders()545 void RenderSelectPopup::ClearReferenceRenders()
546 {
547 renderRoot_ = nullptr;
548 renderPositioned_ = nullptr;
549 renderTitleBox_ = nullptr;
550 renderScroll_ = nullptr;
551 renderOptions_.clear();
552 }
553
ScreenDirectionSwitched()554 bool RenderSelectPopup::ScreenDirectionSwitched()
555 {
556 auto pipeline = context_.Upgrade();
557 if (!pipeline) {
558 return false;
559 }
560
561 bool check = GreatNotEqual(pipeline->GetRootWidth(), pipeline->GetRootHeight());
562 bool switched = (!screenHorizontal_ && !screenVertical_) ? false : (check ? screenVertical_ : screenHorizontal_);
563 screenHorizontal_ = check;
564 screenVertical_ = !check;
565 if (switched && selectPopup_) {
566 selectPopup_->HideDialog(SELECT_INVALID_INDEX);
567 }
568 return switched;
569 }
570
HandleMouseEvent(const MouseEvent & event)571 bool RenderSelectPopup::HandleMouseEvent(const MouseEvent& event)
572 {
573 if (event.button != MouseButton::NONE_BUTTON && event.button != MouseButton::LEFT_BUTTON &&
574 event.action == MouseAction::PRESS) {
575 HandleRawEvent({ event.x, event.y });
576 }
577 return true;
578 }
579
580 } // namespace OHOS::Ace
581