Skip to content
Snippets Groups Projects
Verified Commit df01f62b authored by Eliot Berriot's avatar Eliot Berriot
Browse files

Hide and remove uneeded canvas object generated for the player background

parent 9fd52afe
No related branches found
No related tags found
No related merge requests found
...@@ -221,6 +221,7 @@ import { mapState, mapGetters, mapActions } from "vuex" ...@@ -221,6 +221,7 @@ import { mapState, mapGetters, mapActions } from "vuex"
import GlobalEvents from "@/components/utils/global-events" import GlobalEvents from "@/components/utils/global-events"
import ColorThief from "@/vendor/color-thief" import ColorThief from "@/vendor/color-thief"
import { Howl } from "howler" import { Howl } from "howler"
import $ from 'jquery'
import AudioTrack from "@/components/audio/Track" import AudioTrack from "@/components/audio/Track"
import TrackFavoriteIcon from "@/components/favorites/TrackFavoriteIcon" import TrackFavoriteIcon from "@/components/favorites/TrackFavoriteIcon"
...@@ -310,6 +311,8 @@ export default { ...@@ -310,6 +311,8 @@ export default {
this.$refs.currentAudio.setCurrentTime(time) this.$refs.currentAudio.setCurrentTime(time)
}, },
updateBackground() { updateBackground() {
// delete existing canvas, if any
$('canvas.color-thief').remove()
if (!this.currentTrack.album.cover) { if (!this.currentTrack.album.cover) {
this.ambiantColors = this.defaultAmbiantColors this.ambiantColors = this.defaultAmbiantColors
return return
......
...@@ -263,3 +263,7 @@ button.reset { ...@@ -263,3 +263,7 @@ button.reset {
label .tooltip { label .tooltip {
margin-left: 1em; margin-left: 1em;
} }
canvas.color-thief {
display: none;
}
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
*/ */
var CanvasImage = function (image) { var CanvasImage = function (image) {
this.canvas = document.createElement('canvas'); this.canvas = document.createElement('canvas');
this.canvas.className = "color-thief hidden";
this.context = this.canvas.getContext('2d'); this.context = this.canvas.getContext('2d');
document.body.appendChild(this.canvas); document.body.appendChild(this.canvas);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment