mirror of
https://github.com/qier222/YesPlayMusic.git
synced 2024-11-22 12:47:27 +08:00
fix: context menu position (#1207)
* fix: context menu position * fix: context menu position with player disabled
This commit is contained in:
parent
66f9b4f526
commit
b501214c02
|
@ -15,6 +15,8 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { mapState } from 'vuex';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ContextMenu',
|
name: 'ContextMenu',
|
||||||
data() {
|
data() {
|
||||||
|
@ -24,10 +26,14 @@ export default {
|
||||||
left: '0px',
|
left: '0px',
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState(['player']),
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
setMenu(top, left) {
|
setMenu(top, left) {
|
||||||
|
let heightOffset = this.player.enabled ? 64 : 0;
|
||||||
let largestHeight =
|
let largestHeight =
|
||||||
window.innerHeight - this.$refs.menu.offsetHeight - 25;
|
window.innerHeight - this.$refs.menu.offsetHeight - heightOffset;
|
||||||
let largestWidth = window.innerWidth - this.$refs.menu.offsetWidth - 25;
|
let largestWidth = window.innerWidth - this.$refs.menu.offsetWidth - 25;
|
||||||
if (top > largestHeight) top = largestHeight;
|
if (top > largestHeight) top = largestHeight;
|
||||||
if (left > largestWidth) left = largestWidth;
|
if (left > largestWidth) left = largestWidth;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user