2018-01-29 18:47:26 +11:00
|
|
|
const StillImage = {
|
|
|
|
props: [
|
|
|
|
'src',
|
|
|
|
'referrerpolicy',
|
2019-02-03 06:11:36 +11:00
|
|
|
'mimetype',
|
|
|
|
'imageLoadError'
|
2018-01-29 18:47:26 +11:00
|
|
|
],
|
2018-03-12 10:31:33 +11:00
|
|
|
data () {
|
|
|
|
return {
|
|
|
|
stopGifs: this.$store.state.config.stopGifs
|
|
|
|
}
|
|
|
|
},
|
2018-01-29 18:47:26 +11:00
|
|
|
computed: {
|
2018-02-04 04:32:13 +11:00
|
|
|
animated () {
|
2018-03-12 10:31:33 +11:00
|
|
|
return this.stopGifs && (this.mimetype === 'image/gif' || this.src.endsWith('.gif'))
|
2018-01-29 18:47:26 +11:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
2018-02-04 03:55:45 +11:00
|
|
|
onLoad () {
|
2018-01-29 18:47:26 +11:00
|
|
|
const canvas = this.$refs.canvas
|
|
|
|
if (!canvas) return
|
2018-08-28 05:40:30 +10:00
|
|
|
const width = this.$refs.src.naturalWidth
|
|
|
|
const height = this.$refs.src.naturalHeight
|
|
|
|
canvas.width = width
|
|
|
|
canvas.height = height
|
|
|
|
canvas.getContext('2d').drawImage(this.$refs.src, 0, 0, width, height)
|
2018-01-29 18:47:26 +11:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default StillImage
|