yandere_fe/src/components/still-image/still-image.js

27 lines
529 B
JavaScript
Raw Normal View History

2018-01-28 23:47:26 -08:00
const StillImage = {
props: [
'src',
'referrerpolicy',
'mimetype'
],
data () {
return {
stopGifs: this.$store.state.config.stopGifs
}
},
2018-01-28 23:47:26 -08:00
computed: {
animated () {
return this.stopGifs && (this.mimetype === 'image/gif' || this.src.endsWith('.gif'))
2018-01-28 23:47:26 -08:00
}
},
methods: {
onLoad () {
2018-01-28 23:47:26 -08:00
const canvas = this.$refs.canvas
if (!canvas) return
canvas.getContext('2d').drawImage(this.$refs.src, 1, 1, canvas.width, canvas.height)
2018-01-28 23:47:26 -08:00
}
}
}
export default StillImage