mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-21 17:37:50 -05:00
Brought up to date with the private repository (feea4c7)
This commit is contained in:
1 parent
1aa738d692
commit
1b1df1ae48
7925 files changed
+2617237
-20
No files matched your search
@@ -0,0 +1,120 @@
|
||||
package org.osmf.layout
|
||||
{
|
||||
import org.osmf.events.MetadataEvent;
|
||||
import org.osmf.metadata.NonSynthesizingMetadata;
|
||||
|
||||
internal class AbsoluteLayoutMetadata extends NonSynthesizingMetadata
|
||||
{
|
||||
|
||||
public static const X:String = "x";
|
||||
|
||||
public static const Y:String = "y";
|
||||
|
||||
public static const WIDTH:String = "width";
|
||||
|
||||
public static const HEIGHT:String = "height";
|
||||
|
||||
private var _x:Number;
|
||||
|
||||
private var _y:Number;
|
||||
|
||||
private var _width:Number;
|
||||
|
||||
private var _height:Number;
|
||||
|
||||
public function AbsoluteLayoutMetadata()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
override public function getValue(param1:String) : *
|
||||
{
|
||||
if(param1 == null)
|
||||
{
|
||||
return undefined;
|
||||
}
|
||||
if(param1 == X)
|
||||
{
|
||||
return this.x;
|
||||
}
|
||||
if(param1 == Y)
|
||||
{
|
||||
return this.y;
|
||||
}
|
||||
if(param1 == WIDTH)
|
||||
{
|
||||
return this.width;
|
||||
}
|
||||
if(param1 == HEIGHT)
|
||||
{
|
||||
return this.height;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
public function get x() : Number
|
||||
{
|
||||
return this._x;
|
||||
}
|
||||
|
||||
public function set x(param1:Number) : void
|
||||
{
|
||||
var _loc2_:MetadataEvent = null;
|
||||
if(this._x != param1)
|
||||
{
|
||||
_loc2_ = new MetadataEvent(MetadataEvent.VALUE_CHANGE,false,false,X,param1,this._x);
|
||||
this._x = param1;
|
||||
dispatchEvent(_loc2_);
|
||||
}
|
||||
}
|
||||
|
||||
public function get y() : Number
|
||||
{
|
||||
return this._y;
|
||||
}
|
||||
|
||||
public function set y(param1:Number) : void
|
||||
{
|
||||
var _loc2_:MetadataEvent = null;
|
||||
if(this._y != param1)
|
||||
{
|
||||
_loc2_ = new MetadataEvent(MetadataEvent.VALUE_CHANGE,false,false,Y,param1,this._y);
|
||||
this._y = param1;
|
||||
dispatchEvent(_loc2_);
|
||||
}
|
||||
}
|
||||
|
||||
public function get width() : Number
|
||||
{
|
||||
return this._width;
|
||||
}
|
||||
|
||||
public function set width(param1:Number) : void
|
||||
{
|
||||
var _loc2_:MetadataEvent = null;
|
||||
if(this._width != param1)
|
||||
{
|
||||
_loc2_ = new MetadataEvent(MetadataEvent.VALUE_CHANGE,false,false,WIDTH,param1,this._width);
|
||||
this._width = param1;
|
||||
dispatchEvent(_loc2_);
|
||||
}
|
||||
}
|
||||
|
||||
public function get height() : Number
|
||||
{
|
||||
return this._height;
|
||||
}
|
||||
|
||||
public function set height(param1:Number) : void
|
||||
{
|
||||
var _loc2_:MetadataEvent = null;
|
||||
if(this._height != param1)
|
||||
{
|
||||
_loc2_ = new MetadataEvent(MetadataEvent.VALUE_CHANGE,false,false,HEIGHT,param1,this._height);
|
||||
this._height = param1;
|
||||
dispatchEvent(_loc2_);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
package org.osmf.layout
|
||||
{
|
||||
import org.osmf.events.MetadataEvent;
|
||||
import org.osmf.metadata.NonSynthesizingMetadata;
|
||||
|
||||
internal class AnchorLayoutMetadata extends NonSynthesizingMetadata
|
||||
{
|
||||
|
||||
public static const LEFT:String = "left";
|
||||
|
||||
public static const TOP:String = "top";
|
||||
|
||||
public static const RIGHT:String = "right";
|
||||
|
||||
public static const BOTTOM:String = "bottom";
|
||||
|
||||
private var _left:Number;
|
||||
|
||||
private var _top:Number;
|
||||
|
||||
private var _right:Number;
|
||||
|
||||
private var _bottom:Number;
|
||||
|
||||
public function AnchorLayoutMetadata()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
override public function getValue(param1:String) : *
|
||||
{
|
||||
if(param1 == null)
|
||||
{
|
||||
return undefined;
|
||||
}
|
||||
if(param1 == LEFT)
|
||||
{
|
||||
return this.left;
|
||||
}
|
||||
if(param1 == TOP)
|
||||
{
|
||||
return this.top;
|
||||
}
|
||||
if(param1 == RIGHT)
|
||||
{
|
||||
return this.right;
|
||||
}
|
||||
if(param1 == BOTTOM)
|
||||
{
|
||||
return this.bottom;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
public function get left() : Number
|
||||
{
|
||||
return this._left;
|
||||
}
|
||||
|
||||
public function set left(param1:Number) : void
|
||||
{
|
||||
var _loc2_:MetadataEvent = null;
|
||||
if(this._left != param1)
|
||||
{
|
||||
_loc2_ = new MetadataEvent(MetadataEvent.VALUE_CHANGE,false,false,LEFT,param1,this._left);
|
||||
this._left = param1;
|
||||
dispatchEvent(_loc2_);
|
||||
}
|
||||
}
|
||||
|
||||
public function get top() : Number
|
||||
{
|
||||
return this._top;
|
||||
}
|
||||
|
||||
public function set top(param1:Number) : void
|
||||
{
|
||||
var _loc2_:MetadataEvent = null;
|
||||
if(this._top != param1)
|
||||
{
|
||||
_loc2_ = new MetadataEvent(MetadataEvent.VALUE_CHANGE,false,false,TOP,param1,this._top);
|
||||
this._top = param1;
|
||||
dispatchEvent(_loc2_);
|
||||
}
|
||||
}
|
||||
|
||||
public function get right() : Number
|
||||
{
|
||||
return this._right;
|
||||
}
|
||||
|
||||
public function set right(param1:Number) : void
|
||||
{
|
||||
var _loc2_:MetadataEvent = null;
|
||||
if(this._right != param1)
|
||||
{
|
||||
_loc2_ = new MetadataEvent(MetadataEvent.VALUE_CHANGE,false,false,RIGHT,param1,this._right);
|
||||
this._right = param1;
|
||||
dispatchEvent(_loc2_);
|
||||
}
|
||||
}
|
||||
|
||||
public function get bottom() : Number
|
||||
{
|
||||
return this._bottom;
|
||||
}
|
||||
|
||||
public function set bottom(param1:Number) : void
|
||||
{
|
||||
var _loc2_:MetadataEvent = null;
|
||||
if(this._bottom != param1)
|
||||
{
|
||||
_loc2_ = new MetadataEvent(MetadataEvent.VALUE_CHANGE,false,false,BOTTOM,param1,this._bottom);
|
||||
this._bottom = param1;
|
||||
dispatchEvent(_loc2_);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package org.osmf.layout
|
||||
{
|
||||
import org.osmf.utils.OSMFStrings;
|
||||
|
||||
internal class BinarySearch
|
||||
{
|
||||
|
||||
public function BinarySearch()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function search(param1:Object, param2:Function, param3:*, param4:int = 0, param5:int = -2147483648) : int
|
||||
{
|
||||
var _loc7_:int = 0;
|
||||
var _loc8_:* = undefined;
|
||||
if(param1 == null || param2 == null)
|
||||
{
|
||||
throw new ArgumentError(OSMFStrings.getString(OSMFStrings.NULL_PARAM));
|
||||
}
|
||||
var _loc6_:int = -param4;
|
||||
param5 = param5 == int.MIN_VALUE ? int(param1.length - 1) : param5;
|
||||
if(param1.length > 0 && param4 <= param5)
|
||||
{
|
||||
_loc7_ = (param4 + param5) / 2;
|
||||
_loc8_ = param1[_loc7_];
|
||||
switch(param2(param3,_loc8_))
|
||||
{
|
||||
case -1:
|
||||
_loc6_ = search(param1,param2,param3,param4,_loc7_ - 1);
|
||||
break;
|
||||
case 0:
|
||||
_loc6_ = _loc7_;
|
||||
break;
|
||||
case 1:
|
||||
_loc6_ = search(param1,param2,param3,_loc7_ + 1,param5);
|
||||
}
|
||||
}
|
||||
return _loc6_;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
package org.osmf.layout
|
||||
{
|
||||
import org.osmf.events.MetadataEvent;
|
||||
import org.osmf.metadata.NonSynthesizingMetadata;
|
||||
|
||||
internal class BoxAttributesMetadata extends NonSynthesizingMetadata
|
||||
{
|
||||
|
||||
public static const RELATIVE_SUM:String = "relativeSum";
|
||||
|
||||
public static const ABSOLUTE_SUM:String = "absoluteSum";
|
||||
|
||||
private var _relativeSum:Number;
|
||||
|
||||
private var _absoluteSum:Number;
|
||||
|
||||
public function BoxAttributesMetadata()
|
||||
{
|
||||
super();
|
||||
this._relativeSum = 0;
|
||||
this._absoluteSum = 0;
|
||||
}
|
||||
|
||||
override public function getValue(param1:String) : *
|
||||
{
|
||||
if(param1 == null)
|
||||
{
|
||||
return undefined;
|
||||
}
|
||||
if(param1 == RELATIVE_SUM)
|
||||
{
|
||||
return this.relativeSum;
|
||||
}
|
||||
if(param1 == ABSOLUTE_SUM)
|
||||
{
|
||||
return this.absoluteSum;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
public function get relativeSum() : Number
|
||||
{
|
||||
return this._relativeSum;
|
||||
}
|
||||
|
||||
public function set relativeSum(param1:Number) : void
|
||||
{
|
||||
var _loc2_:MetadataEvent = null;
|
||||
if(this._relativeSum != param1)
|
||||
{
|
||||
_loc2_ = new MetadataEvent(MetadataEvent.VALUE_CHANGE,false,false,RELATIVE_SUM,param1,this._relativeSum);
|
||||
this._relativeSum = param1;
|
||||
dispatchEvent(_loc2_);
|
||||
}
|
||||
}
|
||||
|
||||
public function get absoluteSum() : Number
|
||||
{
|
||||
return this._absoluteSum;
|
||||
}
|
||||
|
||||
public function set absoluteSum(param1:Number) : void
|
||||
{
|
||||
var _loc2_:MetadataEvent = null;
|
||||
if(this._absoluteSum != param1)
|
||||
{
|
||||
_loc2_ = new MetadataEvent(MetadataEvent.VALUE_CHANGE,false,false,ABSOLUTE_SUM,param1,this._absoluteSum);
|
||||
this._absoluteSum = param1;
|
||||
dispatchEvent(_loc2_);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package org.osmf.layout
|
||||
{
|
||||
public final class HorizontalAlign
|
||||
{
|
||||
|
||||
public static const LEFT:String = "left";
|
||||
|
||||
public static const CENTER:String = "center";
|
||||
|
||||
public static const RIGHT:String = "right";
|
||||
|
||||
public function HorizontalAlign()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package org.osmf.layout
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.events.IEventDispatcher;
|
||||
|
||||
public interface ILayoutTarget extends IEventDispatcher
|
||||
{
|
||||
|
||||
function get displayObject() : DisplayObject;
|
||||
|
||||
function get layoutMetadata() : LayoutMetadata;
|
||||
|
||||
function get measuredWidth() : Number;
|
||||
|
||||
function get measuredHeight() : Number;
|
||||
|
||||
function measure(param1:Boolean = true) : void;
|
||||
|
||||
function layout(param1:Number, param2:Number, param3:Boolean = true) : void;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,194 @@
|
||||
package org.osmf.layout
|
||||
{
|
||||
import org.osmf.events.MetadataEvent;
|
||||
import org.osmf.metadata.NonSynthesizingMetadata;
|
||||
|
||||
internal class LayoutAttributesMetadata extends NonSynthesizingMetadata
|
||||
{
|
||||
|
||||
public static const INDEX:String = "index";
|
||||
|
||||
public static const SCALE_MODE:String = "scaleMode";
|
||||
|
||||
public static const VERTICAL_ALIGN:String = "verticalAlign";
|
||||
|
||||
public static const HORIZONTAL_ALIGN:String = "horizontalAlign";
|
||||
|
||||
public static const SNAP_TO_PIXEL:String = "snapToPixel";
|
||||
|
||||
public static const MODE:String = "layoutMode";
|
||||
|
||||
public static const INCLUDE_IN_LAYOUT:String = "includeInLayout";
|
||||
|
||||
private var _index:Number = NaN;
|
||||
|
||||
private var _scaleMode:String;
|
||||
|
||||
private var _verticalAlign:String;
|
||||
|
||||
private var _horizontalAlign:String;
|
||||
|
||||
private var _snapToPixel:Boolean;
|
||||
|
||||
private var _layoutMode:String;
|
||||
|
||||
private var _includeInLayout:Boolean;
|
||||
|
||||
public function LayoutAttributesMetadata()
|
||||
{
|
||||
super();
|
||||
this._verticalAlign = null;
|
||||
this._horizontalAlign = null;
|
||||
this._scaleMode = null;
|
||||
this._snapToPixel = true;
|
||||
this._layoutMode = LayoutMode.NONE;
|
||||
this._includeInLayout = true;
|
||||
}
|
||||
|
||||
override public function getValue(param1:String) : *
|
||||
{
|
||||
if(param1 == null)
|
||||
{
|
||||
return undefined;
|
||||
}
|
||||
if(param1 == INDEX)
|
||||
{
|
||||
return this.index;
|
||||
}
|
||||
if(param1 == SCALE_MODE)
|
||||
{
|
||||
return this.scaleMode;
|
||||
}
|
||||
if(param1 == VERTICAL_ALIGN)
|
||||
{
|
||||
return this.verticalAlign;
|
||||
}
|
||||
if(param1 == HORIZONTAL_ALIGN)
|
||||
{
|
||||
return this.horizontalAlign;
|
||||
}
|
||||
if(param1 == SNAP_TO_PIXEL)
|
||||
{
|
||||
return this.snapToPixel;
|
||||
}
|
||||
if(param1 == INCLUDE_IN_LAYOUT)
|
||||
{
|
||||
return this.snapToPixel;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
public function get index() : Number
|
||||
{
|
||||
return this._index;
|
||||
}
|
||||
|
||||
public function set index(param1:Number) : void
|
||||
{
|
||||
var _loc2_:MetadataEvent = null;
|
||||
if(this._index != param1)
|
||||
{
|
||||
_loc2_ = new MetadataEvent(MetadataEvent.VALUE_CHANGE,false,false,INDEX,param1,this._index);
|
||||
this._index = param1;
|
||||
dispatchEvent(_loc2_);
|
||||
}
|
||||
}
|
||||
|
||||
public function get scaleMode() : String
|
||||
{
|
||||
return this._scaleMode;
|
||||
}
|
||||
|
||||
public function set scaleMode(param1:String) : void
|
||||
{
|
||||
var _loc2_:MetadataEvent = null;
|
||||
if(this._scaleMode != param1)
|
||||
{
|
||||
_loc2_ = new MetadataEvent(MetadataEvent.VALUE_CHANGE,false,false,SCALE_MODE,param1,this._scaleMode);
|
||||
this._scaleMode = param1;
|
||||
dispatchEvent(_loc2_);
|
||||
}
|
||||
}
|
||||
|
||||
public function get verticalAlign() : String
|
||||
{
|
||||
return this._verticalAlign;
|
||||
}
|
||||
|
||||
public function set verticalAlign(param1:String) : void
|
||||
{
|
||||
var _loc2_:MetadataEvent = null;
|
||||
if(this._verticalAlign != param1)
|
||||
{
|
||||
_loc2_ = new MetadataEvent(MetadataEvent.VALUE_CHANGE,false,false,VERTICAL_ALIGN,param1,this._verticalAlign);
|
||||
this._verticalAlign = param1;
|
||||
dispatchEvent(_loc2_);
|
||||
}
|
||||
}
|
||||
|
||||
public function get horizontalAlign() : String
|
||||
{
|
||||
return this._horizontalAlign;
|
||||
}
|
||||
|
||||
public function set horizontalAlign(param1:String) : void
|
||||
{
|
||||
var _loc2_:MetadataEvent = null;
|
||||
if(this._horizontalAlign != param1)
|
||||
{
|
||||
_loc2_ = new MetadataEvent(MetadataEvent.VALUE_CHANGE,false,false,HORIZONTAL_ALIGN,param1,this._horizontalAlign);
|
||||
this._horizontalAlign = param1;
|
||||
dispatchEvent(_loc2_);
|
||||
}
|
||||
}
|
||||
|
||||
public function get snapToPixel() : Boolean
|
||||
{
|
||||
return this._snapToPixel;
|
||||
}
|
||||
|
||||
public function set snapToPixel(param1:Boolean) : void
|
||||
{
|
||||
var _loc2_:MetadataEvent = null;
|
||||
if(this._snapToPixel != param1)
|
||||
{
|
||||
_loc2_ = new MetadataEvent(MetadataEvent.VALUE_CHANGE,false,false,SNAP_TO_PIXEL,param1,this._snapToPixel);
|
||||
this._snapToPixel = param1;
|
||||
dispatchEvent(_loc2_);
|
||||
}
|
||||
}
|
||||
|
||||
public function get layoutMode() : String
|
||||
{
|
||||
return this._layoutMode;
|
||||
}
|
||||
|
||||
public function set layoutMode(param1:String) : void
|
||||
{
|
||||
var _loc2_:MetadataEvent = null;
|
||||
if(this._layoutMode != param1)
|
||||
{
|
||||
_loc2_ = new MetadataEvent(MetadataEvent.VALUE_CHANGE,false,false,MODE,param1,this._layoutMode);
|
||||
this._layoutMode = param1;
|
||||
dispatchEvent(_loc2_);
|
||||
}
|
||||
}
|
||||
|
||||
public function get includeInLayout() : Boolean
|
||||
{
|
||||
return this._includeInLayout;
|
||||
}
|
||||
|
||||
public function set includeInLayout(param1:Boolean) : void
|
||||
{
|
||||
var _loc2_:MetadataEvent = null;
|
||||
if(this._includeInLayout != param1)
|
||||
{
|
||||
_loc2_ = new MetadataEvent(MetadataEvent.VALUE_CHANGE,false,false,INCLUDE_IN_LAYOUT,param1,this._layoutMode);
|
||||
this._includeInLayout = param1;
|
||||
dispatchEvent(_loc2_);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,341 @@
|
||||
package org.osmf.layout
|
||||
{
|
||||
import org.osmf.metadata.Metadata;
|
||||
import org.osmf.metadata.MetadataNamespaces;
|
||||
import org.osmf.metadata.MetadataSynthesizer;
|
||||
import org.osmf.metadata.NullMetadataSynthesizer;
|
||||
|
||||
public class LayoutMetadata extends Metadata
|
||||
{
|
||||
|
||||
public static const LAYOUT_NAMESPACE:String = "http://www.osmf.org/layout/1.0";
|
||||
|
||||
private const SYNTHESIZER:NullMetadataSynthesizer = new NullMetadataSynthesizer();
|
||||
|
||||
public function LayoutMetadata()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function get index() : Number
|
||||
{
|
||||
return this.lazyAttributes ? this.lazyAttributes.index : NaN;
|
||||
}
|
||||
|
||||
public function set index(param1:Number) : void
|
||||
{
|
||||
this.eagerAttributes.index = param1;
|
||||
}
|
||||
|
||||
public function get scaleMode() : String
|
||||
{
|
||||
return this.lazyAttributes ? this.lazyAttributes.scaleMode : null;
|
||||
}
|
||||
|
||||
public function set scaleMode(param1:String) : void
|
||||
{
|
||||
this.eagerAttributes.scaleMode = param1;
|
||||
}
|
||||
|
||||
public function get horizontalAlign() : String
|
||||
{
|
||||
return this.lazyAttributes ? this.lazyAttributes.horizontalAlign : null;
|
||||
}
|
||||
|
||||
public function set horizontalAlign(param1:String) : void
|
||||
{
|
||||
this.eagerAttributes.horizontalAlign = param1;
|
||||
}
|
||||
|
||||
public function get verticalAlign() : String
|
||||
{
|
||||
return this.lazyAttributes ? this.lazyAttributes.verticalAlign : null;
|
||||
}
|
||||
|
||||
public function set verticalAlign(param1:String) : void
|
||||
{
|
||||
this.eagerAttributes.verticalAlign = param1;
|
||||
}
|
||||
|
||||
public function get snapToPixel() : Boolean
|
||||
{
|
||||
return this.lazyAttributes ? this.lazyAttributes.snapToPixel : true;
|
||||
}
|
||||
|
||||
public function set snapToPixel(param1:Boolean) : void
|
||||
{
|
||||
this.eagerAttributes.snapToPixel = param1;
|
||||
}
|
||||
|
||||
public function get layoutMode() : String
|
||||
{
|
||||
return this.lazyAttributes ? this.lazyAttributes.layoutMode : LayoutMode.NONE;
|
||||
}
|
||||
|
||||
public function set layoutMode(param1:String) : void
|
||||
{
|
||||
this.eagerAttributes.layoutMode = param1;
|
||||
}
|
||||
|
||||
public function get includeInLayout() : Boolean
|
||||
{
|
||||
return this.lazyAttributes ? this.lazyAttributes.includeInLayout : true;
|
||||
}
|
||||
|
||||
public function set includeInLayout(param1:Boolean) : void
|
||||
{
|
||||
this.eagerAttributes.includeInLayout = param1;
|
||||
}
|
||||
|
||||
public function get x() : Number
|
||||
{
|
||||
return this.lazyAbsolute ? this.lazyAbsolute.x : NaN;
|
||||
}
|
||||
|
||||
public function set x(param1:Number) : void
|
||||
{
|
||||
this.eagerAbsolute.x = param1;
|
||||
}
|
||||
|
||||
public function get y() : Number
|
||||
{
|
||||
return this.lazyAbsolute ? this.lazyAbsolute.y : NaN;
|
||||
}
|
||||
|
||||
public function set y(param1:Number) : void
|
||||
{
|
||||
this.eagerAbsolute.y = param1;
|
||||
}
|
||||
|
||||
public function get width() : Number
|
||||
{
|
||||
return this.lazyAbsolute ? this.lazyAbsolute.width : NaN;
|
||||
}
|
||||
|
||||
public function set width(param1:Number) : void
|
||||
{
|
||||
this.eagerAbsolute.width = param1;
|
||||
}
|
||||
|
||||
public function get height() : Number
|
||||
{
|
||||
return this.lazyAbsolute ? this.lazyAbsolute.height : NaN;
|
||||
}
|
||||
|
||||
public function set height(param1:Number) : void
|
||||
{
|
||||
this.eagerAbsolute.height = param1;
|
||||
}
|
||||
|
||||
public function get percentX() : Number
|
||||
{
|
||||
return this.lazyRelative ? this.lazyRelative.x : NaN;
|
||||
}
|
||||
|
||||
public function set percentX(param1:Number) : void
|
||||
{
|
||||
this.eagerRelative.x = param1;
|
||||
}
|
||||
|
||||
public function get percentY() : Number
|
||||
{
|
||||
return this.lazyRelative ? this.lazyRelative.y : NaN;
|
||||
}
|
||||
|
||||
public function set percentY(param1:Number) : void
|
||||
{
|
||||
this.eagerRelative.y = param1;
|
||||
}
|
||||
|
||||
public function get percentWidth() : Number
|
||||
{
|
||||
return this.lazyRelative ? this.lazyRelative.width : NaN;
|
||||
}
|
||||
|
||||
public function set percentWidth(param1:Number) : void
|
||||
{
|
||||
this.eagerRelative.width = param1;
|
||||
}
|
||||
|
||||
public function get percentHeight() : Number
|
||||
{
|
||||
return this.lazyRelative ? this.lazyRelative.height : NaN;
|
||||
}
|
||||
|
||||
public function set percentHeight(param1:Number) : void
|
||||
{
|
||||
this.eagerRelative.height = param1;
|
||||
}
|
||||
|
||||
public function get left() : Number
|
||||
{
|
||||
return this.lazyAnchor ? this.lazyAnchor.left : NaN;
|
||||
}
|
||||
|
||||
public function set left(param1:Number) : void
|
||||
{
|
||||
this.eagerAnchor.left = param1;
|
||||
}
|
||||
|
||||
public function get top() : Number
|
||||
{
|
||||
return this.lazyAnchor ? this.lazyAnchor.top : NaN;
|
||||
}
|
||||
|
||||
public function set top(param1:Number) : void
|
||||
{
|
||||
this.eagerAnchor.top = param1;
|
||||
}
|
||||
|
||||
public function get right() : Number
|
||||
{
|
||||
return this.lazyAnchor ? this.lazyAnchor.right : NaN;
|
||||
}
|
||||
|
||||
public function set right(param1:Number) : void
|
||||
{
|
||||
this.eagerAnchor.right = param1;
|
||||
}
|
||||
|
||||
public function get bottom() : Number
|
||||
{
|
||||
return this.lazyAnchor ? this.lazyAnchor.bottom : NaN;
|
||||
}
|
||||
|
||||
public function set bottom(param1:Number) : void
|
||||
{
|
||||
this.eagerAnchor.bottom = param1;
|
||||
}
|
||||
|
||||
public function get paddingLeft() : Number
|
||||
{
|
||||
return this.lazyPadding ? this.lazyPadding.left : NaN;
|
||||
}
|
||||
|
||||
public function set paddingLeft(param1:Number) : void
|
||||
{
|
||||
this.eagerPadding.left = param1;
|
||||
}
|
||||
|
||||
public function get paddingTop() : Number
|
||||
{
|
||||
return this.lazyPadding ? this.lazyPadding.top : NaN;
|
||||
}
|
||||
|
||||
public function set paddingTop(param1:Number) : void
|
||||
{
|
||||
this.eagerPadding.top = param1;
|
||||
}
|
||||
|
||||
public function get paddingRight() : Number
|
||||
{
|
||||
return this.lazyPadding ? this.lazyPadding.right : NaN;
|
||||
}
|
||||
|
||||
public function set paddingRight(param1:Number) : void
|
||||
{
|
||||
this.eagerPadding.right = param1;
|
||||
}
|
||||
|
||||
public function get paddingBottom() : Number
|
||||
{
|
||||
return this.lazyPadding ? this.lazyPadding.bottom : NaN;
|
||||
}
|
||||
|
||||
public function set paddingBottom(param1:Number) : void
|
||||
{
|
||||
this.eagerPadding.bottom = param1;
|
||||
}
|
||||
|
||||
override public function toString() : String
|
||||
{
|
||||
return "abs [" + this.x + ", " + this.y + ", " + this.width + ", " + this.height + "] " + "rel [" + this.percentX + ", " + this.percentY + ", " + this.percentWidth + ", " + this.percentHeight + "] " + "anch (" + this.left + ", " + this.top + ")(" + this.right + ", " + this.bottom + ") " + "pad [" + this.paddingLeft + ", " + this.paddingTop + ", " + this.paddingRight + ", " + this.paddingBottom + "] " + "layoutMode: " + this.layoutMode + " " + "index: " + this.index + " " + "scale: " + this.scaleMode + " " + "valign: " + this.verticalAlign + " " + "halign: " + this.horizontalAlign + " " + "snap: " + this.snapToPixel;
|
||||
}
|
||||
|
||||
override public function get synthesizer() : MetadataSynthesizer
|
||||
{
|
||||
return this.SYNTHESIZER;
|
||||
}
|
||||
|
||||
private function get lazyAttributes() : LayoutAttributesMetadata
|
||||
{
|
||||
return getValue(MetadataNamespaces.LAYOUT_ATTRIBUTES) as LayoutAttributesMetadata;
|
||||
}
|
||||
|
||||
private function get eagerAttributes() : LayoutAttributesMetadata
|
||||
{
|
||||
var _loc1_:LayoutAttributesMetadata = this.lazyAttributes;
|
||||
if(_loc1_ == null)
|
||||
{
|
||||
_loc1_ = new LayoutAttributesMetadata();
|
||||
addValue(MetadataNamespaces.LAYOUT_ATTRIBUTES,_loc1_);
|
||||
}
|
||||
return _loc1_;
|
||||
}
|
||||
|
||||
private function get lazyAbsolute() : AbsoluteLayoutMetadata
|
||||
{
|
||||
return getValue(MetadataNamespaces.ABSOLUTE_LAYOUT_PARAMETERS) as AbsoluteLayoutMetadata;
|
||||
}
|
||||
|
||||
private function get eagerAbsolute() : AbsoluteLayoutMetadata
|
||||
{
|
||||
var _loc1_:AbsoluteLayoutMetadata = this.lazyAbsolute;
|
||||
if(_loc1_ == null)
|
||||
{
|
||||
_loc1_ = new AbsoluteLayoutMetadata();
|
||||
addValue(MetadataNamespaces.ABSOLUTE_LAYOUT_PARAMETERS,_loc1_);
|
||||
}
|
||||
return _loc1_;
|
||||
}
|
||||
|
||||
private function get lazyRelative() : RelativeLayoutMetadata
|
||||
{
|
||||
return getValue(MetadataNamespaces.RELATIVE_LAYOUT_PARAMETERS) as RelativeLayoutMetadata;
|
||||
}
|
||||
|
||||
private function get eagerRelative() : RelativeLayoutMetadata
|
||||
{
|
||||
var _loc1_:RelativeLayoutMetadata = this.lazyRelative;
|
||||
if(_loc1_ == null)
|
||||
{
|
||||
_loc1_ = new RelativeLayoutMetadata();
|
||||
addValue(MetadataNamespaces.RELATIVE_LAYOUT_PARAMETERS,_loc1_);
|
||||
}
|
||||
return _loc1_;
|
||||
}
|
||||
|
||||
private function get lazyAnchor() : AnchorLayoutMetadata
|
||||
{
|
||||
return getValue(MetadataNamespaces.ANCHOR_LAYOUT_PARAMETERS) as AnchorLayoutMetadata;
|
||||
}
|
||||
|
||||
private function get eagerAnchor() : AnchorLayoutMetadata
|
||||
{
|
||||
var _loc1_:AnchorLayoutMetadata = this.lazyAnchor;
|
||||
if(_loc1_ == null)
|
||||
{
|
||||
_loc1_ = new AnchorLayoutMetadata();
|
||||
addValue(MetadataNamespaces.ANCHOR_LAYOUT_PARAMETERS,_loc1_);
|
||||
}
|
||||
return _loc1_;
|
||||
}
|
||||
|
||||
private function get lazyPadding() : PaddingLayoutMetadata
|
||||
{
|
||||
return getValue(MetadataNamespaces.PADDING_LAYOUT_PARAMETERS) as PaddingLayoutMetadata;
|
||||
}
|
||||
|
||||
private function get eagerPadding() : PaddingLayoutMetadata
|
||||
{
|
||||
var _loc1_:PaddingLayoutMetadata = this.lazyPadding;
|
||||
if(_loc1_ == null)
|
||||
{
|
||||
_loc1_ = new PaddingLayoutMetadata();
|
||||
addValue(MetadataNamespaces.PADDING_LAYOUT_PARAMETERS,_loc1_);
|
||||
}
|
||||
return _loc1_;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package org.osmf.layout
|
||||
{
|
||||
public final class LayoutMode
|
||||
{
|
||||
|
||||
public static const NONE:String = "none";
|
||||
|
||||
public static const VERTICAL:String = "vertical";
|
||||
|
||||
public static const HORIZONTAL:String = "horizontal";
|
||||
|
||||
public function LayoutMode()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,443 @@
|
||||
package org.osmf.layout
|
||||
{
|
||||
import flash.geom.Point;
|
||||
import flash.geom.Rectangle;
|
||||
import flash.utils.Dictionary;
|
||||
import org.osmf.metadata.MetadataNamespaces;
|
||||
import org.osmf.metadata.MetadataWatcher;
|
||||
|
||||
public class LayoutRenderer extends LayoutRendererBase
|
||||
{
|
||||
|
||||
private static const USED_METADATAS:Vector.<String> = new Vector.<String>(5,true);
|
||||
|
||||
private static const X:int = 1;
|
||||
|
||||
private static const Y:int = 2;
|
||||
|
||||
private static const WIDTH:int = 4;
|
||||
|
||||
private static const HEIGHT:int = 8;
|
||||
|
||||
private static const POSITION:int = X + Y;
|
||||
|
||||
private static const DIMENSIONS:int = WIDTH + HEIGHT;
|
||||
|
||||
private static const ALL:int = POSITION + DIMENSIONS;
|
||||
|
||||
USED_METADATAS[0] = MetadataNamespaces.ABSOLUTE_LAYOUT_PARAMETERS;
|
||||
USED_METADATAS[1] = MetadataNamespaces.RELATIVE_LAYOUT_PARAMETERS;
|
||||
USED_METADATAS[2] = MetadataNamespaces.ANCHOR_LAYOUT_PARAMETERS;
|
||||
USED_METADATAS[3] = MetadataNamespaces.PADDING_LAYOUT_PARAMETERS;
|
||||
USED_METADATAS[4] = MetadataNamespaces.LAYOUT_ATTRIBUTES;
|
||||
|
||||
private var layoutMode:String = "none";
|
||||
|
||||
private var lastCalculatedBounds:Rectangle;
|
||||
|
||||
private var targetMetadataWatchers:Dictionary = new Dictionary();
|
||||
|
||||
private var containerAbsoluteWatcher:MetadataWatcher;
|
||||
|
||||
private var containerAttributesWatcher:MetadataWatcher;
|
||||
|
||||
public function LayoutRenderer()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
override protected function get usedMetadatas() : Vector.<String>
|
||||
{
|
||||
return USED_METADATAS;
|
||||
}
|
||||
|
||||
override protected function processContainerChange(param1:ILayoutTarget, param2:ILayoutTarget) : void
|
||||
{
|
||||
var oldContainer:ILayoutTarget = param1;
|
||||
var newContainer:ILayoutTarget = param2;
|
||||
if(oldContainer)
|
||||
{
|
||||
this.containerAbsoluteWatcher.unwatch();
|
||||
this.containerAttributesWatcher.unwatch();
|
||||
}
|
||||
if(newContainer)
|
||||
{
|
||||
this.containerAbsoluteWatcher = new MetadataWatcher(newContainer.layoutMetadata,MetadataNamespaces.ABSOLUTE_LAYOUT_PARAMETERS,null,function(... rest):void
|
||||
{
|
||||
invalidate();
|
||||
});
|
||||
this.containerAbsoluteWatcher.watch();
|
||||
this.containerAttributesWatcher = new MetadataWatcher(newContainer.layoutMetadata,MetadataNamespaces.LAYOUT_ATTRIBUTES,null,function(param1:LayoutAttributesMetadata):void
|
||||
{
|
||||
layoutMode = param1 ? param1.layoutMode : LayoutMode.NONE;
|
||||
invalidate();
|
||||
});
|
||||
this.containerAttributesWatcher.watch();
|
||||
}
|
||||
invalidate();
|
||||
}
|
||||
|
||||
override protected function processUpdateMediaDisplayBegin(param1:Vector.<ILayoutTarget>) : void
|
||||
{
|
||||
this.lastCalculatedBounds = null;
|
||||
}
|
||||
|
||||
override protected function processUpdateMediaDisplayEnd() : void
|
||||
{
|
||||
this.lastCalculatedBounds = null;
|
||||
}
|
||||
|
||||
override protected function processTargetAdded(param1:ILayoutTarget) : void
|
||||
{
|
||||
var watcher:MetadataWatcher;
|
||||
var target:ILayoutTarget = param1;
|
||||
var attributes:LayoutAttributesMetadata = target.layoutMetadata.getValue(MetadataNamespaces.LAYOUT_ATTRIBUTES) as LayoutAttributesMetadata;
|
||||
var relative:RelativeLayoutMetadata = target.layoutMetadata.getValue(MetadataNamespaces.RELATIVE_LAYOUT_PARAMETERS) as RelativeLayoutMetadata;
|
||||
if(this.layoutMode == LayoutMode.NONE && relative == null && attributes == null && target.layoutMetadata.getValue(MetadataNamespaces.ABSOLUTE_LAYOUT_PARAMETERS) == null && target.layoutMetadata.getValue(MetadataNamespaces.ANCHOR_LAYOUT_PARAMETERS) == null)
|
||||
{
|
||||
relative = new RelativeLayoutMetadata();
|
||||
relative.width = 100;
|
||||
relative.height = 100;
|
||||
target.layoutMetadata.addValue(MetadataNamespaces.RELATIVE_LAYOUT_PARAMETERS,relative);
|
||||
attributes = new LayoutAttributesMetadata();
|
||||
attributes.scaleMode = attributes.scaleMode || ScaleMode.LETTERBOX;
|
||||
attributes.verticalAlign = attributes.verticalAlign || VerticalAlign.MIDDLE;
|
||||
attributes.horizontalAlign = attributes.horizontalAlign || HorizontalAlign.CENTER;
|
||||
target.layoutMetadata.addValue(MetadataNamespaces.LAYOUT_ATTRIBUTES,attributes);
|
||||
}
|
||||
watcher = new MetadataWatcher(target.layoutMetadata,MetadataNamespaces.LAYOUT_ATTRIBUTES,LayoutAttributesMetadata.INDEX,function(... rest):void
|
||||
{
|
||||
updateTargetOrder(target);
|
||||
});
|
||||
watcher.watch();
|
||||
this.targetMetadataWatchers[target] = watcher;
|
||||
}
|
||||
|
||||
override protected function processTargetRemoved(param1:ILayoutTarget) : void
|
||||
{
|
||||
var _loc2_:MetadataWatcher = this.targetMetadataWatchers[param1];
|
||||
delete this.targetMetadataWatchers[param1];
|
||||
_loc2_.unwatch();
|
||||
_loc2_ = null;
|
||||
}
|
||||
|
||||
override protected function compareTargets(param1:ILayoutTarget, param2:ILayoutTarget) : Number
|
||||
{
|
||||
var _loc3_:LayoutAttributesMetadata = param1.layoutMetadata.getValue(MetadataNamespaces.LAYOUT_ATTRIBUTES) as LayoutAttributesMetadata;
|
||||
var _loc4_:LayoutAttributesMetadata = param2.layoutMetadata.getValue(MetadataNamespaces.LAYOUT_ATTRIBUTES) as LayoutAttributesMetadata;
|
||||
var _loc5_:Number = _loc3_ ? _loc3_.index : NaN;
|
||||
var _loc6_:Number = _loc4_ ? _loc4_.index : NaN;
|
||||
if(isNaN(_loc5_) && isNaN(_loc6_))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
_loc5_ ||= 0;
|
||||
_loc6_ ||= 0;
|
||||
return _loc5_ < _loc6_ ? -1 : (_loc5_ > _loc6_ ? 1 : 0);
|
||||
}
|
||||
|
||||
override protected function calculateTargetBounds(param1:ILayoutTarget, param2:Number, param3:Number) : Rectangle
|
||||
{
|
||||
var _loc7_:Number = NaN;
|
||||
var _loc9_:Number = NaN;
|
||||
var _loc13_:BoxAttributesMetadata = null;
|
||||
var _loc14_:RelativeLayoutMetadata = null;
|
||||
var _loc15_:AnchorLayoutMetadata = null;
|
||||
var _loc16_:Point = null;
|
||||
var _loc4_:LayoutAttributesMetadata = param1.layoutMetadata.getValue(MetadataNamespaces.LAYOUT_ATTRIBUTES) as LayoutAttributesMetadata || new LayoutAttributesMetadata();
|
||||
if(_loc4_.includeInLayout == false)
|
||||
{
|
||||
return new Rectangle();
|
||||
}
|
||||
var _loc5_:Rectangle = new Rectangle(0,0,param1.measuredWidth,param1.measuredHeight);
|
||||
var _loc6_:AbsoluteLayoutMetadata = param1.layoutMetadata.getValue(MetadataNamespaces.ABSOLUTE_LAYOUT_PARAMETERS) as AbsoluteLayoutMetadata;
|
||||
var _loc8_:Number = 0;
|
||||
var _loc10_:Number = 0;
|
||||
var _loc11_:int = ALL;
|
||||
if(_loc6_)
|
||||
{
|
||||
if(!isNaN(_loc6_.x))
|
||||
{
|
||||
_loc5_.x = _loc6_.x;
|
||||
_loc11_ ^= X;
|
||||
}
|
||||
if(!isNaN(_loc6_.y))
|
||||
{
|
||||
_loc5_.y = _loc6_.y;
|
||||
_loc11_ ^= Y;
|
||||
}
|
||||
if(!isNaN(_loc6_.width))
|
||||
{
|
||||
_loc5_.width = _loc6_.width;
|
||||
_loc11_ ^= WIDTH;
|
||||
}
|
||||
if(!isNaN(_loc6_.height))
|
||||
{
|
||||
_loc5_.height = _loc6_.height;
|
||||
_loc11_ ^= HEIGHT;
|
||||
}
|
||||
}
|
||||
if(_loc11_ != 0)
|
||||
{
|
||||
_loc14_ = param1.layoutMetadata.getValue(MetadataNamespaces.RELATIVE_LAYOUT_PARAMETERS) as RelativeLayoutMetadata;
|
||||
if(_loc14_)
|
||||
{
|
||||
if(Boolean(_loc11_ & X) && !isNaN(_loc14_.x))
|
||||
{
|
||||
_loc5_.x = param2 * _loc14_.x / 100 || 0;
|
||||
_loc11_ ^= X;
|
||||
}
|
||||
if(Boolean(_loc11_ & WIDTH) && !isNaN(_loc14_.width))
|
||||
{
|
||||
if(this.layoutMode == LayoutMode.HORIZONTAL)
|
||||
{
|
||||
_loc13_ = container.layoutMetadata.getValue(MetadataNamespaces.BOX_LAYOUT_ATTRIBUTES) as BoxAttributesMetadata || new BoxAttributesMetadata();
|
||||
_loc5_.width = Math.max(0,param2 - _loc13_.absoluteSum) * _loc14_.width / _loc13_.relativeSum;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc5_.width = param2 * _loc14_.width / 100;
|
||||
}
|
||||
_loc11_ ^= WIDTH;
|
||||
}
|
||||
if(Boolean(_loc11_ & Y) && !isNaN(_loc14_.y))
|
||||
{
|
||||
_loc5_.y = param3 * _loc14_.y / 100 || 0;
|
||||
_loc11_ ^= Y;
|
||||
}
|
||||
if(Boolean(_loc11_ & HEIGHT) && !isNaN(_loc14_.height))
|
||||
{
|
||||
if(this.layoutMode == LayoutMode.VERTICAL)
|
||||
{
|
||||
_loc13_ = container.layoutMetadata.getValue(MetadataNamespaces.BOX_LAYOUT_ATTRIBUTES) as BoxAttributesMetadata || new BoxAttributesMetadata();
|
||||
_loc5_.height = Math.max(0,param3 - _loc13_.absoluteSum) * _loc14_.height / _loc13_.relativeSum;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc5_.height = param3 * _loc14_.height / 100;
|
||||
}
|
||||
_loc11_ ^= HEIGHT;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(_loc11_ != 0)
|
||||
{
|
||||
_loc15_ = param1.layoutMetadata.getValue(MetadataNamespaces.ANCHOR_LAYOUT_PARAMETERS) as AnchorLayoutMetadata;
|
||||
if(_loc15_)
|
||||
{
|
||||
if(Boolean(_loc11_ & X) && !isNaN(_loc15_.left))
|
||||
{
|
||||
_loc5_.x = _loc15_.left;
|
||||
_loc11_ ^= X;
|
||||
}
|
||||
if(Boolean(_loc11_ & Y) && !isNaN(_loc15_.top))
|
||||
{
|
||||
_loc5_.y = _loc15_.top;
|
||||
_loc11_ ^= Y;
|
||||
}
|
||||
if(!isNaN(_loc15_.right) && Boolean(param2))
|
||||
{
|
||||
if(Boolean(_loc11_ & X) && !(_loc11_ & WIDTH))
|
||||
{
|
||||
_loc5_.x = Math.max(0,param2 - _loc5_.width - _loc15_.right);
|
||||
_loc11_ ^= X;
|
||||
}
|
||||
else if(Boolean(_loc11_ & WIDTH) && !(_loc11_ & X))
|
||||
{
|
||||
_loc5_.width = Math.max(0,param2 - _loc15_.right - _loc5_.x);
|
||||
_loc11_ ^= WIDTH;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc5_.x = Math.max(0,param2 - param1.measuredWidth - _loc15_.right);
|
||||
_loc11_ ^= X;
|
||||
}
|
||||
_loc8_ += _loc15_.right;
|
||||
}
|
||||
if(!isNaN(_loc15_.bottom) && Boolean(param3))
|
||||
{
|
||||
if(Boolean(_loc11_ & Y) && !(_loc11_ & HEIGHT))
|
||||
{
|
||||
_loc5_.y = Math.max(0,param3 - _loc5_.height - _loc15_.bottom);
|
||||
_loc11_ ^= Y;
|
||||
}
|
||||
else if(Boolean(_loc11_ & HEIGHT) && !(_loc11_ & Y))
|
||||
{
|
||||
_loc5_.height = Math.max(0,param3 - _loc15_.bottom - _loc5_.y);
|
||||
_loc11_ ^= HEIGHT;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc5_.y = Math.max(0,param3 - param1.measuredHeight - _loc15_.bottom);
|
||||
_loc11_ ^= Y;
|
||||
}
|
||||
_loc10_ += _loc15_.bottom;
|
||||
}
|
||||
}
|
||||
}
|
||||
var _loc12_:PaddingLayoutMetadata = param1.layoutMetadata.getValue(MetadataNamespaces.PADDING_LAYOUT_PARAMETERS) as PaddingLayoutMetadata;
|
||||
if(_loc12_)
|
||||
{
|
||||
if(!isNaN(_loc12_.left))
|
||||
{
|
||||
_loc5_.x += _loc12_.left;
|
||||
}
|
||||
if(!isNaN(_loc12_.top))
|
||||
{
|
||||
_loc5_.y += _loc12_.top;
|
||||
}
|
||||
if(!isNaN(_loc12_.right) && !(_loc11_ & WIDTH))
|
||||
{
|
||||
_loc5_.width -= _loc12_.right + (_loc12_.left || 0);
|
||||
}
|
||||
if(!isNaN(_loc12_.bottom) && !(_loc11_ & HEIGHT))
|
||||
{
|
||||
_loc5_.height -= _loc12_.bottom + (_loc12_.top || 0);
|
||||
}
|
||||
}
|
||||
if(_loc4_.scaleMode)
|
||||
{
|
||||
if(Boolean(!(_loc11_ & WIDTH || _loc11_ & HEIGHT)) && Boolean(param1.measuredWidth) && Boolean(param1.measuredHeight))
|
||||
{
|
||||
_loc16_ = ScaleModeUtils.getScaledSize(_loc4_.scaleMode,_loc5_.width,_loc5_.height,param1.measuredWidth,param1.measuredHeight);
|
||||
_loc7_ = _loc5_.width - _loc16_.x;
|
||||
_loc9_ = _loc5_.height - _loc16_.y;
|
||||
_loc5_.width = _loc16_.x;
|
||||
_loc5_.height = _loc16_.y;
|
||||
}
|
||||
}
|
||||
if(this.layoutMode != LayoutMode.HORIZONTAL)
|
||||
{
|
||||
_loc7_ ||= param2 - (_loc5_.x || 0) - (_loc5_.width || 0) - _loc8_;
|
||||
}
|
||||
if(this.layoutMode != LayoutMode.VERTICAL)
|
||||
{
|
||||
_loc9_ ||= param3 - (_loc5_.y || 0) - (_loc5_.height || 0) - _loc10_;
|
||||
}
|
||||
if(_loc9_)
|
||||
{
|
||||
switch(_loc4_.verticalAlign)
|
||||
{
|
||||
case null:
|
||||
case VerticalAlign.TOP:
|
||||
break;
|
||||
case VerticalAlign.MIDDLE:
|
||||
_loc5_.y += _loc9_ / 2;
|
||||
break;
|
||||
case VerticalAlign.BOTTOM:
|
||||
_loc5_.y += _loc9_;
|
||||
}
|
||||
}
|
||||
if(_loc7_)
|
||||
{
|
||||
switch(_loc4_.horizontalAlign)
|
||||
{
|
||||
case null:
|
||||
case HorizontalAlign.LEFT:
|
||||
break;
|
||||
case HorizontalAlign.CENTER:
|
||||
_loc5_.x += _loc7_ / 2;
|
||||
break;
|
||||
case HorizontalAlign.RIGHT:
|
||||
_loc5_.x += _loc7_;
|
||||
}
|
||||
}
|
||||
if(_loc4_.snapToPixel)
|
||||
{
|
||||
_loc5_.x = Math.round(_loc5_.x);
|
||||
_loc5_.y = Math.round(_loc5_.y);
|
||||
_loc5_.width = Math.round(_loc5_.width);
|
||||
_loc5_.height = Math.round(_loc5_.height);
|
||||
}
|
||||
if(this.layoutMode == LayoutMode.HORIZONTAL || this.layoutMode == LayoutMode.VERTICAL)
|
||||
{
|
||||
if(this.lastCalculatedBounds != null)
|
||||
{
|
||||
if(this.layoutMode == LayoutMode.HORIZONTAL)
|
||||
{
|
||||
_loc5_.x = this.lastCalculatedBounds.x + this.lastCalculatedBounds.width;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc5_.y = this.lastCalculatedBounds.y + this.lastCalculatedBounds.height;
|
||||
}
|
||||
}
|
||||
this.lastCalculatedBounds = _loc5_;
|
||||
}
|
||||
return _loc5_;
|
||||
}
|
||||
|
||||
override protected function calculateContainerSize(param1:Vector.<ILayoutTarget>) : Point
|
||||
{
|
||||
var _loc4_:BoxAttributesMetadata = null;
|
||||
var _loc5_:Rectangle = null;
|
||||
var _loc6_:Rectangle = null;
|
||||
var _loc7_:Rectangle = null;
|
||||
var _loc8_:ILayoutTarget = null;
|
||||
var _loc2_:Point = new Point(NaN,NaN);
|
||||
var _loc3_:AbsoluteLayoutMetadata = container.layoutMetadata.getValue(MetadataNamespaces.ABSOLUTE_LAYOUT_PARAMETERS) as AbsoluteLayoutMetadata;
|
||||
if(_loc3_)
|
||||
{
|
||||
_loc2_.x = _loc3_.width;
|
||||
_loc2_.y = _loc3_.height;
|
||||
}
|
||||
if(this.layoutMode != LayoutMode.NONE)
|
||||
{
|
||||
_loc4_ = new BoxAttributesMetadata();
|
||||
container.layoutMetadata.addValue(MetadataNamespaces.BOX_LAYOUT_ATTRIBUTES,_loc4_);
|
||||
}
|
||||
if(isNaN(_loc2_.x) || isNaN(_loc2_.y) || this.layoutMode != LayoutMode.NONE)
|
||||
{
|
||||
_loc5_ = new Rectangle();
|
||||
for each(_loc8_ in param1)
|
||||
{
|
||||
if(_loc8_.layoutMetadata.includeInLayout)
|
||||
{
|
||||
_loc6_ = this.calculateTargetBounds(_loc8_,_loc2_.x,_loc2_.y);
|
||||
_loc6_.x = _loc6_.x || 0;
|
||||
_loc6_.y = _loc6_.y || 0;
|
||||
_loc6_.width = _loc6_.width || (_loc8_.measuredWidth || 0);
|
||||
_loc6_.height = _loc6_.height || (_loc8_.measuredHeight || 0);
|
||||
if(this.layoutMode == LayoutMode.HORIZONTAL)
|
||||
{
|
||||
if(!isNaN(_loc8_.layoutMetadata.percentWidth))
|
||||
{
|
||||
_loc4_.relativeSum += _loc8_.layoutMetadata.percentWidth;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc4_.absoluteSum += _loc6_.width;
|
||||
}
|
||||
if(_loc7_)
|
||||
{
|
||||
_loc6_.x = _loc7_.x + _loc7_.width;
|
||||
}
|
||||
_loc7_ = _loc6_;
|
||||
}
|
||||
else if(this.layoutMode == LayoutMode.VERTICAL)
|
||||
{
|
||||
if(!isNaN(_loc8_.layoutMetadata.percentHeight))
|
||||
{
|
||||
_loc4_.relativeSum += _loc8_.layoutMetadata.percentHeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc4_.absoluteSum += _loc6_.height;
|
||||
}
|
||||
if(_loc7_)
|
||||
{
|
||||
_loc6_.y = _loc7_.y + _loc7_.height;
|
||||
}
|
||||
_loc7_ = _loc6_;
|
||||
}
|
||||
_loc5_ = _loc5_.union(_loc6_);
|
||||
}
|
||||
}
|
||||
_loc2_.x = _loc2_.x || (_loc3_ == null || isNaN(_loc3_.width) ? _loc5_.width : _loc3_.width);
|
||||
_loc2_.y = _loc2_.y || (_loc3_ == null || isNaN(_loc3_.height) ? _loc5_.height : _loc3_.height);
|
||||
}
|
||||
return _loc2_;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,446 @@
|
||||
package org.osmf.layout
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.Sprite;
|
||||
import flash.errors.IllegalOperationError;
|
||||
import flash.events.Event;
|
||||
import flash.events.EventDispatcher;
|
||||
import flash.geom.Point;
|
||||
import flash.geom.Rectangle;
|
||||
import flash.utils.Dictionary;
|
||||
import org.osmf.events.DisplayObjectEvent;
|
||||
import org.osmf.metadata.Metadata;
|
||||
import org.osmf.metadata.MetadataWatcher;
|
||||
import org.osmf.utils.OSMFStrings;
|
||||
|
||||
public class LayoutRendererBase extends EventDispatcher
|
||||
{
|
||||
|
||||
private static var cleaningRenderers:Boolean;
|
||||
|
||||
private static var dispatcher:DisplayObject = new Sprite();
|
||||
|
||||
private static var dirtyRenderers:Vector.<LayoutRendererBase> = new Vector.<LayoutRendererBase>();
|
||||
|
||||
private var _parent:LayoutRendererBase;
|
||||
|
||||
private var _container:ILayoutTarget;
|
||||
|
||||
private var layoutMetadata:LayoutMetadata;
|
||||
|
||||
private var layoutTargets:Vector.<ILayoutTarget> = new Vector.<ILayoutTarget>();
|
||||
|
||||
private var stagedDisplayObjects:Dictionary = new Dictionary(true);
|
||||
|
||||
private var _measuredWidth:Number;
|
||||
|
||||
private var _measuredHeight:Number;
|
||||
|
||||
private var dirty:Boolean;
|
||||
|
||||
private var cleaning:Boolean;
|
||||
|
||||
private var metaDataWatchers:Dictionary = new Dictionary();
|
||||
|
||||
public function LayoutRendererBase()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
private static function flagDirty(param1:LayoutRendererBase) : void
|
||||
{
|
||||
if(param1 == null || dirtyRenderers.indexOf(param1) != -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
dirtyRenderers.push(param1);
|
||||
if(cleaningRenderers == false)
|
||||
{
|
||||
dispatcher.addEventListener(Event.EXIT_FRAME,onExitFrame);
|
||||
}
|
||||
}
|
||||
|
||||
private static function flagClean(param1:LayoutRendererBase) : void
|
||||
{
|
||||
var _loc2_:Number = dirtyRenderers.indexOf(param1);
|
||||
if(_loc2_ != -1)
|
||||
{
|
||||
dirtyRenderers.splice(_loc2_,1);
|
||||
}
|
||||
}
|
||||
|
||||
private static function onExitFrame(param1:Event) : void
|
||||
{
|
||||
var _loc2_:LayoutRendererBase = null;
|
||||
dispatcher.removeEventListener(Event.EXIT_FRAME,onExitFrame);
|
||||
cleaningRenderers = true;
|
||||
while(dirtyRenderers.length != 0)
|
||||
{
|
||||
_loc2_ = dirtyRenderers.shift();
|
||||
if(_loc2_.parent == null)
|
||||
{
|
||||
_loc2_.validateNow();
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc2_.dirty = false;
|
||||
}
|
||||
}
|
||||
cleaningRenderers = false;
|
||||
}
|
||||
|
||||
final public function get parent() : LayoutRendererBase
|
||||
{
|
||||
return this._parent;
|
||||
}
|
||||
|
||||
final internal function setParent(param1:LayoutRendererBase) : void
|
||||
{
|
||||
this._parent = param1;
|
||||
this.processParentChange(this._parent);
|
||||
}
|
||||
|
||||
final public function get container() : ILayoutTarget
|
||||
{
|
||||
return this._container;
|
||||
}
|
||||
|
||||
final public function set container(param1:ILayoutTarget) : void
|
||||
{
|
||||
var _loc2_:ILayoutTarget = null;
|
||||
if(param1 != this._container)
|
||||
{
|
||||
_loc2_ = this._container;
|
||||
if(_loc2_ != null)
|
||||
{
|
||||
this.reset();
|
||||
_loc2_.dispatchEvent(new LayoutTargetEvent(LayoutTargetEvent.UNSET_AS_LAYOUT_RENDERER_CONTAINER,false,false,this));
|
||||
_loc2_.removeEventListener(DisplayObjectEvent.MEDIA_SIZE_CHANGE,this.invalidatingEventHandler);
|
||||
}
|
||||
this._container = param1;
|
||||
if(this._container)
|
||||
{
|
||||
this.layoutMetadata = this._container.layoutMetadata;
|
||||
this._container.addEventListener(DisplayObjectEvent.MEDIA_SIZE_CHANGE,this.invalidatingEventHandler,false,0,true);
|
||||
this._container.dispatchEvent(new LayoutTargetEvent(LayoutTargetEvent.SET_AS_LAYOUT_RENDERER_CONTAINER,false,false,this));
|
||||
this.invalidate();
|
||||
}
|
||||
this.processContainerChange(_loc2_,param1);
|
||||
}
|
||||
}
|
||||
|
||||
final public function addTarget(param1:ILayoutTarget) : ILayoutTarget
|
||||
{
|
||||
var _loc4_:String = null;
|
||||
var _loc5_:MetadataWatcher = null;
|
||||
if(param1 == null)
|
||||
{
|
||||
throw new IllegalOperationError(OSMFStrings.getString(OSMFStrings.NULL_PARAM));
|
||||
}
|
||||
if(this.layoutTargets.indexOf(param1) != -1)
|
||||
{
|
||||
throw new IllegalOperationError(OSMFStrings.getString(OSMFStrings.INVALID_PARAM));
|
||||
}
|
||||
param1.dispatchEvent(new LayoutTargetEvent(LayoutTargetEvent.ADD_TO_LAYOUT_RENDERER,false,false,this));
|
||||
var _loc2_:int = Math.abs(BinarySearch.search(this.layoutTargets,this.compareTargets,param1));
|
||||
this.layoutTargets.splice(_loc2_,0,param1);
|
||||
var _loc3_:Array = this.metaDataWatchers[param1] = new Array();
|
||||
for each(_loc4_ in this.usedMetadatas)
|
||||
{
|
||||
_loc5_ = new MetadataWatcher(param1.layoutMetadata,_loc4_,null,this.targetMetadataChangeCallback);
|
||||
_loc5_.watch();
|
||||
_loc3_.push(_loc5_);
|
||||
}
|
||||
param1.addEventListener(DisplayObjectEvent.DISPLAY_OBJECT_CHANGE,this.invalidatingEventHandler);
|
||||
param1.addEventListener(DisplayObjectEvent.MEDIA_SIZE_CHANGE,this.invalidatingEventHandler);
|
||||
param1.addEventListener(LayoutTargetEvent.ADD_TO_LAYOUT_RENDERER,this.onTargetAddedToRenderer);
|
||||
param1.addEventListener(LayoutTargetEvent.SET_AS_LAYOUT_RENDERER_CONTAINER,this.onTargetSetAsContainer);
|
||||
this.invalidate();
|
||||
this.processTargetAdded(param1);
|
||||
return param1;
|
||||
}
|
||||
|
||||
final public function removeTarget(param1:ILayoutTarget) : ILayoutTarget
|
||||
{
|
||||
var _loc2_:ILayoutTarget = null;
|
||||
var _loc4_:MetadataWatcher = null;
|
||||
if(param1 == null)
|
||||
{
|
||||
throw new IllegalOperationError(OSMFStrings.getString(OSMFStrings.NULL_PARAM));
|
||||
}
|
||||
var _loc3_:Number = this.layoutTargets.indexOf(param1);
|
||||
if(_loc3_ != -1)
|
||||
{
|
||||
this.removeFromStage(param1);
|
||||
_loc2_ = this.layoutTargets.splice(_loc3_,1)[0];
|
||||
param1.removeEventListener(DisplayObjectEvent.DISPLAY_OBJECT_CHANGE,this.invalidatingEventHandler);
|
||||
param1.removeEventListener(DisplayObjectEvent.MEDIA_SIZE_CHANGE,this.invalidatingEventHandler);
|
||||
param1.removeEventListener(LayoutTargetEvent.ADD_TO_LAYOUT_RENDERER,this.onTargetAddedToRenderer);
|
||||
param1.removeEventListener(LayoutTargetEvent.SET_AS_LAYOUT_RENDERER_CONTAINER,this.onTargetSetAsContainer);
|
||||
for each(_loc4_ in this.metaDataWatchers[param1])
|
||||
{
|
||||
_loc4_.unwatch();
|
||||
}
|
||||
delete this.metaDataWatchers[param1];
|
||||
this.processTargetRemoved(param1);
|
||||
param1.dispatchEvent(new LayoutTargetEvent(LayoutTargetEvent.REMOVE_FROM_LAYOUT_RENDERER,false,false,this));
|
||||
this.invalidate();
|
||||
return _loc2_;
|
||||
}
|
||||
throw new IllegalOperationError(OSMFStrings.getString(OSMFStrings.INVALID_PARAM));
|
||||
}
|
||||
|
||||
final public function hasTarget(param1:ILayoutTarget) : Boolean
|
||||
{
|
||||
return this.layoutTargets.indexOf(param1) != -1;
|
||||
}
|
||||
|
||||
final public function get measuredWidth() : Number
|
||||
{
|
||||
return this._measuredWidth;
|
||||
}
|
||||
|
||||
final public function get measuredHeight() : Number
|
||||
{
|
||||
return this._measuredHeight;
|
||||
}
|
||||
|
||||
final public function invalidate() : void
|
||||
{
|
||||
if(this.cleaning == false && this.dirty == false)
|
||||
{
|
||||
this.dirty = true;
|
||||
if(this._parent != null)
|
||||
{
|
||||
this._parent.invalidate();
|
||||
}
|
||||
else
|
||||
{
|
||||
flagDirty(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final public function validateNow() : void
|
||||
{
|
||||
if(this._container == null || this.cleaning == true)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(this._parent)
|
||||
{
|
||||
this._parent.validateNow();
|
||||
return;
|
||||
}
|
||||
this.cleaning = true;
|
||||
this.measure();
|
||||
this.layout(this._measuredWidth,this._measuredHeight);
|
||||
this.cleaning = false;
|
||||
}
|
||||
|
||||
internal function measure() : void
|
||||
{
|
||||
var _loc1_:ILayoutTarget = null;
|
||||
var _loc2_:Point = null;
|
||||
this.prepareTargets();
|
||||
for each(_loc1_ in this.layoutTargets)
|
||||
{
|
||||
_loc1_.measure(true);
|
||||
}
|
||||
_loc2_ = this.calculateContainerSize(this.layoutTargets);
|
||||
this._measuredWidth = _loc2_.x;
|
||||
this._measuredHeight = _loc2_.y;
|
||||
this._container.measure(false);
|
||||
}
|
||||
|
||||
internal function layout(param1:Number, param2:Number) : void
|
||||
{
|
||||
var _loc3_:ILayoutTarget = null;
|
||||
var _loc4_:Rectangle = null;
|
||||
var _loc5_:DisplayObject = null;
|
||||
this.processUpdateMediaDisplayBegin(this.layoutTargets);
|
||||
this._container.layout(param1,param2,false);
|
||||
for each(_loc3_ in this.layoutTargets)
|
||||
{
|
||||
_loc4_ = this.calculateTargetBounds(_loc3_,param1,param2);
|
||||
_loc3_.layout(_loc4_.width,_loc4_.height,true);
|
||||
_loc5_ = _loc3_.displayObject;
|
||||
if(_loc5_)
|
||||
{
|
||||
_loc5_.x = _loc4_.x;
|
||||
_loc5_.y = _loc4_.y;
|
||||
}
|
||||
}
|
||||
this.dirty = false;
|
||||
this.processUpdateMediaDisplayEnd();
|
||||
}
|
||||
|
||||
protected function get usedMetadatas() : Vector.<String>
|
||||
{
|
||||
return new Vector.<String>();
|
||||
}
|
||||
|
||||
protected function compareTargets(param1:ILayoutTarget, param2:ILayoutTarget) : Number
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected function processContainerChange(param1:ILayoutTarget, param2:ILayoutTarget) : void
|
||||
{
|
||||
}
|
||||
|
||||
protected function processTargetAdded(param1:ILayoutTarget) : void
|
||||
{
|
||||
}
|
||||
|
||||
protected function processTargetRemoved(param1:ILayoutTarget) : void
|
||||
{
|
||||
}
|
||||
|
||||
protected function processStagedTarget(param1:ILayoutTarget) : void
|
||||
{
|
||||
}
|
||||
|
||||
protected function processUnstagedTarget(param1:ILayoutTarget) : void
|
||||
{
|
||||
}
|
||||
|
||||
protected function processUpdateMediaDisplayBegin(param1:Vector.<ILayoutTarget>) : void
|
||||
{
|
||||
}
|
||||
|
||||
protected function processUpdateMediaDisplayEnd() : void
|
||||
{
|
||||
}
|
||||
|
||||
protected function updateTargetOrder(param1:ILayoutTarget) : void
|
||||
{
|
||||
var _loc2_:int = this.layoutTargets.indexOf(param1);
|
||||
if(_loc2_ != -1)
|
||||
{
|
||||
this.layoutTargets.splice(_loc2_,1);
|
||||
_loc2_ = Math.abs(BinarySearch.search(this.layoutTargets,this.compareTargets,param1));
|
||||
this.layoutTargets.splice(_loc2_,0,param1);
|
||||
}
|
||||
}
|
||||
|
||||
protected function calculateTargetBounds(param1:ILayoutTarget, param2:Number, param3:Number) : Rectangle
|
||||
{
|
||||
return new Rectangle();
|
||||
}
|
||||
|
||||
protected function calculateContainerSize(param1:Vector.<ILayoutTarget>) : Point
|
||||
{
|
||||
return new Point();
|
||||
}
|
||||
|
||||
protected function processParentChange(param1:LayoutRendererBase) : void
|
||||
{
|
||||
}
|
||||
|
||||
private function reset() : void
|
||||
{
|
||||
var _loc1_:ILayoutTarget = null;
|
||||
for each(_loc1_ in this.layoutTargets)
|
||||
{
|
||||
this.removeTarget(_loc1_);
|
||||
}
|
||||
if(this._container)
|
||||
{
|
||||
this._container.removeEventListener(DisplayObjectEvent.MEDIA_SIZE_CHANGE,this.invalidatingEventHandler);
|
||||
this.validateNow();
|
||||
}
|
||||
this._container = null;
|
||||
this.layoutMetadata = null;
|
||||
}
|
||||
|
||||
private function targetMetadataChangeCallback(param1:Metadata) : void
|
||||
{
|
||||
this.invalidate();
|
||||
}
|
||||
|
||||
private function invalidatingEventHandler(param1:Event) : void
|
||||
{
|
||||
this.invalidate();
|
||||
}
|
||||
|
||||
private function onTargetAddedToRenderer(param1:LayoutTargetEvent) : void
|
||||
{
|
||||
var _loc2_:ILayoutTarget = null;
|
||||
if(param1.layoutRenderer != this)
|
||||
{
|
||||
_loc2_ = param1.target as ILayoutTarget;
|
||||
if(this.hasTarget(_loc2_))
|
||||
{
|
||||
this.removeTarget(_loc2_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function onTargetSetAsContainer(param1:LayoutTargetEvent) : void
|
||||
{
|
||||
var _loc2_:ILayoutTarget = null;
|
||||
if(param1.layoutRenderer != this)
|
||||
{
|
||||
_loc2_ = param1.target as ILayoutTarget;
|
||||
if(this.container == _loc2_)
|
||||
{
|
||||
this.container = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function prepareTargets() : void
|
||||
{
|
||||
var _loc2_:ILayoutTarget = null;
|
||||
var _loc3_:DisplayObject = null;
|
||||
var _loc1_:int = 0;
|
||||
for each(_loc2_ in this.layoutTargets)
|
||||
{
|
||||
_loc3_ = _loc2_.displayObject;
|
||||
if(_loc3_)
|
||||
{
|
||||
this.addToStage(_loc2_,_loc2_.displayObject,_loc1_);
|
||||
_loc1_++;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.removeFromStage(_loc2_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function addToStage(param1:ILayoutTarget, param2:DisplayObject, param3:Number) : void
|
||||
{
|
||||
var _loc4_:DisplayObject = this.stagedDisplayObjects[param1];
|
||||
if(_loc4_ == param2)
|
||||
{
|
||||
this._container.dispatchEvent(new LayoutTargetEvent(LayoutTargetEvent.SET_CHILD_INDEX,false,false,this,param1,_loc4_,param3));
|
||||
}
|
||||
else
|
||||
{
|
||||
if(_loc4_ != null)
|
||||
{
|
||||
this._container.dispatchEvent(new LayoutTargetEvent(LayoutTargetEvent.REMOVE_CHILD,false,false,this,param1,_loc4_));
|
||||
}
|
||||
this.stagedDisplayObjects[param1] = param2;
|
||||
this._container.dispatchEvent(new LayoutTargetEvent(LayoutTargetEvent.ADD_CHILD_AT,false,false,this,param1,param2,param3));
|
||||
if(_loc4_ == null)
|
||||
{
|
||||
this.processStagedTarget(param1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function removeFromStage(param1:ILayoutTarget) : void
|
||||
{
|
||||
var _loc2_:DisplayObject = this.stagedDisplayObjects[param1];
|
||||
if(_loc2_ != null)
|
||||
{
|
||||
delete this.stagedDisplayObjects[param1];
|
||||
this._container.dispatchEvent(new LayoutTargetEvent(LayoutTargetEvent.REMOVE_CHILD,false,false,this,param1,_loc2_));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
package org.osmf.layout
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.events.Event;
|
||||
|
||||
public class LayoutTargetEvent extends Event
|
||||
{
|
||||
|
||||
public static const SET_AS_LAYOUT_RENDERER_CONTAINER:String = "setAsLayoutRendererContainer";
|
||||
|
||||
public static const UNSET_AS_LAYOUT_RENDERER_CONTAINER:String = "unsetAsLayoutRendererContainer";
|
||||
|
||||
public static const ADD_TO_LAYOUT_RENDERER:String = "addToLayoutRenderer";
|
||||
|
||||
public static const REMOVE_FROM_LAYOUT_RENDERER:String = "removeFromLayoutRenderer";
|
||||
|
||||
public static const ADD_CHILD_AT:String = "addChildAt";
|
||||
|
||||
public static const REMOVE_CHILD:String = "removeChild";
|
||||
|
||||
public static const SET_CHILD_INDEX:String = "setChildIndex";
|
||||
|
||||
private var _layoutRenderer:LayoutRendererBase;
|
||||
|
||||
private var _layoutTarget:ILayoutTarget;
|
||||
|
||||
private var _displayObject:DisplayObject;
|
||||
|
||||
private var _index:int;
|
||||
|
||||
public function LayoutTargetEvent(param1:String, param2:Boolean = false, param3:Boolean = false, param4:LayoutRendererBase = null, param5:ILayoutTarget = null, param6:DisplayObject = null, param7:int = -1)
|
||||
{
|
||||
this._layoutRenderer = param4;
|
||||
this._layoutTarget = param5;
|
||||
this._displayObject = param6;
|
||||
this._index = param7;
|
||||
super(param1,param2,param3);
|
||||
}
|
||||
|
||||
public function get layoutRenderer() : LayoutRendererBase
|
||||
{
|
||||
return this._layoutRenderer;
|
||||
}
|
||||
|
||||
public function get layoutTarget() : ILayoutTarget
|
||||
{
|
||||
return this._layoutTarget;
|
||||
}
|
||||
|
||||
public function get displayObject() : DisplayObject
|
||||
{
|
||||
return this._displayObject;
|
||||
}
|
||||
|
||||
public function get index() : int
|
||||
{
|
||||
return this._index;
|
||||
}
|
||||
|
||||
override public function clone() : Event
|
||||
{
|
||||
return new LayoutTargetEvent(type,bubbles,cancelable,this._layoutRenderer,this._layoutTarget,this._displayObject,this._index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
package org.osmf.layout
|
||||
{
|
||||
internal class LayoutTargetRenderers
|
||||
{
|
||||
|
||||
public var containerRenderer:LayoutRendererBase;
|
||||
|
||||
public var parentRenderer:LayoutRendererBase;
|
||||
|
||||
public function LayoutTargetRenderers(param1:ILayoutTarget)
|
||||
{
|
||||
super();
|
||||
param1.addEventListener(LayoutTargetEvent.ADD_TO_LAYOUT_RENDERER,this.onAddedToLayoutRenderer);
|
||||
param1.addEventListener(LayoutTargetEvent.REMOVE_FROM_LAYOUT_RENDERER,this.onRemovedFromLayoutRenderer);
|
||||
param1.addEventListener(LayoutTargetEvent.SET_AS_LAYOUT_RENDERER_CONTAINER,this.onSetAsLayoutRendererContainer);
|
||||
param1.addEventListener(LayoutTargetEvent.UNSET_AS_LAYOUT_RENDERER_CONTAINER,this.onUnsetAsLayoutRendererContainer);
|
||||
}
|
||||
|
||||
private function onSetAsLayoutRendererContainer(param1:LayoutTargetEvent) : void
|
||||
{
|
||||
if(this.containerRenderer != param1.layoutRenderer)
|
||||
{
|
||||
this.containerRenderer = param1.layoutRenderer;
|
||||
this.containerRenderer.setParent(this.parentRenderer);
|
||||
}
|
||||
}
|
||||
|
||||
private function onUnsetAsLayoutRendererContainer(param1:LayoutTargetEvent) : void
|
||||
{
|
||||
if(this.containerRenderer != null && this.containerRenderer == param1.layoutRenderer)
|
||||
{
|
||||
this.containerRenderer.setParent(null);
|
||||
this.containerRenderer = null;
|
||||
}
|
||||
}
|
||||
|
||||
private function onAddedToLayoutRenderer(param1:LayoutTargetEvent) : void
|
||||
{
|
||||
if(this.parentRenderer != param1.layoutRenderer)
|
||||
{
|
||||
this.parentRenderer = param1.layoutRenderer;
|
||||
if(this.containerRenderer)
|
||||
{
|
||||
this.containerRenderer.setParent(this.parentRenderer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function onRemovedFromLayoutRenderer(param1:LayoutTargetEvent) : void
|
||||
{
|
||||
if(this.parentRenderer == param1.layoutRenderer)
|
||||
{
|
||||
this.parentRenderer = null;
|
||||
if(this.containerRenderer)
|
||||
{
|
||||
this.containerRenderer.setParent(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,134 @@
|
||||
package org.osmf.layout
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.Sprite;
|
||||
import org.osmf.events.DisplayObjectEvent;
|
||||
|
||||
public class LayoutTargetSprite extends Sprite implements ILayoutTarget
|
||||
{
|
||||
|
||||
private var _layoutMetadata:LayoutMetadata;
|
||||
|
||||
private var _measuredWidth:Number = NaN;
|
||||
|
||||
private var _measuredHeight:Number = NaN;
|
||||
|
||||
private var renderers:LayoutTargetRenderers = new LayoutTargetRenderers(this);
|
||||
|
||||
public function LayoutTargetSprite(param1:LayoutMetadata = null)
|
||||
{
|
||||
this._layoutMetadata = param1 || new LayoutMetadata();
|
||||
addEventListener(LayoutTargetEvent.ADD_CHILD_AT,this.onAddChildAt);
|
||||
addEventListener(LayoutTargetEvent.SET_CHILD_INDEX,this.onSetChildIndex);
|
||||
addEventListener(LayoutTargetEvent.REMOVE_CHILD,this.onRemoveChild);
|
||||
mouseEnabled = true;
|
||||
mouseChildren = true;
|
||||
super();
|
||||
}
|
||||
|
||||
public function get displayObject() : DisplayObject
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
public function get layoutMetadata() : LayoutMetadata
|
||||
{
|
||||
return this._layoutMetadata;
|
||||
}
|
||||
|
||||
public function get measuredWidth() : Number
|
||||
{
|
||||
return this._measuredWidth;
|
||||
}
|
||||
|
||||
public function get measuredHeight() : Number
|
||||
{
|
||||
return this._measuredHeight;
|
||||
}
|
||||
|
||||
public function measure(param1:Boolean = true) : void
|
||||
{
|
||||
var _loc2_:Number = NaN;
|
||||
var _loc3_:Number = NaN;
|
||||
var _loc4_:DisplayObjectEvent = null;
|
||||
if(param1 && Boolean(this.renderers.containerRenderer))
|
||||
{
|
||||
this.renderers.containerRenderer.measure();
|
||||
}
|
||||
if(this.renderers.containerRenderer)
|
||||
{
|
||||
_loc2_ = this.renderers.containerRenderer.measuredWidth;
|
||||
_loc3_ = this.renderers.containerRenderer.measuredHeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc2_ = super.width / scaleX;
|
||||
_loc3_ = super.height / scaleY;
|
||||
}
|
||||
if(_loc2_ != this._measuredWidth || _loc3_ != this._measuredHeight)
|
||||
{
|
||||
_loc4_ = new DisplayObjectEvent(DisplayObjectEvent.MEDIA_SIZE_CHANGE,false,false,null,null,this._measuredWidth,this._measuredHeight,_loc2_,_loc3_);
|
||||
this._measuredWidth = _loc2_;
|
||||
this._measuredHeight = _loc3_;
|
||||
dispatchEvent(_loc4_);
|
||||
}
|
||||
}
|
||||
|
||||
public function layout(param1:Number, param2:Number, param3:Boolean = true) : void
|
||||
{
|
||||
if(this.renderers.containerRenderer == null)
|
||||
{
|
||||
super.width = param1;
|
||||
super.height = param2;
|
||||
}
|
||||
else if(param3)
|
||||
{
|
||||
this.renderers.containerRenderer.layout(param1,param2);
|
||||
}
|
||||
}
|
||||
|
||||
public function validateNow() : void
|
||||
{
|
||||
if(this.renderers.containerRenderer)
|
||||
{
|
||||
this.renderers.containerRenderer.validateNow();
|
||||
}
|
||||
}
|
||||
|
||||
protected function onAddChildAt(param1:LayoutTargetEvent) : void
|
||||
{
|
||||
addChildAt(param1.displayObject,param1.index);
|
||||
}
|
||||
|
||||
protected function onRemoveChild(param1:LayoutTargetEvent) : void
|
||||
{
|
||||
removeChild(param1.displayObject);
|
||||
}
|
||||
|
||||
protected function onSetChildIndex(param1:LayoutTargetEvent) : void
|
||||
{
|
||||
setChildIndex(param1.displayObject,param1.index);
|
||||
}
|
||||
|
||||
override public function set width(param1:Number) : void
|
||||
{
|
||||
this._layoutMetadata.width = param1;
|
||||
}
|
||||
|
||||
override public function get width() : Number
|
||||
{
|
||||
return this._measuredWidth;
|
||||
}
|
||||
|
||||
override public function set height(param1:Number) : void
|
||||
{
|
||||
this._layoutMetadata.height = param1;
|
||||
}
|
||||
|
||||
override public function get height() : Number
|
||||
{
|
||||
return this._measuredHeight;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,229 @@
|
||||
package org.osmf.layout
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.DisplayObjectContainer;
|
||||
import flash.errors.IllegalOperationError;
|
||||
import flash.events.EventDispatcher;
|
||||
import flash.utils.Dictionary;
|
||||
import org.osmf.events.DisplayObjectEvent;
|
||||
import org.osmf.events.MediaElementEvent;
|
||||
import org.osmf.media.MediaElement;
|
||||
import org.osmf.traits.DisplayObjectTrait;
|
||||
import org.osmf.traits.MediaTraitType;
|
||||
import org.osmf.utils.OSMFStrings;
|
||||
|
||||
public class MediaElementLayoutTarget extends EventDispatcher implements ILayoutTarget
|
||||
{
|
||||
|
||||
private static const layoutTargets:Dictionary = new Dictionary(true);
|
||||
|
||||
private var _mediaElement:MediaElement;
|
||||
|
||||
private var _layoutMetadata:LayoutMetadata;
|
||||
|
||||
private var displayObjectTrait:DisplayObjectTrait;
|
||||
|
||||
private var _displayObject:DisplayObject;
|
||||
|
||||
private var renderers:LayoutTargetRenderers;
|
||||
|
||||
public function MediaElementLayoutTarget(param1:MediaElement, param2:Class)
|
||||
{
|
||||
super();
|
||||
if(param2 != ConstructorLock)
|
||||
{
|
||||
throw new IllegalOperationError(OSMFStrings.getString(OSMFStrings.ILLEGAL_CONSTRUCTOR_INVOCATION));
|
||||
}
|
||||
this._mediaElement = param1;
|
||||
this._mediaElement.addEventListener(MediaElementEvent.TRAIT_ADD,this.onMediaElementTraitsChange);
|
||||
this._mediaElement.addEventListener(MediaElementEvent.TRAIT_REMOVE,this.onMediaElementTraitsChange);
|
||||
this._mediaElement.addEventListener(MediaElementEvent.METADATA_ADD,this.onMetadataAdd);
|
||||
this._mediaElement.addEventListener(MediaElementEvent.METADATA_REMOVE,this.onMetadataRemove);
|
||||
this.renderers = new LayoutTargetRenderers(this);
|
||||
this._layoutMetadata = this._mediaElement.getMetadata(LayoutMetadata.LAYOUT_NAMESPACE) as LayoutMetadata;
|
||||
addEventListener(LayoutTargetEvent.ADD_CHILD_AT,this.onAddChildAt);
|
||||
addEventListener(LayoutTargetEvent.SET_CHILD_INDEX,this.onSetChildIndex);
|
||||
addEventListener(LayoutTargetEvent.REMOVE_CHILD,this.onRemoveChild);
|
||||
this.onMediaElementTraitsChange();
|
||||
}
|
||||
|
||||
public static function getInstance(param1:MediaElement) : MediaElementLayoutTarget
|
||||
{
|
||||
var _loc2_:* = undefined;
|
||||
for(_loc2_ in layoutTargets)
|
||||
{
|
||||
if(_loc2_.mediaElement == param1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
_loc2_ = null;
|
||||
}
|
||||
if(_loc2_ == null)
|
||||
{
|
||||
_loc2_ = new MediaElementLayoutTarget(param1,ConstructorLock);
|
||||
layoutTargets[_loc2_] = true;
|
||||
}
|
||||
return _loc2_;
|
||||
}
|
||||
|
||||
public function get mediaElement() : MediaElement
|
||||
{
|
||||
return this._mediaElement;
|
||||
}
|
||||
|
||||
public function get layoutMetadata() : LayoutMetadata
|
||||
{
|
||||
if(this._layoutMetadata == null)
|
||||
{
|
||||
this._layoutMetadata = new LayoutMetadata();
|
||||
this._mediaElement.addMetadata(LayoutMetadata.LAYOUT_NAMESPACE,this._layoutMetadata);
|
||||
}
|
||||
return this._layoutMetadata;
|
||||
}
|
||||
|
||||
public function get displayObject() : DisplayObject
|
||||
{
|
||||
return this._displayObject;
|
||||
}
|
||||
|
||||
public function get measuredWidth() : Number
|
||||
{
|
||||
return this.displayObjectTrait ? this.displayObjectTrait.mediaWidth : NaN;
|
||||
}
|
||||
|
||||
public function get measuredHeight() : Number
|
||||
{
|
||||
return this.displayObjectTrait ? this.displayObjectTrait.mediaHeight : NaN;
|
||||
}
|
||||
|
||||
public function measure(param1:Boolean = true) : void
|
||||
{
|
||||
if(this._displayObject is ILayoutTarget)
|
||||
{
|
||||
ILayoutTarget(this._displayObject).measure(param1);
|
||||
}
|
||||
}
|
||||
|
||||
public function layout(param1:Number, param2:Number, param3:Boolean = true) : void
|
||||
{
|
||||
if(this._displayObject is ILayoutTarget)
|
||||
{
|
||||
ILayoutTarget(this._displayObject).layout(param1,param2,param3);
|
||||
}
|
||||
else if(this._displayObject != null && this.renderers.containerRenderer == null)
|
||||
{
|
||||
this._displayObject.width = param1;
|
||||
this._displayObject.height = param2;
|
||||
}
|
||||
}
|
||||
|
||||
private function onMediaElementTraitsChange(param1:MediaElementEvent = null) : void
|
||||
{
|
||||
var _loc2_:DisplayObjectTrait = null;
|
||||
if(param1 == null || Boolean(param1) && Boolean(param1.traitType == MediaTraitType.DISPLAY_OBJECT))
|
||||
{
|
||||
_loc2_ = Boolean(param1) && param1.type == MediaElementEvent.TRAIT_REMOVE ? null : this._mediaElement.getTrait(MediaTraitType.DISPLAY_OBJECT) as DisplayObjectTrait;
|
||||
if(_loc2_ != this.displayObjectTrait)
|
||||
{
|
||||
if(this.displayObjectTrait)
|
||||
{
|
||||
this.displayObjectTrait.removeEventListener(DisplayObjectEvent.DISPLAY_OBJECT_CHANGE,this.onDisplayObjectTraitDisplayObjecChange);
|
||||
this.displayObjectTrait.removeEventListener(DisplayObjectEvent.MEDIA_SIZE_CHANGE,this.onDisplayObjectTraitMediaSizeChange);
|
||||
}
|
||||
this.displayObjectTrait = _loc2_;
|
||||
if(this.displayObjectTrait)
|
||||
{
|
||||
this.displayObjectTrait.addEventListener(DisplayObjectEvent.DISPLAY_OBJECT_CHANGE,this.onDisplayObjectTraitDisplayObjecChange);
|
||||
this.displayObjectTrait.addEventListener(DisplayObjectEvent.MEDIA_SIZE_CHANGE,this.onDisplayObjectTraitMediaSizeChange);
|
||||
}
|
||||
this.updateDisplayObject(this.displayObjectTrait ? this.displayObjectTrait.displayObject : null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function onMetadataAdd(param1:MediaElementEvent) : void
|
||||
{
|
||||
if(param1.namespaceURL == LayoutMetadata.LAYOUT_NAMESPACE)
|
||||
{
|
||||
this._layoutMetadata = param1.metadata as LayoutMetadata;
|
||||
}
|
||||
}
|
||||
|
||||
private function onMetadataRemove(param1:MediaElementEvent) : void
|
||||
{
|
||||
if(param1.namespaceURL == LayoutMetadata.LAYOUT_NAMESPACE)
|
||||
{
|
||||
this._layoutMetadata = null;
|
||||
}
|
||||
}
|
||||
|
||||
private function updateDisplayObject(param1:DisplayObject) : void
|
||||
{
|
||||
var _loc2_:DisplayObject = this._displayObject;
|
||||
if(param1 != this.displayObject)
|
||||
{
|
||||
this._displayObject = param1;
|
||||
dispatchEvent(new DisplayObjectEvent(DisplayObjectEvent.DISPLAY_OBJECT_CHANGE,false,false,_loc2_,param1));
|
||||
}
|
||||
if(param1 is ILayoutTarget && Boolean(this.renderers.parentRenderer))
|
||||
{
|
||||
ILayoutTarget(param1).dispatchEvent(new LayoutTargetEvent(LayoutTargetEvent.ADD_TO_LAYOUT_RENDERER,false,false,this.renderers.parentRenderer));
|
||||
}
|
||||
}
|
||||
|
||||
private function onDisplayObjectTraitDisplayObjecChange(param1:DisplayObjectEvent) : void
|
||||
{
|
||||
this.updateDisplayObject(param1.newDisplayObject);
|
||||
}
|
||||
|
||||
private function onDisplayObjectTraitMediaSizeChange(param1:DisplayObjectEvent) : void
|
||||
{
|
||||
dispatchEvent(param1.clone());
|
||||
}
|
||||
|
||||
private function onAddChildAt(param1:LayoutTargetEvent) : void
|
||||
{
|
||||
if(this._displayObject is ILayoutTarget)
|
||||
{
|
||||
ILayoutTarget(this._displayObject).dispatchEvent(param1.clone());
|
||||
}
|
||||
else if(this._displayObject is DisplayObjectContainer)
|
||||
{
|
||||
DisplayObjectContainer(this._displayObject).addChildAt(param1.displayObject,param1.index);
|
||||
}
|
||||
}
|
||||
|
||||
private function onRemoveChild(param1:LayoutTargetEvent) : void
|
||||
{
|
||||
if(this._displayObject is ILayoutTarget)
|
||||
{
|
||||
ILayoutTarget(this._displayObject).dispatchEvent(param1.clone());
|
||||
}
|
||||
else if(this._displayObject is DisplayObjectContainer)
|
||||
{
|
||||
DisplayObjectContainer(this._displayObject).removeChild(param1.displayObject);
|
||||
}
|
||||
}
|
||||
|
||||
private function onSetChildIndex(param1:LayoutTargetEvent) : void
|
||||
{
|
||||
if(this._displayObject is ILayoutTarget)
|
||||
{
|
||||
ILayoutTarget(this._displayObject).dispatchEvent(param1.clone());
|
||||
}
|
||||
else if(this._displayObject is DisplayObjectContainer)
|
||||
{
|
||||
DisplayObjectContainer(this._displayObject).setChildIndex(param1.displayObject,param1.index);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ConstructorLock
|
||||
{
|
||||
|
||||
public function ConstructorLock()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
package org.osmf.layout
|
||||
{
|
||||
import org.osmf.events.MetadataEvent;
|
||||
import org.osmf.metadata.NonSynthesizingMetadata;
|
||||
|
||||
internal class PaddingLayoutMetadata extends NonSynthesizingMetadata
|
||||
{
|
||||
|
||||
public static const LEFT:String = "left";
|
||||
|
||||
public static const TOP:String = "top";
|
||||
|
||||
public static const RIGHT:String = "right";
|
||||
|
||||
public static const BOTTOM:String = "bottom";
|
||||
|
||||
private var _left:Number;
|
||||
|
||||
private var _top:Number;
|
||||
|
||||
private var _right:Number;
|
||||
|
||||
private var _bottom:Number;
|
||||
|
||||
public function PaddingLayoutMetadata()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
override public function getValue(param1:String) : *
|
||||
{
|
||||
if(param1 == null)
|
||||
{
|
||||
return undefined;
|
||||
}
|
||||
if(param1 == LEFT)
|
||||
{
|
||||
return this.left;
|
||||
}
|
||||
if(param1 == TOP)
|
||||
{
|
||||
return this.top;
|
||||
}
|
||||
if(param1 == RIGHT)
|
||||
{
|
||||
return this.right;
|
||||
}
|
||||
if(param1 == BOTTOM)
|
||||
{
|
||||
return this.bottom;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
public function get left() : Number
|
||||
{
|
||||
return this._left;
|
||||
}
|
||||
|
||||
public function set left(param1:Number) : void
|
||||
{
|
||||
var _loc2_:MetadataEvent = null;
|
||||
if(this._left != param1)
|
||||
{
|
||||
_loc2_ = new MetadataEvent(MetadataEvent.VALUE_CHANGE,false,false,LEFT,param1,this._left);
|
||||
this._left = param1;
|
||||
dispatchEvent(_loc2_);
|
||||
}
|
||||
}
|
||||
|
||||
public function get top() : Number
|
||||
{
|
||||
return this._top;
|
||||
}
|
||||
|
||||
public function set top(param1:Number) : void
|
||||
{
|
||||
var _loc2_:MetadataEvent = null;
|
||||
if(this._top != param1)
|
||||
{
|
||||
_loc2_ = new MetadataEvent(MetadataEvent.VALUE_CHANGE,false,false,TOP,param1,this._top);
|
||||
this._top = param1;
|
||||
dispatchEvent(_loc2_);
|
||||
}
|
||||
}
|
||||
|
||||
public function get right() : Number
|
||||
{
|
||||
return this._right;
|
||||
}
|
||||
|
||||
public function set right(param1:Number) : void
|
||||
{
|
||||
var _loc2_:MetadataEvent = null;
|
||||
if(this._right != param1)
|
||||
{
|
||||
_loc2_ = new MetadataEvent(MetadataEvent.VALUE_CHANGE,false,false,RIGHT,param1,this._right);
|
||||
this._right = param1;
|
||||
dispatchEvent(_loc2_);
|
||||
}
|
||||
}
|
||||
|
||||
public function get bottom() : Number
|
||||
{
|
||||
return this._bottom;
|
||||
}
|
||||
|
||||
public function set bottom(param1:Number) : void
|
||||
{
|
||||
var _loc2_:MetadataEvent = null;
|
||||
if(this._bottom != param1)
|
||||
{
|
||||
_loc2_ = new MetadataEvent(MetadataEvent.VALUE_CHANGE,false,false,BOTTOM,param1,this._bottom);
|
||||
this._bottom = param1;
|
||||
dispatchEvent(_loc2_);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
package org.osmf.layout
|
||||
{
|
||||
import org.osmf.events.MetadataEvent;
|
||||
import org.osmf.metadata.NonSynthesizingMetadata;
|
||||
|
||||
internal class RelativeLayoutMetadata extends NonSynthesizingMetadata
|
||||
{
|
||||
|
||||
public static const X:String = "x";
|
||||
|
||||
public static const Y:String = "y";
|
||||
|
||||
public static const WIDTH:String = "width";
|
||||
|
||||
public static const HEIGHT:String = "height";
|
||||
|
||||
private var _x:Number;
|
||||
|
||||
private var _y:Number;
|
||||
|
||||
private var _width:Number;
|
||||
|
||||
private var _height:Number;
|
||||
|
||||
public function RelativeLayoutMetadata()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
override public function getValue(param1:String) : *
|
||||
{
|
||||
if(param1 == null)
|
||||
{
|
||||
return undefined;
|
||||
}
|
||||
if(param1 == X)
|
||||
{
|
||||
return this.x;
|
||||
}
|
||||
if(param1 == Y)
|
||||
{
|
||||
return this.y;
|
||||
}
|
||||
if(param1 == WIDTH)
|
||||
{
|
||||
return this.width;
|
||||
}
|
||||
if(param1 == HEIGHT)
|
||||
{
|
||||
return this.height;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
public function get x() : Number
|
||||
{
|
||||
return this._x;
|
||||
}
|
||||
|
||||
public function set x(param1:Number) : void
|
||||
{
|
||||
var _loc2_:MetadataEvent = null;
|
||||
if(this._x != param1)
|
||||
{
|
||||
_loc2_ = new MetadataEvent(MetadataEvent.VALUE_CHANGE,false,false,X,param1,this._x);
|
||||
this._x = param1;
|
||||
dispatchEvent(_loc2_);
|
||||
}
|
||||
}
|
||||
|
||||
public function get y() : Number
|
||||
{
|
||||
return this._y;
|
||||
}
|
||||
|
||||
public function set y(param1:Number) : void
|
||||
{
|
||||
var _loc2_:MetadataEvent = null;
|
||||
if(this._y != param1)
|
||||
{
|
||||
_loc2_ = new MetadataEvent(MetadataEvent.VALUE_CHANGE,false,false,Y,param1,this._y);
|
||||
this._y = param1;
|
||||
dispatchEvent(_loc2_);
|
||||
}
|
||||
}
|
||||
|
||||
public function get width() : Number
|
||||
{
|
||||
return this._width;
|
||||
}
|
||||
|
||||
public function set width(param1:Number) : void
|
||||
{
|
||||
var _loc2_:MetadataEvent = null;
|
||||
if(this._width != param1)
|
||||
{
|
||||
_loc2_ = new MetadataEvent(MetadataEvent.VALUE_CHANGE,false,false,WIDTH,param1,this._width);
|
||||
this._width = param1;
|
||||
dispatchEvent(_loc2_);
|
||||
}
|
||||
}
|
||||
|
||||
public function get height() : Number
|
||||
{
|
||||
return this._height;
|
||||
}
|
||||
|
||||
public function set height(param1:Number) : void
|
||||
{
|
||||
var _loc2_:MetadataEvent = null;
|
||||
if(this._height != param1)
|
||||
{
|
||||
_loc2_ = new MetadataEvent(MetadataEvent.VALUE_CHANGE,false,false,HEIGHT,param1,this._height);
|
||||
this._height = param1;
|
||||
dispatchEvent(_loc2_);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package org.osmf.layout
|
||||
{
|
||||
public final class ScaleMode
|
||||
{
|
||||
|
||||
public static const NONE:String = "none";
|
||||
|
||||
public static const STRETCH:String = "stretch";
|
||||
|
||||
public static const LETTERBOX:String = "letterbox";
|
||||
|
||||
public static const ZOOM:String = "zoom";
|
||||
|
||||
public function ScaleMode()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package org.osmf.layout
|
||||
{
|
||||
import flash.geom.Point;
|
||||
|
||||
internal class ScaleModeUtils
|
||||
{
|
||||
|
||||
public function ScaleModeUtils()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function getScaledSize(param1:String, param2:Number, param3:Number, param4:Number, param5:Number) : Point
|
||||
{
|
||||
var _loc6_:Point = null;
|
||||
var _loc7_:Number = NaN;
|
||||
var _loc8_:Number = NaN;
|
||||
switch(param1)
|
||||
{
|
||||
case ScaleMode.ZOOM:
|
||||
case ScaleMode.LETTERBOX:
|
||||
_loc7_ = param2 / param3;
|
||||
_loc8_ = (param4 || param2) / (param5 || param3);
|
||||
if(param1 == ScaleMode.ZOOM && _loc8_ < _loc7_ || param1 == ScaleMode.LETTERBOX && _loc8_ > _loc7_)
|
||||
{
|
||||
_loc6_ = new Point(param2,param2 / _loc8_);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc6_ = new Point(param3 * _loc8_,param3);
|
||||
}
|
||||
break;
|
||||
case ScaleMode.STRETCH:
|
||||
_loc6_ = new Point(param2,param3);
|
||||
break;
|
||||
case ScaleMode.NONE:
|
||||
_loc6_ = new Point(param4 || param2,param5 || param3);
|
||||
}
|
||||
return _loc6_;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package org.osmf.layout
|
||||
{
|
||||
public final class VerticalAlign
|
||||
{
|
||||
|
||||
public static const TOP:String = "top";
|
||||
|
||||
public static const MIDDLE:String = "middle";
|
||||
|
||||
public static const BOTTOM:String = "bottom";
|
||||
|
||||
public function VerticalAlign()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user