From 5d01e19ce7cf886c2ba99ad90c9f3479ef6706b3 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 10 Jun 2018 03:27:10 +0900 Subject: [PATCH] Fix bug --- .../app/common/views/components/menu.vue | 30 ++++++++++++++----- .../app/common/views/components/note-menu.vue | 10 ++++--- .../desktop/views/components/context-menu.vue | 8 ++--- 3 files changed, 32 insertions(+), 16 deletions(-) diff --git a/src/client/app/common/views/components/menu.vue b/src/client/app/common/views/components/menu.vue index cf3a09e672..9b16732b9a 100644 --- a/src/client/app/common/views/components/menu.vue +++ b/src/client/app/common/views/components/menu.vue @@ -15,7 +15,20 @@ import Vue from 'vue'; import * as anime from 'animejs'; export default Vue.extend({ - props: ['source', 'compact', 'items'], + props: { + source: { + required: true + }, + items: { + type: Array, + required: true + }, + compact: { + type: Boolean, + required: false, + default: false + } + }, data() { return { hukidasi: !this.compact @@ -44,13 +57,13 @@ export default Vue.extend({ top = y; } - if (left + width > window.innerWidth) { - left = window.innerWidth - width; + if (left + width - window.pageXOffset > window.innerWidth) { + left = window.innerWidth - width + window.pageXOffset; this.hukidasi = false; } - if (top + height > window.innerHeight) { - top = window.innerHeight - height; + if (top + height - window.pageYOffset > window.innerHeight) { + top = window.innerHeight - height + window.pageYOffset; this.hukidasi = false; } @@ -139,9 +152,13 @@ $border-color = rgba(27, 31, 35, 0.15) transform-origin center -($balloon-size) &:before + &:after content "" display block position absolute + pointer-events none + + &:before top -($balloon-size * 2) left s('calc(50% - %s)', $balloon-size) border-top solid $balloon-size transparent @@ -150,9 +167,6 @@ $border-color = rgba(27, 31, 35, 0.15) border-bottom solid $balloon-size $border-color &:after - content "" - display block - position absolute top -($balloon-size * 2) + 1.5px left s('calc(50% - %s)', $balloon-size) border-top solid $balloon-size transparent diff --git a/src/client/app/common/views/components/note-menu.vue b/src/client/app/common/views/components/note-menu.vue index 4a8aae9e49..889f63779f 100644 --- a/src/client/app/common/views/components/note-menu.vue +++ b/src/client/app/common/views/components/note-menu.vue @@ -1,6 +1,6 @@ @@ -63,8 +63,10 @@ export default Vue.extend({ }); }, - close() { - this.$refs.menu.close(); + closed() { + this.$nextTick(() => { + this.$destroy(); + }); } } }); diff --git a/src/client/app/desktop/views/components/context-menu.vue b/src/client/app/desktop/views/components/context-menu.vue index a9a083ec0a..afb6838eb6 100644 --- a/src/client/app/desktop/views/components/context-menu.vue +++ b/src/client/app/desktop/views/components/context-menu.vue @@ -23,12 +23,12 @@ export default Vue.extend({ let x = this.x; let y = this.y; - if (x + width > window.innerWidth) { - x = window.innerWidth - width; + if (x + width - window.pageXOffset > window.innerWidth) { + x = window.innerWidth - width + window.pageXOffset; } - if (y + height > window.innerHeight) { - y = window.innerHeight - height; + if (y + height - window.pageYOffset > window.innerHeight) { + y = window.innerHeight - height + window.pageYOffset; } this.$el.style.left = x + 'px';