From 39a1dbad4025c34083177fb4fcedc72c7058c625 Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Sat, 14 Jan 2017 15:17:26 +0100 Subject: [PATCH] Fixed the issue where zooming in would go forever. --- js/uw.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/js/uw.js b/js/uw.js index d60e8c5..52a9d8a 100644 --- a/js/uw.js +++ b/js/uw.js @@ -243,10 +243,13 @@ browser.runtime.onMessage.addListener(function (message, sender, stuff ) { } + + // We don't do that if we zoomed or unzoomed + if(last_whatdo.what_do != "zoom" && last_whatdo.what_do != "unzoom") + changeCSS(last_whatdo.type, last_whatdo.what_do); + // Velikost gumbov posodobimo v vsakem primeru // We update the button size in any case -// console.log( - changeCSS(last_whatdo.type, last_whatdo.what_do); updateCtlButtonSize(); if(debugmsg) @@ -272,7 +275,12 @@ function periodic() { console.log("uw::periodic | detected change in window size. Triggering css change"); winsize.w = w; winsize.h = h; - changeCSS(last_whatdo.type, last_whatdo.what_do); + + // We don't do that if we zoomed or unzoomed + if(last_whatdo.what_do != "zoom" && last_whatdo.what_do != "unzoom"){ + changeCSS(last_whatdo.type, last_whatdo.what_do); + } + updateCtlButtonSize(); } var controls = document.getElementsByClassName("player-controls-wrapper")[0]; @@ -1140,8 +1148,8 @@ function changeCSS_nofs(what_do, video, player){ // Video povečujemo na tak način, da sta zoom in unzoom povečata oz. zmanjšata video za enak korak // We do this so zoom and unzoom steps change video sizes for the same amount - h = video.scrollw + (player.height * zoomStep); - w = video.scrollh + (player.height * zoomStep * ar); + h = video.scrollh + (player.height * zoomStep); + w = video.scrollw + (player.height * zoomStep * ar); /* Zakaj računamo širino na tak način? // // Predstavljajte si, da imamo 2100:900 video v 1600:900 škatli, zoomStep = 0.1. Če bi širino računali po formuli: