[Display Layout] Right click on item acts as sticky move (#4126)

* Added a left click filter to the mousedown events
* Moved ternary logic out of the template
* Move defauts into function params
This commit is contained in:
Khalid Adil 2021-08-23 18:15:57 -05:00 committed by GitHub
parent 62de310686
commit f2b2953a5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -33,7 +33,7 @@
<slot></slot>
<div
class="c-frame__move-bar"
@mousedown="isEditing ? startMove([1,1], [0,0], $event) : null"
@mousedown.left="startMove($event)"
></div>
</div>
</template>
@ -93,7 +93,11 @@ export default {
return value - this.initialPosition[index];
}.bind(this));
},
startMove(posFactor, dimFactor, event) {
startMove(event, posFactor = [1, 1], dimFactor = [0, 0]) {
if (!this.isEditing) {
return;
}
document.body.addEventListener('mousemove', this.continueMove);
document.body.addEventListener('mouseup', this.endMove);
this.dragPosition = {

View File

@ -45,7 +45,7 @@
<div
class="c-frame__move-bar"
@mousedown="startDrag($event)"
@mousedown.left="startDrag($event)"
></div>
<div
v-if="showFrameEdit"