aboutsummaryrefslogtreecommitdiff
path: root/src/components/still-image
diff options
context:
space:
mode:
authorShpuld Shpludson <shp@cock.li>2020-10-01 12:54:54 +0000
committerShpuld Shpludson <shp@cock.li>2020-10-01 12:54:54 +0000
commit8a34ff2957e28f7531c62c793ea4f24558e08ced (patch)
treea631749e1fe647085d2ea328b5840b56b344b04e /src/components/still-image
parentfa9176651952468ee996abe0e67d62d9a72d5a69 (diff)
parent68c2a5b18f887f3db2f5685953bc5175aaaabbd3 (diff)
Merge branch 'develop' into 'feat/masto-ws-deletes'
# Conflicts: # CHANGELOG.md # src/components/status/status.js # src/components/status/status.scss
Diffstat (limited to 'src/components/still-image')
-rw-r--r--src/components/still-image/still-image.js10
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()