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.
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.
1
person likes this idea
I like this idea!
Tell me when this idea gets some attention.
The more people who like this idea, the more it gets noticed.
The more people who like this idea, the more it gets noticed.
The company has this in progress.
-
Inappropriate?Aldo,
This is actually not an inconsistency, I believe. The CenterConstraint is responsible for the fact that you cannot pan when either of it's dimensions is entirely visible in the viewport. Simply check out the source code for the constraints to understand what I mean. However, there is (was?) a bug with VisibilityConstraint that prevents you from panning to the bottom once you're zoomed in, e.g.
http://gasi.ch/examples/2008/12/08/fl...
I've already filed a bug report against myself :)
http://code.google.com/p/open-zoom/is...
Thanks to your suggestion, I'll check if it has to do with the order of the constraints.
As for your patch, you don't have to change the DEFAULT_VISIBILITY_RATIO as you can always change it directly on the VisibilityConstraint through the visibilityRatio. The lesson I learned though is that order matters in regards to constraints.
Thanks for discussing this.
Cheers,
Daniel
P.S. Glad you're having fun – now you may understand why I'm doing all of this! :)
Loading Profile...




EMPLOYEE