投稿フォームが画面外にはみ出さないように (#5203)

* 上下はみ出したウィンドウは上基準で収めるように

* 投稿フォームを画面より長くしないように
This commit is contained in:
MeiMei 2019-07-20 17:50:01 +09:00 committed by syuilo
parent b2ed45ae38
commit e695f54ef0
2 changed files with 15 additions and 9 deletions

View File

@ -10,7 +10,7 @@
</span>
</template>
<div class="mk-post-form-window--body">
<div class="mk-post-form-window--body" :style="{ maxHeight: `${maxHeight}px` }">
<mk-note-preview v-if="reply" class="notePreview" :note="reply"/>
<x-post-form ref="form"
:reply="reply"
@ -61,6 +61,12 @@ export default Vue.extend({
};
},
computed: {
maxHeight() {
return window.innerHeight - 50;
},
},
mounted() {
this.$nextTick(() => {
(this.$refs.form as any).focus();

View File

@ -260,14 +260,14 @@ export default Vue.extend({
let moveLeft = me.clientX - moveBaseX;
let moveTop = me.clientY - moveBaseY;
//
if (moveTop < 0) moveTop = 0;
//
if (moveTop + windowHeight > browserHeight) moveTop = browserHeight - windowHeight;
//
if (moveLeft < 0) moveLeft = 0;
//
if (moveTop + windowHeight > browserHeight) moveTop = browserHeight - windowHeight;
//
if (moveTop < 0) moveTop = 0;
//
if (moveLeft + windowWidth > browserWidth) moveLeft = browserWidth - windowWidth;
@ -442,10 +442,10 @@ export default Vue.extend({
const browserHeight = window.innerHeight;
const windowWidth = main.offsetWidth;
const windowHeight = main.offsetHeight;
if (position.left < 0) main.style.left = 0;
if (position.top < 0) main.style.top = 0;
if (position.left + windowWidth > browserWidth) main.style.left = browserWidth - windowWidth + 'px';
if (position.top + windowHeight > browserHeight) main.style.top = browserHeight - windowHeight + 'px';
if (position.left < 0) main.style.left = 0; //
if (position.top + windowHeight > browserHeight) main.style.top = browserHeight - windowHeight + 'px'; //
if (position.left + windowWidth > browserWidth) main.style.left = browserWidth - windowWidth + 'px'; //
if (position.top < 0) main.style.top = 0; //
}
}
});