mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-25 06:36:11 +03:00
Removed the animation state and isSubPixelRoundingRule* functions (except isSubPixelRoundingRuleUnknown), changed timing when animating is set to false
This commit is contained in:
parent
458a16ce1f
commit
12939d5bb9
@ -1429,22 +1429,6 @@ function OpenSeadragon( options ){
|
||||
ALWAYS: 2
|
||||
},
|
||||
|
||||
/**
|
||||
* An enumeration of animation states.
|
||||
* @static
|
||||
* @type {Object}
|
||||
* @property {Number} AT_REST Indicates there are no more animations running and the image is at rest.
|
||||
* @property {Number} ANIMATION_STARTED Indicates the image is in motion and it just started.
|
||||
* @property {Number} ANIMATING Indicates the image was in motion and is still in motion.
|
||||
* @property {Number} ANIMATION_FINISHED Indicates the image was in motion and is not in motion anymore.
|
||||
*/
|
||||
ANIMATION_STATES: {
|
||||
AT_REST: 0,
|
||||
ANIMATION_STARTED: 1,
|
||||
ANIMATING: 2,
|
||||
ANIMATION_FINISHED: 3
|
||||
},
|
||||
|
||||
/**
|
||||
* Keep track of which {@link Viewer}s have been created.
|
||||
* - Key: {@link Element} to which a Viewer is attached.
|
||||
|
@ -1960,42 +1960,6 @@ function compareTiles( previousBest, tile ) {
|
||||
*/
|
||||
var DEFAULT_SUBPIXEL_ROUNDING_RULE = $.SUBPIXEL_ROUNDING_OCCURRENCES.NEVER;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @inner
|
||||
* Determines whether the subpixel rounding enum value is {@link SUBPIXEL_ROUNDING_OCCURRENCES.ALWAYS} or not.
|
||||
*
|
||||
* @param {SUBPIXEL_ROUNDING_OCCURRENCES} value - The subpixel rounding enum value to check.
|
||||
* @returns {Boolean} True if input value is {@link SUBPIXEL_ROUNDING_OCCURRENCES.ALWAYS}, false otherwise.
|
||||
*/
|
||||
function isSubPixelRoundingRuleAlways(value) {
|
||||
return value === $.SUBPIXEL_ROUNDING_OCCURRENCES.ALWAYS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @inner
|
||||
* Determines whether the subpixel rounding enum value is {@link SUBPIXEL_ROUNDING_OCCURRENCES.ONLY_AT_REST} or not.
|
||||
*
|
||||
* @param {SUBPIXEL_ROUNDING_OCCURRENCES} value - The subpixel rounding enum value to check.
|
||||
* @returns {Boolean} True if input value is {@link SUBPIXEL_ROUNDING_OCCURRENCES.ONLY_AT_REST}, false otherwise.
|
||||
*/
|
||||
function isSubPixelRoundingRuleOnlyAtRest(value) {
|
||||
return value === $.SUBPIXEL_ROUNDING_OCCURRENCES.ONLY_AT_REST;
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @inner
|
||||
* Determines whether the subpixel rounding enum value is {@link SUBPIXEL_ROUNDING_OCCURRENCES.NEVER} or not.
|
||||
*
|
||||
* @param {SUBPIXEL_ROUNDING_OCCURRENCES} value - The subpixel rounding enum value to check.
|
||||
* @returns {Boolean} True if input value is {@link SUBPIXEL_ROUNDING_OCCURRENCES.NEVER}, false otherwise.
|
||||
*/
|
||||
function isSubPixelRoundingRuleNever(value) {
|
||||
return value === DEFAULT_SUBPIXEL_ROUNDING_RULE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @inner
|
||||
@ -2006,9 +1970,9 @@ function isSubPixelRoundingRuleAlways(value) {
|
||||
* {@link SUBPIXEL_ROUNDING_OCCURRENCES.ALWAYS}, {@link SUBPIXEL_ROUNDING_OCCURRENCES.ONLY_AT_REST} or {@link SUBPIXEL_ROUNDING_OCCURRENCES.NEVER} value.
|
||||
*/
|
||||
function isSubPixelRoundingRuleUnknown(value) {
|
||||
return !isSubPixelRoundingRuleAlways(value) &&
|
||||
!isSubPixelRoundingRuleOnlyAtRest(value) &&
|
||||
!isSubPixelRoundingRuleNever(value);
|
||||
return value !== $.SUBPIXEL_ROUNDING_OCCURRENCES.ALWAYS &&
|
||||
value !== $.SUBPIXEL_ROUNDING_OCCURRENCES.ONLY_AT_REST &&
|
||||
value !== $.SUBPIXEL_ROUNDING_OCCURRENCES.NEVER;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2207,13 +2171,11 @@ function drawTiles( tiledImage, lastDrawn ) {
|
||||
|
||||
var shouldRoundPositionAndSize = false;
|
||||
|
||||
if (isSubPixelRoundingRuleAlways(subPixelRoundingRule)) {
|
||||
if (subPixelRoundingRule === $.SUBPIXEL_ROUNDING_OCCURRENCES.ALWAYS) {
|
||||
shouldRoundPositionAndSize = true;
|
||||
} else if (isSubPixelRoundingRuleOnlyAtRest(subPixelRoundingRule)) {
|
||||
shouldRoundPositionAndSize = tiledImage.viewer && (
|
||||
tiledImage.viewer.getAnimationState() === $.ANIMATION_STATES.ANIMATION_FINISHED ||
|
||||
tiledImage.viewer.getAnimationState() === $.ANIMATION_STATES.AT_REST // Testing AT_REST here is for the very first render after loading.
|
||||
);
|
||||
} else if (subPixelRoundingRule === $.SUBPIXEL_ROUNDING_OCCURRENCES.ONLY_AT_REST) {
|
||||
var isAnimating = tiledImage.viewer && tiledImage.viewer.isAnimating();
|
||||
shouldRoundPositionAndSize = !isAnimating;
|
||||
}
|
||||
|
||||
for (var i = lastDrawn.length - 1; i >= 0; i--) {
|
||||
|
@ -203,7 +203,6 @@ $.Viewer = function( options ) {
|
||||
fsBoundsDelta: new $.Point( 1, 1 ),
|
||||
prevContainerSize: null,
|
||||
animating: false,
|
||||
animationState: $.ANIMATION_STATES.AT_REST,
|
||||
forceRedraw: false,
|
||||
mouseInside: false,
|
||||
group: null,
|
||||
@ -714,7 +713,6 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
|
||||
}
|
||||
|
||||
THIS[ this.hash ].animating = false;
|
||||
THIS[ this.hash ].animationState = $.ANIMATION_STATES.AT_REST;
|
||||
|
||||
this.world.removeAll();
|
||||
this.imageLoader.clear();
|
||||
@ -2356,10 +2354,6 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
|
||||
isAnimating: function () {
|
||||
return THIS[ this.hash ].animating;
|
||||
},
|
||||
|
||||
getAnimationState: function () {
|
||||
return THIS[ this.hash ].animationState;
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@ -3509,8 +3503,6 @@ function updateOnce( viewer ) {
|
||||
var currentAnimating = THIS[ viewer.hash ].animating;
|
||||
|
||||
if ( !currentAnimating && animated ) {
|
||||
THIS[ viewer.hash ].animationState = $.ANIMATION_STATES.ANIMATION_STARTED;
|
||||
|
||||
/**
|
||||
* Raised when any spring animation starts (zoom, pan, etc.).
|
||||
*
|
||||
@ -3524,18 +3516,13 @@ function updateOnce( viewer ) {
|
||||
abortControlsAutoHide( viewer );
|
||||
}
|
||||
|
||||
var lastAnimation = false;
|
||||
var isAnimationFinished = currentAnimating && !animated;
|
||||
|
||||
if (currentAnimating) {
|
||||
if (animated) {
|
||||
THIS[ viewer.hash ].animationState = $.ANIMATION_STATES.ANIMATING;
|
||||
} else {
|
||||
THIS[ viewer.hash ].animationState = $.ANIMATION_STATES.ANIMATION_FINISHED;
|
||||
lastAnimation = true;
|
||||
}
|
||||
if ( isAnimationFinished ) {
|
||||
THIS[ viewer.hash ].animating = false;
|
||||
}
|
||||
|
||||
if ( animated || lastAnimation || THIS[ viewer.hash ].forceRedraw || viewer.world.needsDraw() ) {
|
||||
if ( animated || isAnimationFinished || THIS[ viewer.hash ].forceRedraw || viewer.world.needsDraw() ) {
|
||||
drawWorld( viewer );
|
||||
viewer._drawOverlays();
|
||||
if( viewer.navigator ){
|
||||
@ -3559,9 +3546,7 @@ function updateOnce( viewer ) {
|
||||
}
|
||||
}
|
||||
|
||||
if ( currentAnimating && !animated ) {
|
||||
THIS[ viewer.hash ].animationState = $.ANIMATION_STATES.AT_REST;
|
||||
|
||||
if ( isAnimationFinished ) {
|
||||
/**
|
||||
* Raised when any spring animation ends (zoom, pan, etc.).
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user