Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
EXSYS2021
da6
Hold Afstand
Commits
cb3eff50
Commit
cb3eff50
authored
May 11, 2021
by
Lasse Overgaard Møldrup
Browse files
Fix the fix and extra fix
parent
9be3ba8f
Pipeline
#53033
passed with stage
in 42 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
website/studerende-dk/src/views/Home.vue
View file @
cb3eff50
...
...
@@ -127,6 +127,7 @@ export default {
activePreview
:
{
row
:
null
,
type
:
null
},
dragEnabled
:
true
,
dragging
:
false
,
stoppedDrag
:
false
,
deleting
:
false
,
resizing
:
false
}
...
...
@@ -381,19 +382,24 @@ export default {
const
colElement
=
document
.
getElementById
(
row
+
'
,
'
+
col
);
event
.
dataTransfer
.
setDragImage
(
colElement
,
colElement
.
offsetWidth
/
2
,
20
);
this
.
draggedBlock
=
{
row
,
col
};
// Workaround for a bug in Chrome causing dragend
// to be fired immediately if the timeout is not used
this
.
stoppedDrag
=
false
;
setTimeout
(()
=>
{
this
.
draggedBlock
=
{
row
,
col
};
if
(
this
.
stoppedDrag
)
return
;
this
.
dragging
=
true
;
this
.
showDropPreview
(
event
,
row
,
col
);
},
10
);
this
.
showDropPreview
(
row
,
col
);
},
9
);
},
stopDrag
()
{
this
.
dragging
=
false
;
this
.
hidePreview
();
this
.
stoppedDrag
=
true
;
},
getDropPosition
(
event
,
row
)
{
...
...
@@ -440,6 +446,9 @@ export default {
// Shows a preview upon dragging a block over a row
dragHover
(
event
,
row
)
{
if
(
!
this
.
dragging
)
return
;
event
.
dataTransfer
.
dropEffect
=
'
move
'
;
let
position
=
this
.
getDropPosition
(
event
,
row
);
...
...
@@ -448,12 +457,12 @@ export default {
if
(
position
===
null
)
return
;
this
.
showDropPreview
(
event
,
row
,
position
);
this
.
showDropPreview
(
row
,
position
);
event
.
preventDefault
();
},
showDropPreview
(
event
,
row
,
position
)
{
showDropPreview
(
row
,
position
)
{
const
origRow
=
this
.
draggedBlock
.
row
;
const
origCol
=
this
.
draggedBlock
.
col
;
const
origBlock
=
this
.
layout
[
origRow
].
blocks
[
origCol
];
...
...
@@ -472,6 +481,9 @@ export default {
},
drop
(
event
,
row
)
{
if
(
!
this
.
dragging
)
return
;
const
position
=
this
.
getDropPosition
(
event
,
row
);
// Do nothing if row full
...
...
@@ -508,7 +520,7 @@ export default {
}
}
this
.
hidePreview
();
this
.
stopDrag
();
this
.
saveLayout
(
"
isaac
"
);
},
...
...
Write
Preview
Supports
Markdown
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