2018-01-29 18:47:26 +11:00
|
|
|
const StillImage = {
|
|
|
|
props: [
|
|
|
|
'src',
|
|
|
|
'referrerpolicy',
|
|
|
|
'mimetype'
|
|
|
|
],
|
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-02-04 03:55:45 +11:00
|
|
|
canvas.getContext('2d').drawImage(this.$refs.src, 1, 1, canvas.width, canvas.height)
|
2018-01-29 18:47:26 +11:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default StillImage
|