fixed still-image not preserving original aspect ratio and resolution.

This commit is contained in:
Henry Jameson 2018-08-27 22:40:30 +03:00
parent eacbd9b500
commit fd604dfd2a
2 changed files with 6 additions and 1 deletions

View file

@ -18,7 +18,11 @@ const StillImage = {
onLoad () {
const canvas = this.$refs.canvas
if (!canvas) return
canvas.getContext('2d').drawImage(this.$refs.src, 1, 1, canvas.width, canvas.height)
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)
}
}
}

View file

@ -60,6 +60,7 @@
right: 0;
width: 100%;
height: 100%;
object-fit: contain;
}
}
</style>