diff options
| author | Shpuld Shpludson <shp@cock.li> | 2020-09-29 10:18:37 +0000 |
|---|---|---|
| committer | Shpuld Shpludson <shp@cock.li> | 2020-09-29 10:18:37 +0000 |
| commit | 91778a02766602b81ec8737282495aa4b5294d19 (patch) | |
| tree | da6bb6092acfb50b441f3afb5c4cc792e0b2b3a4 /src/components/still-image/still-image.js | |
| parent | 3781e521e64a59c4e38902601555ae01f99d9fce (diff) | |
| parent | f174f289a93e6bef1182a2face00bb809da49d18 (diff) | |
Merge branch 'feat/custom-virtual-scrolling' into 'develop'
Timeline virtual scrolling
See merge request pleroma/pleroma-fe!1043
Diffstat (limited to 'src/components/still-image/still-image.js')
| -rw-r--r-- | src/components/still-image/still-image.js | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/components/still-image/still-image.js b/src/components/still-image/still-image.js index ab40bbd7..8044e994 100644 --- a/src/components/still-image/still-image.js +++ b/src/components/still-image/still-image.js @@ -19,14 +19,16 @@ const StillImage = { }, methods: { onLoad () { - this.imageLoadHandler && this.imageLoadHandler(this.$refs.src) + const image = this.$refs.src + if (!image) return + this.imageLoadHandler && this.imageLoadHandler(image) const canvas = this.$refs.canvas if (!canvas) return - const width = this.$refs.src.naturalWidth - const height = this.$refs.src.naturalHeight + const width = image.naturalWidth + const height = image.naturalHeight canvas.width = width canvas.height = height - canvas.getContext('2d').drawImage(this.$refs.src, 0, 0, width, height) + canvas.getContext('2d').drawImage(image, 0, 0, width, height) }, onError () { this.imageLoadError && this.imageLoadError() |
