mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-25 14:46:10 +03:00
Auto-resize now works for multi-image
This commit is contained in:
parent
a24e4f8210
commit
7078826be1
@ -2735,11 +2735,9 @@ function resizeViewportAndRecenter( viewer, containerSize, oldBounds, oldCenter
|
|||||||
|
|
||||||
// We try to remove blanks as much as possible
|
// We try to remove blanks as much as possible
|
||||||
var worldBounds = viewer.world.getHomeBounds();
|
var worldBounds = viewer.world.getHomeBounds();
|
||||||
var aspectRatio = worldBounds.width / worldBounds.height;
|
var newWidth = oldBounds.width <= worldBounds.width ? oldBounds.width : worldBounds.width;
|
||||||
var imageHeight = 1 / aspectRatio;
|
var newHeight = oldBounds.height <= worldBounds.height ?
|
||||||
var newWidth = oldBounds.width <= 1 ? oldBounds.width : 1;
|
oldBounds.height : worldBounds.height;
|
||||||
var newHeight = oldBounds.height <= imageHeight ?
|
|
||||||
oldBounds.height : imageHeight;
|
|
||||||
|
|
||||||
var newBounds = new $.Rect(
|
var newBounds = new $.Rect(
|
||||||
oldCenter.x - ( newWidth / 2.0 ),
|
oldCenter.x - ( newWidth / 2.0 ),
|
||||||
|
@ -15,6 +15,10 @@
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.openseadragon1.small {
|
||||||
|
width: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
.openseadragon-overlay {
|
.openseadragon-overlay {
|
||||||
background-color: rgba(255, 0, 0, 0.3);
|
background-color: rgba(255, 0, 0, 0.3);
|
||||||
}
|
}
|
||||||
|
@ -116,6 +116,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// ----------
|
||||||
|
toggle: function() {
|
||||||
|
var $el = $(this.viewer.element);
|
||||||
|
$el.toggleClass('small');
|
||||||
|
},
|
||||||
|
|
||||||
// ----------
|
// ----------
|
||||||
basicTest: function() {
|
basicTest: function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
Loading…
Reference in New Issue
Block a user