Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Arkindex
Frontend
Commits
f552ded1
Commit
f552ded1
authored
3 years ago
by
Bastien Abadie
Browse files
Options
Downloads
Plain Diff
Merge branch 'restrict-polygon-element' into 'master'
Restrict a polygon to the element's bounding box Closes
#750
See merge request
!1041
parents
84d95ab8
fd62a392
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!1041
Restrict a polygon to the element's bounding box
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
vue/Image/InteractiveImage.vue
+4
-3
4 additions, 3 deletions
vue/Image/InteractiveImage.vue
with
4 additions
and
3 deletions
vue/Image/InteractiveImage.vue
+
4
−
3
View file @
f552ded1
...
...
@@ -393,6 +393,7 @@ export default {
},
editPolygon
(
position
,
action
)
{
const
polygon
=
this
.
selectedElement
&&
[...
this
.
selectedElement
.
zone
.
polygon
]
const
point
=
this
.
elementLimits
(
position
)
if
(
action
===
'
up
'
)
{
// Create a temporary edited element with drawn polygon first and last point
if
(
!
polygon
)
{
...
...
@@ -400,7 +401,7 @@ export default {
id
:
'
created-polygon
'
,
zone
:
{
image
:
{
...
this
.
element
.
zone
.
image
},
polygon
:
[
po
sition
,
position
]
polygon
:
[
po
int
,
point
]
}
})
return
...
...
@@ -411,12 +412,12 @@ export default {
}
else
if
(
magnetized
&&
polygon
.
some
(
pt
=>
pointsEqual
(
position
,
pt
)))
{
// Do not allow to reuse an existing point
}
else
{
polygon
.
push
(
po
sition
)
polygon
.
push
(
po
int
)
}
}
else
if
(
this
.
selectedElement
&&
action
===
'
move
'
)
{
this
.
magnetize
(
position
,
polygon
)
// Add a segment between the last polygon point and the current cursor position
polygon
.
splice
(
-
1
,
1
,
this
.
elementLimits
(
position
)
)
polygon
.
splice
(
-
1
,
1
,
point
)
}
else
if
(
this
.
selectedElement
&&
action
===
'
dbClick
'
)
{
polygon
.
push
(
polygon
[
0
])
if
(
this
.
selectedElement
)
return
this
.
create
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment