Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
5ccdf0ee
Commit
5ccdf0ee
authored
Apr 16, 2020
by
Tom Quirk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Addressing reviewer feedback
- break up onPresentationMousemove for better readability
parent
9333bb66
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
14 deletions
+21
-14
ee/app/assets/javascripts/design_management/components/design_presentation.vue
...ipts/design_management/components/design_presentation.vue
+21
-14
No files found.
ee/app/assets/javascripts/design_management/components/design_presentation.vue
View file @
5ccdf0ee
...
...
@@ -223,24 +223,31 @@ export default {
y
:
clientY
,
};
},
getDragDelta
(
clientX
,
clientY
)
{
return
{
deltaX
:
this
.
lastDragPosition
.
x
-
clientX
,
deltaY
:
this
.
lastDragPosition
.
y
-
clientY
,
};
},
exceedsDragThreshold
(
clientX
,
clientY
)
{
const
{
deltaX
,
deltaY
}
=
this
.
getDragDelta
(
clientX
,
clientY
);
return
Math
.
abs
(
deltaX
)
>
CLICK_DRAG_BUFFER_PX
||
Math
.
abs
(
deltaY
)
>
CLICK_DRAG_BUFFER_PX
;
},
shouldDragDesign
(
clientX
,
clientY
)
{
return
(
this
.
lastDragPosition
&&
(
this
.
isDraggingDesign
||
this
.
exceedsDragThreshold
(
clientX
,
clientY
))
);
},
onPresentationMousemove
({
clientX
,
clientY
})
{
const
{
presentationViewport
}
=
this
.
$refs
;
if
(
!
this
.
lastDragPosition
||
!
presentationViewport
)
return
;
const
{
scrollLeft
,
scrollTop
}
=
presentationViewport
;
const
deltaX
=
this
.
lastDragPosition
.
x
-
clientX
;
const
deltaY
=
this
.
lastDragPosition
.
y
-
clientY
;
// only respond to mousemove events after the
// mousemove's position exceeds the buffer amount
if
(
!
this
.
isDraggingDesign
&&
Math
.
abs
(
deltaX
)
<=
CLICK_DRAG_BUFFER_PX
&&
Math
.
abs
(
deltaY
)
<=
CLICK_DRAG_BUFFER_PX
)
return
;
if
(
!
presentationViewport
||
!
this
.
shouldDragDesign
(
clientX
,
clientY
))
return
;
this
.
isDraggingDesign
=
true
;
const
{
scrollLeft
,
scrollTop
}
=
presentationViewport
;
const
{
deltaX
,
deltaY
}
=
this
.
getDragDelta
(
clientX
,
clientY
);
presentationViewport
.
scrollTo
(
scrollLeft
+
deltaX
,
scrollTop
+
deltaY
);
this
.
lastDragPosition
=
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment