b66564a30d
* upstream/develop: (89 commits) remove needless ref show preview popover when hover numbered replies refactor conditions do not make too many nested div add fetchStatus action refactor status loading logic split status preview popover into a separate component uninstall mobile-detect library listen both events minor css fix restrict distance at top side only set different trigger event in desktop and mobile by default fix eslint warnings fix popper go behind the top bar migrate Popper to v-popover fix popper go behind the top bar fix eslint warnings reset font-size to normal text size using rem use top placement by default hide status preview popper when hover popper content ...
36 lines
867 B
JavaScript
36 lines
867 B
JavaScript
const StillImage = {
|
|
props: [
|
|
'src',
|
|
'referrerpolicy',
|
|
'mimetype',
|
|
'imageLoadError',
|
|
'imageLoadHandler'
|
|
],
|
|
data () {
|
|
return {
|
|
stopGifs: this.$store.getters.mergedConfig.stopGifs
|
|
}
|
|
},
|
|
computed: {
|
|
animated () {
|
|
return this.stopGifs && (this.mimetype === 'image/gif' || this.src.endsWith('.gif'))
|
|
}
|
|
},
|
|
methods: {
|
|
onLoad () {
|
|
this.imageLoadHandler && this.imageLoadHandler(this.$refs.src)
|
|
const canvas = this.$refs.canvas
|
|
if (!canvas) return
|
|
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)
|
|
},
|
|
onError () {
|
|
this.imageLoadError && this.imageLoadError()
|
|
}
|
|
}
|
|
}
|
|
|
|
export default StillImage
|