mirror of https://github.com/Lissy93/dashy.git
🔁 Merge pull request #541 from Ateroz/fix-context-menu-mobile
🐛 Fix context menu on mobile/touch devices Fixes #508
This commit is contained in:
commit
2051b20696
|
@ -17,6 +17,8 @@
|
||||||
<h3>{{ title }}</h3>
|
<h3>{{ title }}</h3>
|
||||||
<EditModeIcon v-if="isEditMode" @click="openEditModal"
|
<EditModeIcon v-if="isEditMode" @click="openEditModal"
|
||||||
v-tooltip="editTooltip()" class="edit-mode-item" />
|
v-tooltip="editTooltip()" class="edit-mode-item" />
|
||||||
|
<OpenIcon @click.prevent.stop="openContextMenu" @contextmenu.prevent
|
||||||
|
class="edit-mode-item" />
|
||||||
</label>
|
</label>
|
||||||
<div class="collapsible-content">
|
<div class="collapsible-content">
|
||||||
<div class="content-inner">
|
<div class="content-inner">
|
||||||
|
@ -31,6 +33,7 @@
|
||||||
import { localStorageKeys } from '@/utils/defaults';
|
import { localStorageKeys } from '@/utils/defaults';
|
||||||
import Icon from '@/components/LinkItems/ItemIcon.vue';
|
import Icon from '@/components/LinkItems/ItemIcon.vue';
|
||||||
import EditModeIcon from '@/assets/interface-icons/interactive-editor-edit-mode.svg';
|
import EditModeIcon from '@/assets/interface-icons/interactive-editor-edit-mode.svg';
|
||||||
|
import OpenIcon from '@/assets/interface-icons/config-open-settings.svg';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'CollapsableContainer',
|
name: 'CollapsableContainer',
|
||||||
|
@ -48,6 +51,7 @@ export default {
|
||||||
components: {
|
components: {
|
||||||
Icon,
|
Icon,
|
||||||
EditModeIcon,
|
EditModeIcon,
|
||||||
|
OpenIcon,
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
isEditMode() {
|
isEditMode() {
|
||||||
|
@ -244,6 +248,8 @@ export default {
|
||||||
float: right;
|
float: right;
|
||||||
right: 0.5rem;
|
right: 0.5rem;
|
||||||
top: 0.5rem;
|
top: 0.5rem;
|
||||||
|
margin-left: 0.2rem;
|
||||||
|
margin-right: 0.2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Makes sections fill available space */
|
/* Makes sections fill available space */
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<transition name="slide">
|
<transition name="slide">
|
||||||
<div class="context-menu" v-if="show && !isMenuDisabled"
|
<div class="context-menu" v-if="show && !isMenuDisabled"
|
||||||
:style="posX && posY ? `top:${posY}px;left:${posX}px;` : ''">
|
:style="posX && posY ? calcPosition() : ''">
|
||||||
<!-- Open Options -->
|
<!-- Open Options -->
|
||||||
<ul class="menu-section">
|
<ul class="menu-section">
|
||||||
<li @click="openSection()">
|
<li @click="openSection()">
|
||||||
|
@ -59,6 +59,13 @@ export default {
|
||||||
removeSection() {
|
removeSection() {
|
||||||
this.$emit('removeSection');
|
this.$emit('removeSection');
|
||||||
},
|
},
|
||||||
|
calcPosition() {
|
||||||
|
const bounds = this.$parent.$el.getBoundingClientRect();
|
||||||
|
const left = this.posX < (bounds.right + bounds.left) / 2;
|
||||||
|
const position = `top:${this.posY}px;${left ? 'left' : 'right'}:\
|
||||||
|
${left ? this.posX : document.documentElement.clientWidth - this.posX}px;`;
|
||||||
|
return position;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue