Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
疯人忠
Cvat
提交
785edcb2
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,发现更多精彩内容 >>
未验证
提交
785edcb2
编写于
12月 01, 2022
作者:
B
Boris Sekachev
提交者:
GitHub
12月 01, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Allow dragging 3D canvas in IDLE mode (#5385)
上级
00228ab7
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
95 addition
and
26 deletion
+95
-26
CHANGELOG.md
CHANGELOG.md
+1
-0
cvat-canvas3d/package.json
cvat-canvas3d/package.json
+1
-1
cvat-canvas3d/src/typescript/canvas3dView.ts
cvat-canvas3d/src/typescript/canvas3dView.ts
+61
-21
tests/cypress/integration/canvas3d_functionality/case_86_canvas3d_functionality_move_image_button.js
...ality/case_86_canvas3d_functionality_move_image_button.js
+5
-4
tests/cypress/integration/canvas3d_functionality_2/case_56_canvas3d_functionality_basic_actions.js
...onality_2/case_56_canvas3d_functionality_basic_actions.js
+27
-0
未找到文件。
CHANGELOG.md
浏览文件 @
785edcb2
...
...
@@ -24,6 +24,7 @@ from online detectors & interactors) (<https://github.com/opencv/cvat/pull/4543>
### Changed
-
`api/docs`
,
`api/swagger`
,
`api/schema`
,
`server/about`
endpoints now allow unauthorized access (
<https://github.com/opencv/cvat/pull/4928>
,
<https://github.com/opencv/cvat/pull/4935>
)
-
3D canvas now can be dragged in IDLE mode (
<https://github.com/opencv/cvat/pull/5385>
)
-
Datumaro version is upgraded to 0.3 (dev) (
<https://github.com/opencv/cvat/pull/4984>
)
-
Allowed trailing slashes in the SDK host address (
<https://github.com/opencv/cvat/pull/5057>
)
-
Enabled authentication via email (
<https://github.com/opencv/cvat/pull/5037>
)
...
...
cvat-canvas3d/package.json
浏览文件 @
785edcb2
{
"name"
:
"cvat-canvas3d"
,
"version"
:
"0.0.
1
"
,
"version"
:
"0.0.
2
"
,
"description"
:
"Part of Computer Vision Annotation Tool which presents its canvas3D library"
,
"main"
:
"src/canvas3d.ts"
,
"scripts"
:
{
...
...
cvat-canvas3d/src/typescript/canvas3dView.ts
浏览文件 @
785edcb2
// Copyright (C) 2021-2022 Intel Corporation
// Copyright (C) 2022 CVAT.ai Corporation
//
// SPDX-License-Identifier: MIT
...
...
@@ -76,6 +77,7 @@ export class Canvas3dViewImpl implements Canvas3dView, Listener {
private
cube
:
CuboidModel
;
private
highlighted
:
boolean
;
private
selected
:
CubeObject
;
private
isPerspectiveBeingDragged
:
boolean
;
private
model
:
Canvas3dModel
&
Master
;
private
action
:
any
;
private
globalHelpers
:
any
;
...
...
@@ -94,6 +96,7 @@ export class Canvas3dViewImpl implements Canvas3dView, Listener {
this
.
speed
=
CONST
.
MOVEMENT_FACTOR
;
this
.
cube
=
new
CuboidModel
(
'
line
'
,
'
#ffffff
'
);
this
.
highlighted
=
false
;
this
.
isPerspectiveBeingDragged
=
false
;
this
.
selected
=
this
.
cube
;
this
.
model
=
model
;
this
.
globalHelpers
=
{
...
...
@@ -249,6 +252,15 @@ export class Canvas3dViewImpl implements Canvas3dView, Listener {
}
});
canvasPerspectiveView
.
addEventListener
(
'
mousedown
'
,
this
.
onPerspectiveDrag
);
window
.
document
.
addEventListener
(
'
mouseup
'
,
()
=>
{
this
.
disablePerspectiveDragging
();
if
(
this
.
isPerspectiveBeingDragged
&&
this
.
mode
!==
Mode
.
DRAG_CANVAS
)
{
// call this body only of drag was activated inside the canvas, but not globally
this
.
isPerspectiveBeingDragged
=
false
;
}
});
canvasTopView
.
addEventListener
(
'
mousedown
'
,
this
.
startAction
.
bind
(
this
,
'
top
'
));
canvasSideView
.
addEventListener
(
'
mousedown
'
,
this
.
startAction
.
bind
(
this
,
'
side
'
));
canvasFrontView
.
addEventListener
(
'
mousedown
'
,
this
.
startAction
.
bind
(
this
,
'
front
'
));
...
...
@@ -276,8 +288,11 @@ export class Canvas3dViewImpl implements Canvas3dView, Listener {
canvasPerspectiveView
.
addEventListener
(
'
click
'
,
(
e
:
MouseEvent
):
void
=>
{
e
.
preventDefault
();
if
(
e
.
detail
!==
1
)
return
;
if
(
!
[
Mode
.
GROUP
,
Mode
.
IDLE
].
includes
(
this
.
mode
)
||
!
this
.
views
.
perspective
.
rayCaster
)
return
;
const
selectionIsBlocked
=
!
[
Mode
.
GROUP
,
Mode
.
IDLE
].
includes
(
this
.
mode
)
||
!
this
.
views
.
perspective
.
rayCaster
||
this
.
isPerspectiveBeingDragged
;
if
(
e
.
detail
!==
1
||
selectionIsBlocked
)
return
;
const
intersects
=
this
.
views
.
perspective
.
rayCaster
.
renderer
.
intersectObjects
(
this
.
views
.
perspective
.
scene
.
children
[
0
].
children
,
false
,
...
...
@@ -450,7 +465,6 @@ export class Canvas3dViewImpl implements Canvas3dView, Listener {
viewType
.
controls
=
new
CameraControls
(
viewType
.
camera
,
viewType
.
renderer
.
domElement
);
viewType
.
controls
.
mouseButtons
.
left
=
CameraControls
.
ACTION
.
NONE
;
viewType
.
controls
.
mouseButtons
.
right
=
CameraControls
.
ACTION
.
NONE
;
viewType
.
controls
.
mouseButtons
.
wheel
=
CameraControls
.
ACTION
.
NONE
;
viewType
.
controls
.
touches
.
one
=
CameraControls
.
ACTION
.
NONE
;
viewType
.
controls
.
touches
.
two
=
CameraControls
.
ACTION
.
NONE
;
viewType
.
controls
.
touches
.
three
=
CameraControls
.
ACTION
.
NONE
;
...
...
@@ -528,6 +542,30 @@ export class Canvas3dViewImpl implements Canvas3dView, Listener {
}
}
private
enablePerspectiveDragging
():
void
{
const
{
controls
}
=
this
.
views
.
perspective
;
controls
.
mouseButtons
.
left
=
CameraControls
.
ACTION
.
ROTATE
;
controls
.
mouseButtons
.
right
=
CameraControls
.
ACTION
.
TRUCK
;
controls
.
touches
.
one
=
CameraControls
.
ACTION
.
TOUCH_ROTATE
;
controls
.
touches
.
two
=
CameraControls
.
ACTION
.
TOUCH_DOLLY_TRUCK
;
controls
.
touches
.
three
=
CameraControls
.
ACTION
.
TOUCH_TRUCK
;
}
private
disablePerspectiveDragging
():
void
{
const
{
controls
}
=
this
.
views
.
perspective
;
controls
.
mouseButtons
.
left
=
CameraControls
.
ACTION
.
NONE
;
controls
.
mouseButtons
.
right
=
CameraControls
.
ACTION
.
NONE
;
controls
.
touches
.
one
=
CameraControls
.
ACTION
.
NONE
;
controls
.
touches
.
two
=
CameraControls
.
ACTION
.
NONE
;
controls
.
touches
.
three
=
CameraControls
.
ACTION
.
NONE
;
}
private
onPerspectiveDrag
=
():
void
=>
{
if
(
!
[
Mode
.
DRAG_CANVAS
,
Mode
.
IDLE
].
includes
(
this
.
mode
))
return
;
this
.
isPerspectiveBeingDragged
=
true
;
this
.
enablePerspectiveDragging
();
}
private
startAction
(
view
:
any
,
event
:
MouseEvent
):
void
{
if
(
event
.
detail
!==
1
)
return
;
if
(
this
.
model
.
mode
===
Mode
.
DRAG_CANVAS
)
return
;
...
...
@@ -844,24 +882,26 @@ export class Canvas3dViewImpl implements Canvas3dView, Listener {
}
else
if
(
reason
===
UpdateReasons
.
OBJECTS_UPDATED
)
{
this
.
setupObjects
();
}
else
if
(
reason
===
UpdateReasons
.
DRAG_CANVAS
)
{
this
.
isPerspectiveBeingDragged
=
true
;
this
.
dispatchEvent
(
new
CustomEvent
(
this
.
model
.
mode
===
Mode
.
DRAG_CANVAS
?
'
canvas.dragstart
'
:
'
canvas.dragstop
'
,
{
new
CustomEvent
(
'
canvas.dragstart
'
,
{
bubbles
:
false
,
cancelable
:
true
,
}),
);
this
.
model
.
data
.
activeElement
.
clientID
=
'
null
'
;
if
(
this
.
model
.
mode
===
Mode
.
DRAG_CANVAS
)
{
const
{
controls
}
=
this
.
views
.
perspective
;
controls
.
mouseButtons
.
left
=
CameraControls
.
ACTION
.
ROTATE
;
controls
.
mouseButtons
.
right
=
CameraControls
.
ACTION
.
TRUCK
;
controls
.
mouseButtons
.
wheel
=
CameraControls
.
ACTION
.
DOLLY
;
controls
.
touches
.
one
=
CameraControls
.
ACTION
.
TOUCH_ROTATE
;
controls
.
touches
.
two
=
CameraControls
.
ACTION
.
TOUCH_DOLLY_TRUCK
;
controls
.
touches
.
three
=
CameraControls
.
ACTION
.
TOUCH_TRUCK
;
}
this
.
setupObjects
();
}
else
if
(
reason
===
UpdateReasons
.
CANCEL
)
{
if
(
this
.
mode
===
Mode
.
DRAG_CANVAS
)
{
this
.
isPerspectiveBeingDragged
=
false
;
this
.
dispatchEvent
(
new
CustomEvent
(
'
canvas.dragstop
'
,
{
bubbles
:
false
,
cancelable
:
true
,
}),
);
}
if
(
this
.
mode
===
Mode
.
DRAW
)
{
this
.
controller
.
drawData
.
enabled
=
false
;
this
.
controller
.
drawData
.
redraw
=
undefined
;
...
...
@@ -869,16 +909,12 @@ export class Canvas3dViewImpl implements Canvas3dView, Listener {
this
.
views
[
view
as
keyof
Views
].
scene
.
children
[
0
].
remove
(
this
.
cube
[
view
as
keyof
Views
]);
});
}
this
.
model
.
data
.
groupData
.
grouped
=
[];
this
.
setHelperVisibility
(
false
);
this
.
mode
=
Mode
.
IDLE
;
this
.
model
.
mode
=
Mode
.
IDLE
;
const
{
controls
}
=
this
.
views
.
perspective
;
controls
.
mouseButtons
.
left
=
CameraControls
.
ACTION
.
NONE
;
controls
.
mouseButtons
.
right
=
CameraControls
.
ACTION
.
NONE
;
controls
.
mouseButtons
.
wheel
=
CameraControls
.
ACTION
.
NONE
;
controls
.
touches
.
one
=
CameraControls
.
ACTION
.
NONE
;
controls
.
touches
.
two
=
CameraControls
.
ACTION
.
NONE
;
controls
.
touches
.
three
=
CameraControls
.
ACTION
.
NONE
;
this
.
dispatchEvent
(
new
CustomEvent
(
'
canvas.canceled
'
));
}
else
if
(
reason
===
UpdateReasons
.
FITTED_CANVAS
)
{
this
.
dispatchEvent
(
new
CustomEvent
(
'
canvas.fit
'
));
...
...
@@ -991,6 +1027,10 @@ export class Canvas3dViewImpl implements Canvas3dView, Listener {
// eslint-disable-next-line no-param-reassign
points
.
material
.
size
=
0.05
;
points
.
material
.
color
.
set
(
new
THREE
.
Color
(
0xffffff
));
const
{
controls
}
=
this
.
views
.
perspective
;
controls
.
mouseButtons
.
wheel
=
CameraControls
.
ACTION
.
DOLLY
;
const
material
=
points
.
material
.
clone
();
const
sphereCenter
=
points
.
geometry
.
boundingSphere
.
center
;
const
{
radius
}
=
points
.
geometry
.
boundingSphere
;
...
...
@@ -1175,7 +1215,7 @@ export class Canvas3dViewImpl implements Canvas3dView, Listener {
this
.
cube
.
perspective
.
position
.
copy
(
newPoints
);
this
.
views
.
perspective
.
renderer
.
domElement
.
style
.
cursor
=
'
default
'
;
}
}
else
if
(
this
.
mode
===
Mode
.
IDLE
)
{
}
else
if
(
this
.
mode
===
Mode
.
IDLE
&&
!
this
.
isPerspectiveBeingDragged
)
{
const
{
children
}
=
this
.
views
.
perspective
.
scene
.
children
[
0
];
const
{
renderer
}
=
this
.
views
.
perspective
.
rayCaster
;
const
intersects
=
renderer
.
intersectObjects
(
children
,
false
);
...
...
tests/cypress/integration/canvas3d_functionality/case_86_canvas3d_functionality_move_image_button.js
浏览文件 @
785edcb2
// Copyright (C) 2021-2022 Intel Corporation
// Copyright (C) CVAT.ai Corporation
//
// SPDX-License-Identifier: MIT
/* eslint-disable cypress/no-unnecessary-waiting */
/// <reference types="cypress" />
import
{
taskName
,
labelName
}
from
'
../../support/const_canvas3d
'
;
...
...
@@ -9,12 +12,10 @@ import { taskName, labelName } from '../../support/const_canvas3d';
context
(
'
Canvas 3D functionality. "Move the image" button interaction.
'
,
()
=>
{
const
caseId
=
'
86
'
;
const
screenshotsPath
=
'
cypress/screenshots/canvas3d_functionality/case_86_canvas3d_functionality_move_image_button.js
'
;
const
cuboidCreationParams
=
{
labelName
:
labelName
,
};
const
cuboidCreationParams
=
{
labelName
};
before
(()
=>
{
cy
.
openTask
(
taskName
)
cy
.
openTask
(
taskName
)
;
cy
.
openJob
();
cy
.
wait
(
1000
);
// Waiting for the point cloud to display
cy
.
create3DCuboid
(
cuboidCreationParams
);
...
...
tests/cypress/integration/canvas3d_functionality_2/case_56_canvas3d_functionality_basic_actions.js
浏览文件 @
785edcb2
// Copyright (C) 2021-2022 Intel Corporation
// Copyright (C) 2022 CVAT.ai Corporation
//
// SPDX-License-Identifier: MIT
/* eslint-disable cypress/no-unnecessary-waiting */
/// <reference types="cypress" />
import
{
taskName
}
from
'
../../support/const_canvas3d
'
;
...
...
@@ -75,9 +78,33 @@ context('Canvas 3D functionality. Basic actions.', () => {
before
(()
=>
{
cy
.
openTaskJob
(
taskName
);
cy
.
wait
(
2000
);
// Waiting for the point cloud to display
});
describe
(
`Testing case "
${
caseId
}
"`
,
()
=>
{
it
.
skip
(
'
Check canvas can be zoomed.
'
,
()
=>
{
// after some investigations it is clear that tests do not work for 3D
// in headless mode, need more time to investigate
const
screenshotNameBefore
=
'
before_idle_zoom
'
;
const
screenshotNameAfter
=
'
after_idle_zoom
'
;
cy
.
screenshot
(
screenshotNameBefore
,
{
onAfterScreenshot
:
()
=>
{
cy
.
get
(
'
.cvat-canvas3d-perspective
'
).
should
(
'
exist
'
).
and
(
'
be.visible
'
)
.
within
(()
=>
{
cy
.
get
(
'
canvas
'
).
trigger
(
'
wheel
'
,
{
deltaY
:
-
500
});
cy
.
screenshot
(
screenshotNameAfter
,
{
onAfterScreenshot
:
()
=>
{
cy
.
compareImagesAndCheckResult
(
`
${
screenshotsPath
}
/
${
screenshotNameBefore
}
.png`
,
`
${
screenshotsPath
}
/
${
screenshotNameAfter
}
.png`
,
);
},
});
});
},
});
});
it
(
'
Check existing of elements.
'
,
()
=>
{
cy
.
get
(
'
.cvat-canvas3d-perspective
'
)
.
should
(
'
exist
'
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录