Permalink
Browse files

updated fit function so scaling up is optional. Added PageEvents for …

…general purpose opening/closing requests. Sped up paginator.
  • Loading branch information...
1 parent 298d569 commit 7db10600198b030b71c649ac4888772b96d41c7a @sansumbrella committed Aug 11, 2009
@@ -19,8 +19,8 @@ public class ContinuousPaginator extends Paginator {
private var _screen:Rectangle;
public static const SCROLL:String = "paginatorScroll";
- private var _scrollAttraction:Number = 0.15;
- private var _snapAttraction:Number = 0.08;
+ private var _scrollAttraction:Number = 0.18;
+ private var _snapAttraction:Number = 0.09;
public function ContinuousPaginator(args:Object)
{
@@ -39,15 +39,21 @@ package com.thingsiam.math {
if( centerV ) object.y = ((rect.y+rect.height) - object.height)/2;
}
- public static function fitProportionally( object:DisplayObject, rect:Rectangle, centerV:Boolean=true, centerH:Boolean=true ):void
- {
- object.width = rect.width;
- object.scaleY = object.scaleX;
- if( object.height > rect.height )
- { //shrink to fit height in space, pad width
- object.height = rect.height;
- object.scaleX = object.scaleY;
- }
+ public static function fitProportionally( object:DisplayObject, rect:Rectangle, centerV:Boolean=true, centerH:Boolean=true, fillSpace:Boolean=false ):void
+ {
+ object.scaleX = object.scaleY = 1;
+
+ if( object.width > rect.width || fillSpace )
+ {
+ object.width = rect.width;
+ object.scaleY = object.scaleX;
+ if( object.height > rect.height )
+ { //shrink to fit height in space, pad width
+ object.height = rect.height;
+ object.scaleX = object.scaleY;
+ }
+
+ }
if( centerH ) object.x = ((rect.x+rect.width) - object.width)/2;
if( centerV ) object.y = ((rect.y+rect.height) - object.height)/2;
@@ -1,10 +1,10 @@
package com.thingsiam.site {
+import com.thingsiam.site.events.SiteEvent;
+
import flash.display.Sprite;
-import flash.geom.Rectangle;
import flash.events.Event;
-
-import com.thingsiam.site.events.SiteEvent;
+import flash.geom.Rectangle;
public class PageState extends Sprite {
@@ -0,0 +1,15 @@
+package com.thingsiam.site.events
+{
+ import flash.events.Event;
+
+ public class PageEvent extends Event
+ {
+ public static const REQUEST_CLOSE:String="pageRequestClose";
+
+ public function PageEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false)
+ {
+ super(type, bubbles, cancelable);
+ }
+
+ }
+}

0 comments on commit 7db1060

Please sign in to comment.