Fixed panelWidth/panelHeight calculations (fixes #1992)

This commit is contained in:
Mark Salsbery 2021-06-14 11:42:39 -07:00
parent 70c5495fe9
commit 7d19edff34

View File

@ -155,6 +155,10 @@ $.ReferenceStrip = function ( options ) {
//Controls the position and orientation of the reference strip and sets the //Controls the position and orientation of the reference strip and sets the
//appropriate width and height //appropriate width and height
if ( options.width && options.height ) { if ( options.width && options.height ) {
//TODO fix this - isn't correct
this.panelWidth = ( viewerSize.x * this.sizeRatio ) + 12;
this.panelHeight = ( viewerSize.y * this.sizeRatio );
this.element.style.width = options.width + 'px'; this.element.style.width = options.width + 'px';
this.element.style.height = options.height + 'px'; this.element.style.height = options.height + 'px';
viewer.addControl( viewer.addControl(
@ -163,33 +167,31 @@ $.ReferenceStrip = function ( options ) {
); );
} else { } else {
if ( "horizontal" === options.scroll ) { if ( "horizontal" === options.scroll ) {
this.element.style.width = ( this.panelWidth = ( viewerSize.x * this.sizeRatio ) + 12;
viewerSize.x * this.panelHeight = ( viewerSize.y * this.sizeRatio );
options.sizeRatio *
viewer.tileSources.length
) + ( 12 * viewer.tileSources.length ) + 'px';
this.element.style.height = ( this.element.style.width = (
viewerSize.y * this.panelWidth *
options.sizeRatio viewer.tileSources.length
) + 'px'; ) + 'px';
this.element.style.height = this.panelHeight + 'px';
viewer.addControl( viewer.addControl(
this.element, this.element,
{ anchor: $.ControlAnchor.BOTTOM_LEFT } { anchor: $.ControlAnchor.BOTTOM_LEFT }
); );
} else { } else {
this.element.style.height = ( this.panelWidth = ( viewerSize.x * this.sizeRatio );
viewerSize.y * this.panelHeight = ( viewerSize.y * this.sizeRatio ) + 12;
options.sizeRatio *
viewer.tileSources.length
) + ( 12 * viewer.tileSources.length ) + 'px';
this.element.style.width = ( this.element.style.height = (
viewerSize.x * this.panelHeight *
options.sizeRatio viewer.tileSources.length
) + 'px'; ) + 'px';
this.element.style.width = this.panelWidth + 'px';
viewer.addControl( viewer.addControl(
this.element, this.element,
{ anchor: $.ControlAnchor.TOP_LEFT } { anchor: $.ControlAnchor.TOP_LEFT }
@ -198,8 +200,6 @@ $.ReferenceStrip = function ( options ) {
} }
} }
this.panelWidth = ( viewerSize.x * this.sizeRatio ) + 8;
this.panelHeight = ( viewerSize.y * this.sizeRatio ) + 8;
this.panels = []; this.panels = [];
this.miniViewers = {}; this.miniViewers = {};