Get your own customer support community
 

Extending FillConstraint

Edited on 09/05/09
I extended the FillConstraint to also center the image in case it's zoomed out.

This here is tha patch for the changes i did. Maybe you find it useful.

Index: src/org/openzoom/flash/viewport/constraints/FillConstraint.as
===================================================================
--- src/org/openzoom/flash/viewport/constraints/FillConstraint.as (revision 8352)
+++ src/org/openzoom/flash/viewport/constraints/FillConstraint.as (working copy)
@@ -74,11 +74,17 @@
public function validate(transform:IViewportTransform,
target:IViewportTransform):IViewportTransform
{
- if (transform.width > 1)
+ var x:Number = transform.x
+ var y:Number = transform.y
+
+ if (transform.width >= 1) {
transform.width = 1
-
- if (transform.height > 1)
+ x = (1 - transform.width) * 0.5
+ }
+ if (transform.height >= 1) {
transform.height = 1
+ y = (1 - transform.height) * 0.5
+ }

return transform
}


This could also be an extended FillConstraint, but i did not see any advantage in moving the constrained image out of the container, so i altered FillConstraint.
 
happy I’m feeling lucky (or so they say)
Inappropriate?
1 person likes this idea

The company has this under consideration.

See the changes made to this idea
User_default_medium