2
* Xibo - Digital Signage - http://www.xibo.org.uk
3
* Copyright (C) 2009-2014 Daniel Garner
5
* This file is part of Xibo.
7
* Xibo is free software: you can redistribute it and/or modify
8
* it under the terms of the GNU Affero General Public License as published by
9
* the Free Software Foundation, either version 3 of the License, or
12
* Xibo is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU Affero General Public License for more details.
17
* You should have received a copy of the GNU Affero General Public License
18
* along with Xibo. If not, see <http://www.gnu.org/licenses/>.
21
xiboLayoutScaler: function(options) {
22
var width; var height;
24
var originalWidth = options.originalWidth;
25
var originalHeight = options.originalHeight;
27
if (options.previewWidth === 0 || options.previewHeight === 0) {
28
width = $(window).width();
29
height = $(window).height();
32
width = options.previewWidth;
33
height = options.previewHeight;
36
var ratio = Math.min(width / options.originalWidth, height / options.originalHeight);
38
if (options.scaleOverride !== 0) {
39
//console.log("Scale Override is set, meaning we want to scale according to the provided scale of " + options.scaleOverride + ". Provided Width is " + width + ". Provided Height is " + height + ".");
40
ratio = options.scaleOverride;
41
originalWidth = width / ratio;
42
originalHeight = height / ratio;
45
$(this).each(function() {
49
height: originalHeight
54
if ($("body").hasClass("ie7") || $("body").hasClass("ie8")) {
56
"filter": "progid:DXImageTransform.Microsoft.Matrix(M11=" + ratio + ", M12=0, M21=0, M22=" + ratio + ", SizingMethod=\'auto expand\'"
61
"transform": "scale(" + ratio + ")",
62
"transform-origin": "0 0"