Code backup. Bug Semi-fix.

This commit is contained in:
Nelson Campos 2018-10-01 17:03:34 +01:00
parent ab98173a13
commit 49e3ef6885
2 changed files with 43 additions and 8 deletions

View File

@ -1140,7 +1140,7 @@ function OpenSeadragon( options ){
autoResize: true,
preserveImageSizeOnResize: false, // requires autoResize=true
minScrollDeltaTime: 50,
rotationIncrement: 90,
rotationIncrement: 10,
//DEFAULT CONTROL SETTINGS
showSequenceControl: true, //SEQUENCE

View File

@ -52,6 +52,7 @@
* @param {Number} [options.y=0] - Top position, in viewport coordinates.
* @param {Number} [options.width=1] - Width, in viewport coordinates.
* @param {Number} [options.height] - Height, in viewport coordinates.
* @param {Boolean} [options.flipped=false] - Whether to draw tiled image flipped.
* @param {OpenSeadragon.Rect} [options.fitBounds] The bounds in viewport coordinates
* to fit the image into. If specified, x, y, width and height get ignored.
* @param {OpenSeadragon.Placement} [options.fitBoundsPlacement=OpenSeadragon.Placement.CENTER]
@ -146,6 +147,9 @@ $.TiledImage = function( options ) {
var degrees = options.degrees || 0;
delete options.degrees;
// var flipped = options.flipped || false;
// delete options.flipped;
$.extend( true, this, {
//internal state properties
@ -209,6 +213,9 @@ $.TiledImage = function( options ) {
animationTime: this.animationTime
});
this.flipped = options.flipped;
delete options.flipped;
this._updateForScale();
if (fitBounds) {
@ -1879,24 +1886,35 @@ function drawTiles( tiledImage, lastDrawn ) {
tiledImage.getClippedBounds(true))
.getIntegerBoundingBox()
.times($.pixelDensityRatio);
if(tiledImage._drawer.viewer.viewport.flipped || tiledImage.flipped ) {
// tiledImage._drawer._flip({});
// bounds.width = bounds.width - bounds.x;
// bounds.width = tiledImage._drawer.viewer.viewport.getContainerSize().width - bounds.x;
// bounds.x = -bounds.x;
}
}
tiledImage._drawer._clear(true, bounds);
}
console.log("BOUNDS: ", bounds);
// When scaling, we must rotate only when blending the sketch canvas to
// avoid interpolation
if (!sketchScale) {
if (tiledImage.viewport.degrees !== 0) {
console.log("tiledImage.viewport.degrees !== 0");
tiledImage._drawer._offsetForRotation({
degrees: tiledImage.viewport.degrees,
useSketch: useSketch
});
} else {
if(tiledImage._drawer.viewer.viewport.flipped) {
}/* else {
if((tiledImage._drawer.viewer.viewport.flipped && !tiledImage.flipped) || (!tiledImage._drawer.viewer.viewport.flipped && tiledImage.flipped) ) {
console.log("FLIP");
tiledImage._drawer._flip({});
}
}
}*/
if (tiledImage.getRotation(true) % 360 !== 0) {
console.log("tiledImage.getRotation(true) % 360 !== 0");
tiledImage._drawer._offsetForRotation({
degrees: tiledImage.getRotation(true),
point: tiledImage.viewport.pixelFromPointNoRotate(
@ -1904,6 +1922,13 @@ function drawTiles( tiledImage, lastDrawn ) {
useSketch: useSketch
});
}
if (tiledImage.viewport.degrees == 0 && tiledImage.getRotation(true) % 360 == 0){
if((tiledImage._drawer.viewer.viewport.flipped && !tiledImage.flipped) || (!tiledImage._drawer.viewer.viewport.flipped && tiledImage.flipped) ) {
console.log("FLIP");
tiledImage._drawer._flip({});
}
}
}
var usedClip = false;
@ -1975,11 +2000,19 @@ function drawTiles( tiledImage, lastDrawn ) {
if (!sketchScale) {
if (tiledImage.getRotation(true) % 360 !== 0) {
tiledImage._drawer._restoreRotationChanges(useSketch);
}/* else {
if((tiledImage._drawer.viewer.viewport.flipped && !tiledImage.flipped) || (!tiledImage._drawer.viewer.viewport.flipped && tiledImage.flipped) ) {
console.log("FLIP");
tiledImage._drawer._flip({});
}
}*/
if (tiledImage.viewport.degrees !== 0) {
tiledImage._drawer._restoreRotationChanges(useSketch);
} else{
if(tiledImage._drawer.viewer.viewport.flipped) {
}
if (tiledImage.viewport.degrees == 0 && tiledImage.getRotation(true) % 360 == 0){
if((tiledImage._drawer.viewer.viewport.flipped && !tiledImage.flipped) || (!tiledImage._drawer.viewer.viewport.flipped && tiledImage.flipped) ) {
console.log("FLIP");
tiledImage._drawer._flip({});
}
}
@ -2010,6 +2043,7 @@ function drawTiles( tiledImage, lastDrawn ) {
bounds: bounds
});
if (sketchScale) {
console.log("--------------------sketchScale--------------------");
if (tiledImage.getRotation(true) % 360 !== 0) {
tiledImage._drawer._restoreRotationChanges(false);
}
@ -2018,6 +2052,7 @@ function drawTiles( tiledImage, lastDrawn ) {
}
}
}
drawDebugInfo( tiledImage, lastDrawn );
}