Skip to content

Commit

Permalink
Code Cleanup (skin.js)
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorA100 authored Jun 6, 2024
1 parent c688ea0 commit 08fd4c0
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions web/skins/classic/js/skin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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() {
Expand Down

0 comments on commit 08fd4c0

Please sign in to comment.