Merge branch '59942-fix-mr-swipe-diff-user-select' into 'master'

MR image diff swipe view: Disable user-select on drag

Closes #59942

See merge request gitlab-org/gitlab-ce!26884
This commit is contained in:
Phil Hughes 2019-04-03 12:29:23 +00:00
commit bc696947fd
2 changed files with 8 additions and 4 deletions

View file

@ -102,7 +102,7 @@ export default {
:style="{
width: onionMaxPixelWidth,
height: onionMaxPixelHeight,
'user-select': dragging === true ? 'none' : '',
'user-select': dragging ? 'none' : null,
}"
class="onion-skin-frame"
>

View file

@ -68,12 +68,10 @@ export default {
},
startDrag() {
this.dragging = true;
document.body.style.userSelect = 'none';
document.body.addEventListener('mousemove', this.dragMove);
},
stopDrag() {
this.dragging = false;
document.body.style.userSelect = '';
document.body.removeEventListener('mousemove', this.dragMove);
},
prepareSwipe() {
@ -104,7 +102,13 @@ export default {
<template>
<div class="swipe view">
<div ref="swipeFrame" class="swipe-frame">
<div
ref="swipeFrame"
:style="{
'user-select': dragging ? 'none' : null,
}"
class="swipe-frame"
>
<image-viewer
key="swipeOldImg"
ref="swipeOldImg"