Shouldn't the CenterConstraint be last in line?

I was looking at the inconsistency (IMHO) that the constraints are different when zoomed in as opposed to zoomed out to show all; When showing the fully zoomed out view, you can not pan past the extends of the image. On the other hand, when you are zoomed in, you can pan the image to show up to 50% 'canvas' (in other words: you can pan the corners of the image will to the center of the viewport, instead of to the corresponding corners of the viewport).

When looking in to this issue, I found the DEFAULT_VISIBILITY_RATIO. Setting that to 1.0 would solve the problem, but the image fly to the top of the viewport when clicked, and could sometimes fly off the viewport alltogether. Putting the centerConstraint last in the list of constraints fixes this. I have not seen any problems with this sofar, but I'm sure there's a reasoning behind the current order.

Here's another quick patch, because you liked the previous one so much ;-)

Index: src/OpenZoomViewer.as
===================================================================
--- src/OpenZoomViewer.as (revision 354)
+++ src/OpenZoomViewer.as (working copy)
@@ -72,7 +72,7 @@

private static const DEFAULT_LOAD_TIMEOUT:uint = 100
private static const DEFAULT_MAX_SCALE_FACTOR:Number = 1.0
- private static const DEFAULT_VISIBILITY_RATIO:Number = 0.5
+ private static const DEFAULT_VISIBILITY_RATIO:Number = 1.0

private static const FULL_SCREEN_KEY_CODE:uint = 70 // F
private static const FULL_SCREEN_BACKGROUND_COLOR:uint = 0x111111
@@ -329,10 +329,10 @@

// Chain all constraints together
var compositeContraint:CompositeConstraint = new CompositeConstraint()
- compositeContraint.constraints = [centerConstraint,
- visibilityConstraint,
+ compositeContraint.constraints = [visibilityConstraint,
zoomConstraint,
- scaleConstraint,]
+ scaleConstraint,
+ centerConstraint,]
// Apply constraints
image.constraint = compositeContraint
}

PS: I am missing an 'OpenZoom Nano' product in the list of products, since this is not really an OpenZoom SDK issue.
 
silly I’m supposed to do something else, but this is more fun
Inappropriate?
1 person likes this idea

The company has this in progress.


User_default_medium