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, autoResize: true,
preserveImageSizeOnResize: false, // requires autoResize=true preserveImageSizeOnResize: false, // requires autoResize=true
minScrollDeltaTime: 50, minScrollDeltaTime: 50,
rotationIncrement: 90, rotationIncrement: 10,
//DEFAULT CONTROL SETTINGS //DEFAULT CONTROL SETTINGS
showSequenceControl: true, //SEQUENCE showSequenceControl: true, //SEQUENCE

View File

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