Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
疯人忠
Cvat
提交
b12ae347
C
Cvat
项目概览
疯人忠
/
Cvat
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
Cvat
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b12ae347
编写于
3月 24, 2020
作者:
B
Boris Sekachev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixed input numbers in player settings
上级
e55deb71
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
37 addition
and
46 deletion
+37
-46
cvat-ui/src/components/annotation-page/top-bar/player-navigation.tsx
.../components/annotation-page/top-bar/player-navigation.tsx
+3
-7
cvat-ui/src/components/settings-page/player-settings.tsx
cvat-ui/src/components/settings-page/player-settings.tsx
+23
-28
cvat-ui/src/components/settings-page/workspace-settings.tsx
cvat-ui/src/components/settings-page/workspace-settings.tsx
+7
-11
cvat-ui/src/utils/math.ts
cvat-ui/src/utils/math.ts
+4
-0
未找到文件。
cvat-ui/src/components/annotation-page/top-bar/player-navigation.tsx
浏览文件 @
b12ae347
...
...
@@ -11,6 +11,8 @@ import Tooltip from 'antd/lib/tooltip';
import
InputNumber
from
'
antd/lib/input-number
'
;
import
Text
from
'
antd/lib/typography/Text
'
;
import
{
clamp
}
from
'
utils/math
'
;
interface
Props
{
startFrame
:
number
;
stopFrame
:
number
;
...
...
@@ -69,13 +71,7 @@ function PlayerNavigation(props: Props): JSX.Element {
// https://stackoverflow.com/questions/38256332/in-react-whats-the-difference-between-onchange-and-oninput
onChange
=
{
(
value
:
number
|
undefined
)
=>
{
if
(
typeof
(
value
)
===
'
number
'
)
{
setFrameInputValue
(
Math
.
max
(
Math
.
min
(
Number
(
value
),
stopFrame
,
),
startFrame
,
),
);
setFrameInputValue
(
clamp
(
value
,
stopFrame
,
startFrame
));
}
}
}
onBlur
=
{
()
=>
{
...
...
cvat-ui/src/components/settings-page/player-settings.tsx
浏览文件 @
b12ae347
...
...
@@ -4,28 +4,17 @@
import
React
from
'
react
'
;
import
{
Row
,
Col
,
Checkbox
,
Slider
,
Select
,
InputNumber
,
Icon
,
}
from
'
antd
'
;
import
{
Row
,
Col
}
from
'
antd/lib/grid
'
;
import
Checkbox
,
{
CheckboxChangeEvent
}
from
'
antd/lib/checkbox
'
;
import
Slider
from
'
antd/lib/slider
'
;
import
Select
from
'
antd/lib/select
'
;
import
InputNumber
from
'
antd/lib/input-number
'
;
import
Icon
from
'
antd/lib/icon
'
;
import
Text
from
'
antd/lib/typography/Text
'
;
import
{
CheckboxChangeEvent
}
from
'
antd/lib/checkbox
'
;
import
{
BackJumpIcon
,
ForwardJumpIcon
,
}
from
'
icons
'
;
import
{
FrameSpeed
,
GridColor
,
}
from
'
reducers/interfaces
'
;
import
{
clamp
}
from
'
utils/math
'
;
import
{
BackJumpIcon
,
ForwardJumpIcon
}
from
'
icons
'
;
import
{
FrameSpeed
,
GridColor
}
from
'
reducers/interfaces
'
;
interface
Props
{
frameStep
:
number
;
...
...
@@ -78,18 +67,24 @@ export default function PlayerSettingsComponent(props: Props): JSX.Element {
onChangeSaturationLevel
,
}
=
props
;
const
minFrameStep
=
2
;
const
maxFrameStep
=
1000
;
const
minGridSize
=
5
;
const
maxGridSize
=
1000
;
return
(
<
div
className
=
'cvat-player-settings'
>
<
Row
type
=
'flex'
align
=
'bottom'
className
=
'cvat-player-settings-step'
>
<
Col
>
<
Text
className
=
'cvat-text-color'
>
Player step
</
Text
>
<
InputNumber
min
=
{
2
}
max
=
{
1000
}
min
=
{
minFrameStep
}
max
=
{
maxFrameStep
}
value
=
{
frameStep
}
onChange
=
{
(
value
:
number
|
undefined
):
void
=>
{
if
(
value
)
{
onChangeFrameStep
(
value
);
if
(
typeof
(
value
)
===
'
number
'
)
{
onChangeFrameStep
(
clamp
(
value
,
minFrameStep
,
maxFrameStep
)
);
}
}
}
/>
...
...
@@ -138,14 +133,14 @@ export default function PlayerSettingsComponent(props: Props): JSX.Element {
<
Col
span
=
{
8
}
className
=
'cvat-player-settings-grid-size'
>
<
Text
className
=
'cvat-text-color'
>
Grid size
</
Text
>
<
InputNumber
min
=
{
5
}
max
=
{
1000
}
min
=
{
minGridSize
}
max
=
{
maxGridSize
}
step
=
{
1
}
value
=
{
gridSize
}
disabled
=
{
!
grid
}
onChange
=
{
(
value
:
number
|
undefined
):
void
=>
{
if
(
value
)
{
onChangeGridSize
(
value
);
if
(
typeof
(
value
)
===
'
number
'
)
{
onChangeGridSize
(
clamp
(
value
,
minGridSize
,
maxGridSize
)
);
}
}
}
/>
...
...
cvat-ui/src/components/settings-page/workspace-settings.tsx
浏览文件 @
b12ae347
...
...
@@ -9,6 +9,8 @@ import Checkbox, { CheckboxChangeEvent } from 'antd/lib/checkbox';
import
InputNumber
from
'
antd/lib/input-number
'
;
import
Text
from
'
antd/lib/typography/Text
'
;
import
{
clamp
}
from
'
utils/math
'
;
interface
Props
{
autoSave
:
boolean
;
autoSaveInterval
:
number
;
...
...
@@ -63,10 +65,10 @@ export default function WorkspaceSettingsComponent(props: Props): JSX.Element {
onChange
=
{
(
value
:
number
|
undefined
):
void
=>
{
if
(
typeof
(
value
)
===
'
number
'
)
{
onChangeAutoSaveInterval
(
Math
.
max
(
Math
.
min
(
Number
(
value
),
max
AutoSaveInterval
,
),
min
AutoSaveInterval
,
clamp
(
value
,
min
AutoSaveInterval
,
max
AutoSaveInterval
,
)
*
60
*
1000
,
);
}
...
...
@@ -100,13 +102,7 @@ export default function WorkspaceSettingsComponent(props: Props): JSX.Element {
value
=
{
aamZoomMargin
}
onChange
=
{
(
value
:
number
|
undefined
):
void
=>
{
if
(
typeof
(
value
)
===
'
number
'
)
{
onChangeAAMZoomMargin
(
Math
.
max
(
Math
.
min
(
Number
(
value
),
maxAAMMargin
,
),
minAAMMargin
,
),
);
onChangeAAMZoomMargin
(
clamp
(
value
,
minAAMMargin
,
maxAAMMargin
));
}
}
}
/>
...
...
cvat-ui/src/utils/math.ts
0 → 100644
浏览文件 @
b12ae347
/* eslint-disable-next-line import/prefer-default-export */
export
function
clamp
(
value
:
number
,
min
:
number
,
max
:
number
):
number
{
return
Math
.
max
(
Math
.
min
(
value
,
max
),
min
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录