From c10ce7e8d70a0b43338124e49769c9afd76b4956 Mon Sep 17 00:00:00 2001 From: EpicKiwi Date: Mon, 20 Apr 2026 16:16:22 +0200 Subject: [PATCH 1/5] =?UTF-8?q?Fix=20vid=C3=A9o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- v1-com-officielle/src/indieComponents/VideoPannel.vue | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/v1-com-officielle/src/indieComponents/VideoPannel.vue b/v1-com-officielle/src/indieComponents/VideoPannel.vue index 3e044a8..9b74e8a 100644 --- a/v1-com-officielle/src/indieComponents/VideoPannel.vue +++ b/v1-com-officielle/src/indieComponents/VideoPannel.vue @@ -21,9 +21,7 @@
- +

{{selectedVideo.like}}

-
+ diff --git a/v1-com-officielle/glitcher/lib/glitcher.js b/v1-com-officielle/glitcher/lib/glitcher.js index fbfb691..9c83ea7 100644 --- a/v1-com-officielle/glitcher/lib/glitcher.js +++ b/v1-com-officielle/glitcher/lib/glitcher.js @@ -221,28 +221,50 @@ export class Glitcher { this.ctx.texParameteri(this.ctx.TEXTURE_2D, this.ctx.TEXTURE_MIN_FILTER, this.ctx.LINEAR); } - resize(width, height){ - let computedStyle = window.getComputedStyle(this.canvas) - let maxWidth = parseFloat(computedStyle["max-width"]) - let maxHeight = parseFloat(computedStyle["max-height"]) - - if(window.devicePixelRatio){ - maxWidth *= window.devicePixelRatio - maxHeight *= window.devicePixelRatio + async toBlob(type, quality) { + this.resize(this.currentImage.width, this.currentImage.height, true) + this.render() + let blob = await new Promise((res, rej) => this.canvas.toBlob((imageBlob) => { + if(imageBlob){ + res(imageBlob) + } else { + rej() + } + }, type, quality)) + this.resize(this.currentImage.width, this.currentImage.height, false) + return blob + } + + resize(width, height, force=false){ + if(!force){ + + let computedStyle = window.getComputedStyle(this.canvas) + let maxWidth = parseFloat(computedStyle["max-width"]) + let maxHeight = parseFloat(computedStyle["max-height"]) + + if(window.devicePixelRatio){ + maxWidth *= window.devicePixelRatio + maxHeight *= window.devicePixelRatio + } + + if(Number.isNaN(maxWidth)){ + maxWidth = width + } + + if(Number.isNaN(maxHeight)){ + maxHeight = height + } + + let resize = resizeToFit("contain", {width, height}, {width: maxWidth, height: maxHeight}) + + this.canvas.width = resize.width + this.canvas.height = resize.height + + } else { + this.canvas.width = width + this.canvas.height = height } - if(Number.isNaN(maxWidth)){ - maxWidth = width - } - - if(Number.isNaN(maxHeight)){ - maxHeight = height - } - - let resize = resizeToFit("contain", {width, height}, {width: maxWidth, height: maxHeight}) - - this.canvas.width = resize.width - this.canvas.height = resize.height this.videoCanvas.width = this.canvas.width this.videoCanvas.height = this.canvas.height this.ctx.viewport(0, 0, this.canvas.width, this.canvas.height);