summaryrefslogtreecommitdiff
path: root/src/client/app/common
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-06-08 04:21:06 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-06-08 04:21:06 +0900
commit79d592b4318d0a9d69a3469db8a0ef8b35c3af90 (patch)
tree3959b39f5dc8db460b5d074430a1235f1a328ea4 /src/client/app/common
parent2.29.1 (diff)
downloadmisskey-79d592b4318d0a9d69a3469db8a0ef8b35c3af90.tar.gz
misskey-79d592b4318d0a9d69a3469db8a0ef8b35c3af90.tar.bz2
misskey-79d592b4318d0a9d69a3469db8a0ef8b35c3af90.zip
MisskeyDeck: カラムをスタックできるように
Diffstat (limited to 'src/client/app/common')
-rw-r--r--src/client/app/common/views/components/menu.vue33
1 files changed, 27 insertions, 6 deletions
diff --git a/src/client/app/common/views/components/menu.vue b/src/client/app/common/views/components/menu.vue
index 73c8403ad3..8874e4c49b 100644
--- a/src/client/app/common/views/components/menu.vue
+++ b/src/client/app/common/views/components/menu.vue
@@ -1,7 +1,7 @@
<template>
<div class="mk-menu">
<div class="backdrop" ref="backdrop" @click="close"></div>
- <div class="popover" :class="{ compact }" ref="popover">
+ <div class="popover" :class="{ hukidasi }" ref="popover">
<template v-for="item in items">
<div v-if="item == null"></div>
<button v-else @click="clicked(item.onClick)" v-html="item.content"></button>
@@ -16,6 +16,11 @@ import * as anime from 'animejs';
export default Vue.extend({
props: ['source', 'compact', 'items'],
+ data() {
+ return {
+ hukidasi: !this.compact
+ };
+ },
mounted() {
this.$nextTick(() => {
const popover = this.$refs.popover as any;
@@ -24,18 +29,34 @@ export default Vue.extend({
const width = popover.offsetWidth;
const height = popover.offsetHeight;
+ let left;
+ let top;
+
if (this.compact) {
const x = rect.left + window.pageXOffset + (this.source.offsetWidth / 2);
const y = rect.top + window.pageYOffset + (this.source.offsetHeight / 2);
- popover.style.left = (x - (width / 2)) + 'px';
- popover.style.top = (y - (height / 2)) + 'px';
+ left = (x - (width / 2));
+ top = (y - (height / 2));
} else {
const x = rect.left + window.pageXOffset + (this.source.offsetWidth / 2);
const y = rect.top + window.pageYOffset + this.source.offsetHeight;
- popover.style.left = (x - (width / 2)) + 'px';
- popover.style.top = y + 'px';
+ left = (x - (width / 2));
+ top = y;
+ }
+
+ if (left + width > window.innerWidth) {
+ left = window.innerWidth - width;
+ this.hukidasi = false;
}
+ if (top + height > window.innerHeight) {
+ top = window.innerHeight - height;
+ this.hukidasi = false;
+ }
+
+ popover.style.left = left + 'px';
+ popover.style.top = top + 'px';
+
anime({
targets: this.$refs.backdrop,
opacity: 1,
@@ -113,7 +134,7 @@ $border-color = rgba(27, 31, 35, 0.15)
$balloon-size = 16px
- &:not(.compact)
+ &.hukidasi
margin-top $balloon-size
transform-origin center -($balloon-size)