Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Graphic Ui
提交
a41d63bb
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,发现更多精彩内容 >>
提交
a41d63bb
编写于
4月 01, 2021
作者:
Y
YueBiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix codestyle bugs
上级
97a5cc07
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
22 addition
and
21 deletion
+22
-21
frameworks/components/ui_slider.cpp
frameworks/components/ui_slider.cpp
+8
-4
frameworks/components/ui_swipe_view.cpp
frameworks/components/ui_swipe_view.cpp
+9
-12
test/uitest/test_rotate_input/ui_test_rotate_input.cpp
test/uitest/test_rotate_input/ui_test_rotate_input.cpp
+2
-2
test/uitest/test_slider/ui_test_slider.cpp
test/uitest/test_slider/ui_test_slider.cpp
+3
-3
未找到文件。
frameworks/components/ui_slider.cpp
浏览文件 @
a41d63bb
...
@@ -220,7 +220,8 @@ void UISlider::DrawForeground(const Rect& invalidatedArea, Rect& coords)
...
@@ -220,7 +220,8 @@ void UISlider::DrawForeground(const Rect& invalidatedArea, Rect& coords)
switch
(
direction_
)
{
switch
(
direction_
)
{
case
Direction
::
DIR_LEFT_TO_RIGHT
:
{
case
Direction
::
DIR_LEFT_TO_RIGHT
:
{
length
=
GetCurrentPos
(
progressWidth_
-
1
);
length
=
GetCurrentPos
(
progressWidth_
-
1
);
coords
.
SetRect
(
startPoint
.
x
,
startPoint
.
y
,
startPoint
.
x
+
progressWidth
-
1
,
startPoint
.
y
+
progressHeight_
-
1
);
coords
.
SetRect
(
startPoint
.
x
,
startPoint
.
y
,
startPoint
.
x
+
progressWidth
-
1
,
startPoint
.
y
+
progressHeight_
-
1
);
left
=
startPoint
.
x
-
radius
-
1
;
left
=
startPoint
.
x
-
radius
-
1
;
right
=
left
+
length
;
right
=
left
+
length
;
...
@@ -229,7 +230,8 @@ void UISlider::DrawForeground(const Rect& invalidatedArea, Rect& coords)
...
@@ -229,7 +230,8 @@ void UISlider::DrawForeground(const Rect& invalidatedArea, Rect& coords)
}
}
case
Direction
::
DIR_RIGHT_TO_LEFT
:
{
case
Direction
::
DIR_RIGHT_TO_LEFT
:
{
length
=
GetCurrentPos
(
progressWidth_
-
1
);
length
=
GetCurrentPos
(
progressWidth_
-
1
);
coords
.
SetRect
(
startPoint
.
x
,
startPoint
.
y
,
startPoint
.
x
+
progressWidth
-
1
,
startPoint
.
y
+
progressHeight_
-
1
);
coords
.
SetRect
(
startPoint
.
x
,
startPoint
.
y
,
startPoint
.
x
+
progressWidth
-
1
,
startPoint
.
y
+
progressHeight_
-
1
);
right
=
startPoint
.
x
+
progressWidth
+
radius
+
1
;
right
=
startPoint
.
x
+
progressWidth
+
radius
+
1
;
left
=
right
-
length
;
left
=
right
-
length
;
...
@@ -238,7 +240,8 @@ void UISlider::DrawForeground(const Rect& invalidatedArea, Rect& coords)
...
@@ -238,7 +240,8 @@ void UISlider::DrawForeground(const Rect& invalidatedArea, Rect& coords)
}
}
case
Direction
::
DIR_TOP_TO_BOTTOM
:
{
case
Direction
::
DIR_TOP_TO_BOTTOM
:
{
length
=
GetCurrentPos
(
progressHeight_
-
1
);
length
=
GetCurrentPos
(
progressHeight_
-
1
);
coords
.
SetRect
(
startPoint
.
x
,
startPoint
.
y
,
startPoint
.
x
+
progressWidth_
-
1
,
startPoint
.
y
+
progressHeight
-
1
);
coords
.
SetRect
(
startPoint
.
x
,
startPoint
.
y
,
startPoint
.
x
+
progressWidth_
-
1
,
startPoint
.
y
+
progressHeight
-
1
);
top
=
startPoint
.
y
-
radius
+
1
;
top
=
startPoint
.
y
-
radius
+
1
;
bottom
=
top
+
length
;
bottom
=
top
+
length
;
...
@@ -247,7 +250,8 @@ void UISlider::DrawForeground(const Rect& invalidatedArea, Rect& coords)
...
@@ -247,7 +250,8 @@ void UISlider::DrawForeground(const Rect& invalidatedArea, Rect& coords)
}
}
case
Direction
::
DIR_BOTTOM_TO_TOP
:
{
case
Direction
::
DIR_BOTTOM_TO_TOP
:
{
length
=
GetCurrentPos
(
progressHeight_
-
1
);
length
=
GetCurrentPos
(
progressHeight_
-
1
);
coords
.
SetRect
(
startPoint
.
x
,
startPoint
.
y
,
startPoint
.
x
+
progressWidth_
-
1
,
startPoint
.
y
+
progressHeight
-
1
);
coords
.
SetRect
(
startPoint
.
x
,
startPoint
.
y
,
startPoint
.
x
+
progressWidth_
-
1
,
startPoint
.
y
+
progressHeight
-
1
);
bottom
=
startPoint
.
y
+
progressHeight
+
radius
+
1
;
bottom
=
startPoint
.
y
+
progressHeight
+
radius
+
1
;
top
=
bottom
-
length
;
top
=
bottom
-
length
;
...
...
frameworks/components/ui_swipe_view.cpp
浏览文件 @
a41d63bb
...
@@ -18,11 +18,7 @@
...
@@ -18,11 +18,7 @@
namespace
OHOS
{
namespace
OHOS
{
UISwipeView
::
UISwipeView
(
uint8_t
direction
)
UISwipeView
::
UISwipeView
(
uint8_t
direction
)
:
swipeListener_
(
nullptr
),
:
swipeListener_
(
nullptr
),
curIndex_
(
0
),
blankSize_
(
DEFAULT_BLANK_SIZE
),
curView_
(
nullptr
),
loop_
(
false
)
curIndex_
(
0
),
blankSize_
(
DEFAULT_BLANK_SIZE
),
curView_
(
nullptr
),
loop_
(
false
)
{
{
#if ENABLE_ROTATE_INPUT
#if ENABLE_ROTATE_INPUT
rotateFactor_
=
1
;
rotateFactor_
=
1
;
...
@@ -177,7 +173,7 @@ bool UISwipeView::OnRotateEvent(const RotateEvent& event)
...
@@ -177,7 +173,7 @@ bool UISwipeView::OnRotateEvent(const RotateEvent& event)
return
UIView
::
OnRotateEvent
(
event
);
return
UIView
::
OnRotateEvent
(
event
);
}
}
if
(
event
.
GetRotate
()
!=
0
)
{
if
(
event
.
GetRotate
()
!=
0
)
{
int8_t
sign
=
rotateFactor_
<
0
?
-
1
:
1
;
int8_t
sign
=
(
rotateFactor_
<
0
)
?
-
1
:
1
;
// 4 : need to fit for the device
// 4 : need to fit for the device
if
(
MATH_ABS
(
event
.
GetRotate
())
>
blankSize_
/
(
4
*
static_cast
<
uint16_t
>
(
MATH_ABS
(
rotateFactor_
))))
{
if
(
MATH_ABS
(
event
.
GetRotate
())
>
blankSize_
/
(
4
*
static_cast
<
uint16_t
>
(
MATH_ABS
(
rotateFactor_
))))
{
SwitchToPage
(
curIndex_
-
sign
*
event
.
GetRotate
());
SwitchToPage
(
curIndex_
-
sign
*
event
.
GetRotate
());
...
@@ -306,8 +302,9 @@ void UISwipeView::SortChild()
...
@@ -306,8 +302,9 @@ void UISwipeView::SortChild()
loop_
=
tmpLoop
;
loop_
=
tmpLoop
;
}
}
void
UISwipeView
::
RefreshCurrentViewInner
(
int16_t
distance
,
int16_t
(
UIView
::*
pfnGetXOrY
)()
const
,
void
UISwipeView
::
RefreshCurrentViewInner
(
int16_t
distance
,
int16_t
(
UIView
::*
pfnGetWidthOrHeight
)())
int16_t
(
UIView
::*
pfnGetXOrY
)()
const
,
int16_t
(
UIView
::*
pfnGetWidthOrHeight
)())
{
{
if
(
childrenHead_
==
nullptr
)
{
if
(
childrenHead_
==
nullptr
)
{
curIndex_
=
0
;
curIndex_
=
0
;
...
@@ -356,8 +353,8 @@ void UISwipeView::RefreshCurrentViewInner(int16_t distance, int16_t (UIView::*pf
...
@@ -356,8 +353,8 @@ void UISwipeView::RefreshCurrentViewInner(int16_t distance, int16_t (UIView::*pf
* that is, the x or y coordinate plus 7/10 width or height.
* that is, the x or y coordinate plus 7/10 width or height.
*/
*/
if
(((
curView_
->*
pfnGetXOrY
)()
+
((
curView_
->*
pfnGetWidthOrHeight
)()
>>
1
)
<
swipeMid
)
&&
if
(((
curView_
->*
pfnGetXOrY
)()
+
((
curView_
->*
pfnGetWidthOrHeight
)()
>>
1
)
<
swipeMid
)
&&
((
curView_
->*
pfnGetXOrY
)()
+
((
curView_
->*
pfnGetWidthOrHeight
)()
*
7
/
10
)
-
((
curView_
->*
pfnGetXOrY
)()
+
((
curView_
->*
pfnGetWidthOrHeight
)()
*
7
/
10
)
-
accelerationOffset
<
accelerationOffset
<
swipeMid
))
{
swipeMid
))
{
curIndex_
++
;
curIndex_
++
;
}
}
}
else
if
(
distance
>
0
)
{
}
else
if
(
distance
>
0
)
{
...
@@ -366,8 +363,8 @@ void UISwipeView::RefreshCurrentViewInner(int16_t distance, int16_t (UIView::*pf
...
@@ -366,8 +363,8 @@ void UISwipeView::RefreshCurrentViewInner(int16_t distance, int16_t (UIView::*pf
* that is, the x or y coordinate plus 3/10 width or height.
* that is, the x or y coordinate plus 3/10 width or height.
*/
*/
if
(((
curView_
->*
pfnGetXOrY
)()
+
((
curView_
->*
pfnGetWidthOrHeight
)()
>>
1
)
>
swipeMid
)
&&
if
(((
curView_
->*
pfnGetXOrY
)()
+
((
curView_
->*
pfnGetWidthOrHeight
)()
>>
1
)
>
swipeMid
)
&&
((
curView_
->*
pfnGetXOrY
)()
+
((
curView_
->*
pfnGetWidthOrHeight
)()
*
3
/
10
)
+
((
curView_
->*
pfnGetXOrY
)()
+
((
curView_
->*
pfnGetWidthOrHeight
)()
*
3
/
10
)
+
accelerationOffset
>
accelerationOffset
>
swipeMid
))
{
swipeMid
))
{
curIndex_
--
;
curIndex_
--
;
}
}
}
else
{
}
else
{
...
...
test/uitest/test_rotate_input/ui_test_rotate_input.cpp
浏览文件 @
a41d63bb
...
@@ -37,7 +37,7 @@ static int16_t g_sliderW = 40;
...
@@ -37,7 +37,7 @@ static int16_t g_sliderW = 40;
static
int16_t
g_sliderH
=
300
;
static
int16_t
g_sliderH
=
300
;
static
int16_t
g_testButtonW
=
80
;
static
int16_t
g_testButtonW
=
80
;
static
int16_t
g_testButtonH
=
40
;
static
int16_t
g_testButtonH
=
40
;
static
const
char
*
g_pickerRange
[]
=
{
"A0"
,
"B1"
,
"C2"
,
"D3"
,
"E4"
,
"F5"
,
"G6"
,
"H7"
,
"I8"
,
"J9"
,
"K10"
,
"L11"
};
static
const
char
*
g_pickerRange
[]
=
{
"A0"
,
"B1"
,
"C2"
,
"D3"
,
"E4"
,
"F5"
,
"G6"
,
"H7"
,
"I8"
,
"J9"
,
"K10"
,
"L11"
};
#if ENABLE_MOTOR
#if ENABLE_MOTOR
void
Print
(
MotorType
motorType
)
void
Print
(
MotorType
motorType
)
...
@@ -190,7 +190,7 @@ void UITestRotateInput::UIKit_Rotate_Event_List_001()
...
@@ -190,7 +190,7 @@ void UITestRotateInput::UIKit_Rotate_Event_List_001()
list_
->
SetOnTouchListener
(
this
);
list_
->
SetOnTouchListener
(
this
);
list_
->
SetThrowDrag
(
true
);
list_
->
SetThrowDrag
(
true
);
list_
->
SetRotateFactor
(
10
);
// 10 : rotate factor
list_
->
SetRotateFactor
(
10
);
// 10 : rotate factor
list_
->
SetReboundSize
(
50
);
// 50 : rebound size
list_
->
SetReboundSize
(
50
);
// 50 : rebound size
container_
->
Add
(
list_
);
container_
->
Add
(
list_
);
SetLastPos
(
list_
);
SetLastPos
(
list_
);
}
}
...
...
test/uitest/test_slider/ui_test_slider.cpp
浏览文件 @
a41d63bb
...
@@ -432,9 +432,9 @@ bool UITestSlider::OnClick(UIView& view, const ClickEvent& event)
...
@@ -432,9 +432,9 @@ bool UITestSlider::OnClick(UIView& view, const ClickEvent& event)
slider_
->
SetBackgroundStyle
(
StyleDefault
::
GetProgressBackgroundStyle
());
slider_
->
SetBackgroundStyle
(
StyleDefault
::
GetProgressBackgroundStyle
());
slider_
->
SetForegroundStyle
(
StyleDefault
::
GetProgressForegroundStyle
());
slider_
->
SetForegroundStyle
(
StyleDefault
::
GetProgressForegroundStyle
());
#if ENABLE_SLIDER_KNOB
#if ENABLE_SLIDER_KNOB
slider_
->
SetKnobStyle
(
StyleDefault
::
GetSliderKnobStyle
());
slider_
->
SetKnobStyle
(
StyleDefault
::
GetSliderKnobStyle
());
slider_
->
SetImage
(
static_cast
<
ImageInfo
*>
(
nullptr
),
static_cast
<
ImageInfo
*>
(
nullptr
),
slider_
->
SetImage
(
static_cast
<
ImageInfo
*>
(
nullptr
),
static_cast
<
ImageInfo
*>
(
nullptr
),
static_cast
<
ImageInfo
*>
(
nullptr
));
static_cast
<
ImageInfo
*>
(
nullptr
));
#endif
#endif
slider_
->
EnableBackground
(
true
);
slider_
->
EnableBackground
(
true
);
}
else
if
(
&
view
==
incProgressBtn_
)
{
}
else
if
(
&
view
==
incProgressBtn_
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录