„src/Madeleine.js“ ändern

Adjustments to have full-width rendering within Gitea
This commit is contained in:
Mario Voigt 2020-08-18 00:06:48 +02:00
parent 9386117d77
commit 159553c025

View File

@ -27,8 +27,9 @@
var OBJECT_MATERIAL = "matt"; var OBJECT_MATERIAL = "matt";
var OBJECT_STATUS = false; var OBJECT_STATUS = false;
var OBJECT_BACKGROUND = "DADADA"; //var OBJECT_BACKGROUND = "DADADA";
var OBJECT_COLOR = "FF9900"; var OBJECT_BACKGROUND = "2E323E";
var OBJECT_COLOR = "00A0E1";
var CAMERA_SIGHT = 45; var CAMERA_SIGHT = 45;
var CAMERA_NEARFIELD = 1; var CAMERA_NEARFIELD = 1;
@ -37,8 +38,8 @@
var VIEWER_THEME = "default"; var VIEWER_THEME = "default";
var VIEWER_PREFIX = "mad-"; var VIEWER_PREFIX = "mad-";
var VIEWER_CREATE = true; var VIEWER_CREATE = true;
var VIEWER_HEIGHT = 400; var VIEWER_HEIGHT = 625; //400
var VIEWER_WIDTH = 640; var VIEWER_WIDTH = 1000; //640
var USER_ROTATE_SENSITIVITY = 0.005; var USER_ROTATE_SENSITIVITY = 0.005;
var USER_ZOOM_SENSITIVITY = 100; var USER_ZOOM_SENSITIVITY = 100;
@ -228,11 +229,12 @@
this.__info.name = (typeof this.data == "string") ? this.data.split("/").slice(-1)[0] : this.data.name; this.__info.name = (typeof this.data == "string") ? this.data.split("/").slice(-1)[0] : this.data.name;
// If create new viewer, set canvas size to the viewer. // If create new viewer, set canvas size to the viewer.
if (this.options.viewer.create) { if (this.options.viewer.create) {
this.__height = this.options.viewer.height; this.__height = this.options.viewer.height;
this.__width = this.options.viewer.width; this.__width = this.options.viewer.width;
// Get target width and height, otherwise. // Get target width and height, otherwise.
} else if (document.defaultView && document.defaultView.getComputedStyle) { } else
if (document.defaultView && document.defaultView.getComputedStyle) {
this.__height = parseFloat(document.defaultView.getComputedStyle(this.container,null).getPropertyValue('height')); this.__height = parseFloat(document.defaultView.getComputedStyle(this.container,null).getPropertyValue('height'));
this.__width = parseFloat(document.defaultView.getComputedStyle(this.container,null).getPropertyValue('width')); this.__width = parseFloat(document.defaultView.getComputedStyle(this.container,null).getPropertyValue('width'));
} else { } else {
@ -517,12 +519,14 @@
this.__viewer.id = this.options.viewer.prefix + this.__uniqueID; this.__viewer.id = this.options.viewer.prefix + this.__uniqueID;
// Force viewer size // Force viewer size
this.container.style["max-height"] = this.__height+"px"; //this.container.style["max-height"] = this.__height+"px";
this.container.style["min-height"] = this.__height+"px"; //this.container.style["min-height"] = this.__height+"px";
this.__viewer.style["max-height"] = this.__height+"px"; //this.__viewer.style["max-height"] = this.__height+"px";
this.__viewer.style["min-height"] = this.__height+"px"; //this.__viewer.style["min-height"] = this.__height+"px";
this.__viewer.style["max-width"] = this.__width+"px"; //this.__viewer.style["max-width"] = this.__width+"px";
this.__viewer.style["min-width"] = this.__width+"px"; this.__viewer.style["max-width"] = "100%";
//this.__viewer.style["min-width"] = this.__width+"px";
this.__viewer.style["min-width"] = "50%";
this.__viewer.style.height = this.__height; this.__viewer.style.height = this.__height;
this.__viewer.style.width = this.__width; this.__viewer.style.width = this.__width;
@ -550,7 +554,8 @@
// Viewer iconGrid // Viewer iconGrid
var iconGrid = document.createElement("div"); var iconGrid = document.createElement("div");
iconGrid.style.cssText += "background:transparent;position:absolute;padding:15px 10px;"; iconGrid.style.cssText += "background:transparent;position:absolute;padding:15px 10px;";
iconGrid.style.cssText += "height:50px;width:"+this.__width+"px;top:0;overflow:hidden;"; //iconGrid.style.cssText += "height:50px;width:"+this.__width+"px;top:0;overflow:hidden;";
iconGrid.style.cssText += "height:50px;width:100%;top:0;overflow:hidden;";
iconGrid.className += "box"; iconGrid.className += "box";
var logo = document.createElement("div"); var logo = document.createElement("div");
@ -579,7 +584,8 @@
var player = document.createElement("div"); var player = document.createElement("div");
rotator.style.cssText += "background:transparent;position:absolute;padding:15px 10px;right:0;"; rotator.style.cssText += "background:transparent;position:absolute;padding:15px 10px;right:0;";
rotator.style.cssText += "height:50px;width:"+this.__width+"px;top:0;overflow:hidden;"; //rotator.style.cssText += "height:50px;width:"+this.__width+"px;top:0;overflow:hidden;";
rotator.style.cssText += "height:50px;width:100%;top:0;overflow:hidden;";
rotator.style.cssText += "margin-top:"+(this.__height-30)+"px;"; rotator.style.cssText += "margin-top:"+(this.__height-30)+"px;";
player.className += "icon-clickable pull-right icon-mad-stop"; player.className += "icon-clickable pull-right icon-mad-stop";
@ -794,7 +800,8 @@
if (CONVERT_TO_BINARY) scope.run(scope.relPath + "lib/MadeleineConverter.js", result.data, function(result) { scope.__converted = result }); if (CONVERT_TO_BINARY) scope.run(scope.relPath + "lib/MadeleineConverter.js", result.data, function(result) { scope.__converted = result });
break; break;
case "progress": case "progress":
progressBar.style.width = (scope.__width * result.data / 100) + "px"; //progressBar.style.width = (scope.__width * result.data / 100) + "px";
progressBar.style.width = (result.data) + "%";
if (result.data == 100) { if (result.data == 100) {
progressBar.style["-webkit-opacity"] = 0; progressBar.style["-webkit-opacity"] = 0;
progressBar.style["-moz-opacity"] = 0; progressBar.style["-moz-opacity"] = 0;