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

22 lines
424 B
JavaScript
Raw Normal View History

2018-01-28 23:47:26 -08:00
const StillImage = {
props: [
'src',
'referrerpolicy',
'mimetype'
],
computed: {
animated () {
return 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