Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Graphic Ui
提交
0b2e8333
G
Graphic Ui
项目概览
OpenHarmony
/
Graphic Ui
大约 1 年 前同步成功
通知
13
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Graphic Ui
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0b2e8333
编写于
3月 30, 2021
作者:
Y
YueBiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix rotate event bug for UIScrollView
上级
869ec4a9
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
17 addition
and
11 deletion
+17
-11
frameworks/components/ui_scroll_view.cpp
frameworks/components/ui_scroll_view.cpp
+14
-11
interfaces/kits/components/ui_scroll_view.h
interfaces/kits/components/ui_scroll_view.h
+3
-0
未找到文件。
frameworks/components/ui_scroll_view.cpp
浏览文件 @
0b2e8333
...
@@ -30,6 +30,8 @@ UIScrollView::UIScrollView()
...
@@ -30,6 +30,8 @@ UIScrollView::UIScrollView()
#if ENABLE_ROTATE_INPUT
#if ENABLE_ROTATE_INPUT
rotateFactor_
=
1
;
rotateFactor_
=
1
;
rotateThreshold_
=
4
;
// 4: which means 25% of half view size
rotateThreshold_
=
4
;
// 4: which means 25% of half view size
tmpRotateLen_
=
0
;
#endif
#endif
#if ENABLE_FOCUS_MANAGER
#if ENABLE_FOCUS_MANAGER
focusable_
=
true
;
focusable_
=
true
;
...
@@ -106,21 +108,22 @@ bool UIScrollView::OnPressEvent(const PressEvent& event)
...
@@ -106,21 +108,22 @@ bool UIScrollView::OnPressEvent(const PressEvent& event)
#if ENABLE_ROTATE_INPUT
#if ENABLE_ROTATE_INPUT
bool
UIScrollView
::
OnRotateEvent
(
const
RotateEvent
&
event
)
bool
UIScrollView
::
OnRotateEvent
(
const
RotateEvent
&
event
)
{
{
int16_t
tmpRotateLen
=
static_cast
<
int16_t
>
(
event
.
GetRotate
()
*
rotateFactor_
);
int16_t
midPointX
=
static_cast
<
int16_t
>
(
GetWidth
()
/
2
);
// 2 : Get the middle point X coord of the view
int16_t
midPointX
=
static_cast
<
int16_t
>
(
GetWidth
()
/
2
);
// 2 : Get the middle point X coord of the view
int16_t
midPointY
=
static_cast
<
int16_t
>
(
GetHeight
()
/
2
);
// 2 : Get the middle point Y coord of the view
int16_t
midPointY
=
static_cast
<
int16_t
>
(
GetHeight
()
/
2
);
// 2 : Get the middle point Y coord of the view
Point
last
,
current
;
Point
last
,
current
;
if
(
!
throwDrag_
||
((
MATH_ABS
(
tmpRotateLen
)
<
(
midPointX
/
rotateThreshold_
))
&&
if
(
throwDrag_
&&
event
.
GetRotate
()
==
0
)
{
(
MATH_ABS
(
tmpRotateLen
)
<
(
midPointY
/
rotateThreshold_
))))
{
yScrollable_
?
ScrollBy
(
0
,
tmpRotateLen
)
:
ScrollBy
(
tmpRotateLen
,
0
);
if
(
event
.
GetRotate
()
==
0
)
{
DragThrowAnimator
(
Point
{
0
,
0
},
Point
{
0
,
0
});
}
}
else
{
last
=
Point
{
midPointX
,
midPointY
};
last
=
Point
{
midPointX
,
midPointY
};
yScrollable_
?
(
current
=
Point
{
midPointX
,
static_cast
<
int16_t
>
(
midPointY
+
tmpRotateLen
)})
yScrollable_
?
(
current
=
Point
{
midPointX
,
static_cast
<
int16_t
>
(
midPointY
+
tmpRotateLen
_
)})
:
(
current
=
Point
{
static_cast
<
int16_t
>
(
midPointX
+
tmpRotateLen
),
midPointY
});
:
(
current
=
Point
{
static_cast
<
int16_t
>
(
midPointX
+
tmpRotateLen
_
),
midPointY
});
DragThrowAnimator
(
current
,
last
);
DragThrowAnimator
(
current
,
last
);
tmpRotateLen_
=
0
;
}
else
{
tmpRotateLen_
=
static_cast
<
int16_t
>
(
event
.
GetRotate
()
*
rotateFactor_
);
if
(
yScrollable_
)
{
DragYInner
(
tmpRotateLen_
);
}
else
{
DragXInner
(
tmpRotateLen_
);
}
}
}
#if ENABLE_MOTOR
#if ENABLE_MOTOR
MotorFunc
motorFunc
=
FocusManager
::
GetInstance
()
->
GetMotorFunc
();
MotorFunc
motorFunc
=
FocusManager
::
GetInstance
()
->
GetMotorFunc
();
...
@@ -417,4 +420,4 @@ void UIScrollView::StopAnimator()
...
@@ -417,4 +420,4 @@ void UIScrollView::StopAnimator()
}
}
UIAbstractScroll
::
StopAnimator
();
UIAbstractScroll
::
StopAnimator
();
}
}
}
// namespace OHOS
}
// namespace OHOS
\ No newline at end of file
interfaces/kits/components/ui_scroll_view.h
浏览文件 @
0b2e8333
...
@@ -292,6 +292,9 @@ private:
...
@@ -292,6 +292,9 @@ private:
bool
yScrollable_
;
bool
yScrollable_
;
int16_t
minScrollBarLen_
;
int16_t
minScrollBarLen_
;
OnScrollListener
*
scrollListener_
;
OnScrollListener
*
scrollListener_
;
#if ENABLE_ROTATE_INPUT
int16_t
tmpRotateLen_
;
#endif
};
};
}
// namespace OHOS
}
// namespace OHOS
#endif // GRAPHIC_LITE_UI_SCROLL_VIEW_H
#endif // GRAPHIC_LITE_UI_SCROLL_VIEW_H
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录