mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-22 05:06:09 +03:00
Merge branch 'collections' into ian2
fixed Conflicts: test/demo/collections/main.js
This commit is contained in:
commit
6b0e44d037
@ -272,23 +272,10 @@ $.extend( $.Navigator.prototype, $.EventSource.prototype, $.Viewer.prototype, /*
|
|||||||
(this.container.clientWidth === 0 ? 1 : this.container.clientWidth),
|
(this.container.clientWidth === 0 ? 1 : this.container.clientWidth),
|
||||||
(this.container.clientHeight === 0 ? 1 : this.container.clientHeight)
|
(this.container.clientHeight === 0 ? 1 : this.container.clientHeight)
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( !containerSize.equals( this.oldContainerSize ) ) {
|
if ( !containerSize.equals( this.oldContainerSize ) ) {
|
||||||
var oldBounds = this.viewport.getBounds();
|
|
||||||
var oldCenter = this.viewport.getCenter();
|
|
||||||
this.viewport.resize( containerSize, true );
|
this.viewport.resize( containerSize, true );
|
||||||
var worldBounds = this.world.getHomeBounds();
|
this.viewport.goHome(true);
|
||||||
var aspectRatio = worldBounds.width / worldBounds.height;
|
|
||||||
var imageHeight = 1 / aspectRatio;
|
|
||||||
var newWidth = oldBounds.width <= 1 ? oldBounds.width : 1;
|
|
||||||
var newHeight = oldBounds.height <= imageHeight ?
|
|
||||||
oldBounds.height : imageHeight;
|
|
||||||
var newBounds = new $.Rect(
|
|
||||||
oldCenter.x - ( newWidth / 2.0 ),
|
|
||||||
oldCenter.y - ( newHeight / 2.0 ),
|
|
||||||
newWidth,
|
|
||||||
newHeight
|
|
||||||
);
|
|
||||||
this.viewport.fitBounds( newBounds, true );
|
|
||||||
this.oldContainerSize = containerSize;
|
this.oldContainerSize = containerSize;
|
||||||
this.drawer.clear();
|
this.drawer.clear();
|
||||||
this.world.draw();
|
this.world.draw();
|
||||||
|
@ -2745,11 +2745,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);
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
var testInitialOpen = false;
|
var testInitialOpen = false;
|
||||||
var testOverlays = false;
|
var testOverlays = false;
|
||||||
var testMargins = false;
|
var testMargins = false;
|
||||||
var testNavigator = false;
|
var testNavigator = true;
|
||||||
var margins;
|
var margins;
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
@ -145,6 +145,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