diff options
| author | tamaina <tamaina@hotmail.co.jp> | 2020-02-22 01:03:50 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-02-22 01:03:50 +0900 |
| commit | ccc27bcc1477e199ff510db4e8f434c1c7713de8 (patch) | |
| tree | c94ade8136776f625a811eb4d47d189454f329e5 /src/client | |
| parent | Merge pull request #6056 from syuilo/patch/autogen/v11 (diff) | |
| download | misskey-ccc27bcc1477e199ff510db4e8f434c1c7713de8.tar.gz misskey-ccc27bcc1477e199ff510db4e8f434c1c7713de8.tar.bz2 misskey-ccc27bcc1477e199ff510db4e8f434c1c7713de8.zip | |
Fix #6057 (#6061)
Diffstat (limited to 'src/client')
| -rw-r--r-- | src/client/components/media-list.vue | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/src/client/components/media-list.vue b/src/client/components/media-list.vue index fb8824c5b4..2c5df4ecaa 100644 --- a/src/client/components/media-list.vue +++ b/src/client/components/media-list.vue @@ -40,7 +40,8 @@ export default Vue.extend({ }, data() { return { - gridInnerStyle: {} + gridInnerStyle: {}, + sizeWaiting: false } }, mounted() { @@ -59,20 +60,28 @@ export default Vue.extend({ }, size() { // for Safari bug - if (this.$refs.gridOuter) { - let height = 287; - const parent = this.$props.parentElement || this.$parent.$el; + if (this.sizeWaiting) return; - if (this.$refs.gridOuter.clientHeight) { - height = this.$refs.gridOuter.clientHeight; - } else if (parent) { - height = parent.getBoundingClientRect().width * 9 / 16; - } + this.sizeWaiting = true; - this.gridInnerStyle = { height: `${height}px` }; - } else { - this.gridInnerStyle = {}; - } + window.requestAnimationFrame(() => { + this.sizeWaiting = false; + + if (this.$refs.gridOuter) { + let height = 287; + const parent = this.$props.parentElement || this.$parent.$el; + + if (this.$refs.gridOuter.clientHeight) { + height = this.$refs.gridOuter.clientHeight; + } else if (parent) { + height = parent.getBoundingClientRect().width * 9 / 16; + } + + this.gridInnerStyle = { height: `${height}px` }; + } else { + this.gridInnerStyle = {}; + } + }); } } }); |