From 08fd4c0a82e24e45481b5596107572d12eaeca7b Mon Sep 17 00:00:00 2001 From: IgorA100 Date: Thu, 6 Jun 2024 18:10:07 +0300 Subject: [PATCH] Code Cleanup (skin.js) --- web/skins/classic/js/skin.js | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/web/skins/classic/js/skin.js b/web/skins/classic/js/skin.js index ac44abb867..74d6448cf7 100644 --- a/web/skins/classic/js/skin.js +++ b/web/skins/classic/js/skin.js @@ -681,13 +681,13 @@ function endOfResize(e) { * */ function scaleToFit(baseWidth, baseHeight, scaleEl, bottomEl, container, panZoomScale = 1) { $j(window).on('resize', endOfResize); //set delayed scaling when Scale to Fit is selected - const ratio = baseWidth / baseHeight; if (!container) container = $j('#content'); if (!container) { console.error("No container found"); return; } + const ratio = baseWidth / baseHeight; const viewPort = $j(window); // jquery does not provide a bottom offset, and offset does not include margins. outerHeight true minus false gives total vertical margins. var bottomLoc = 0; @@ -699,26 +699,13 @@ function scaleToFit(baseWidth, baseHeight, scaleEl, bottomEl, container, panZoom console.log("bottomLoc: " + bottomEl.offset().top + " + (" + bottomEl.outerHeight(true) + ' - ' + bottomEl.outerHeight() +') + '+bottomEl.outerHeight(true) + '='+bottomLoc); } let newHeight = viewPort.height() - (bottomLoc - scaleEl.outerHeight(true)); -/// console.log("newHeight = " + viewPort.height() +" - " + bottomLoc + ' - ' + scaleEl.outerHeight(true)+'='+newHeight); let newWidth = ratio * newHeight; - // Let's recalculate everything and reduce the height a little. Necessary if "padding" is specified for "wrapperEventVideo" -/// padding = parseInt(container.css("padding-left")) + parseInt(container.css("padding-right")); -/// if (newWidth > container.innerWidth()) { -/// newWidth -= padding; -/// newHeight = newWidth / ratio; -/// } - -/// console.log("newWidth = ", newWidth, "container width:", container.innerWidth()-padding); - -/// if (newHeight < 0 || newWidth > container.innerWidth()-padding) { if (newHeight < 0 || newWidth > container.width()) { // Doesn't fit on screen anyways? -/// newWidth = container.innerWidth()-padding; newWidth = container.width(); newHeight = newWidth / ratio; } - //console.log("newWidth = " + newWidth); let autoScale = Math.round(newWidth / baseWidth * SCALE_BASE * panZoomScale); /* IgorA100 not required due to new "Scale" algorithm & new PanZoom (may 2024) const scales = $j('#scale option').map(function() {