flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yish...@apache.org
Subject git commit: [flex-asjs] [refs/heads/refactor-sprite] - Added html5 tranform bead which should work on non-svg elements.
Date Tue, 06 Sep 2016 09:30:41 GMT
Repository: flex-asjs
Updated Branches:
  refs/heads/refactor-sprite 5ca514a77 -> fc27a226c


Added html5 tranform bead which should work on non-svg elements.


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/fc27a226
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/fc27a226
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/fc27a226

Branch: refs/heads/refactor-sprite
Commit: fc27a226c79873fcff32d9835b9e0b30e901f382
Parents: 5ca514a
Author: yishayw <yishayjobs@hotmail.com>
Authored: Tue Sep 6 12:30:17 2016 +0300
Committer: yishayw <yishayjobs@hotmail.com>
Committed: Tue Sep 6 12:30:17 2016 +0300

----------------------------------------------------------------------
 .../projects/Core/src/main/flex/CoreClasses.as  |   1 +
 .../org/apache/flex/core/TransformBeadBase.as   | 100 +++++++++++++++++++
 .../main/flex/org/apache/flex/core/UIBase.as    |  14 ++-
 .../org/apache/flex/svg/GraphicContainer.as     |   7 +-
 .../flex/org/apache/flex/svg/TransformBead.as   |  79 ++-------------
 .../flex/org/apache/flex/html5/TransformBead.as |  44 ++++++++
 .../HTML5/src/main/resources/html5-manifest.xml |  51 ++++------
 7 files changed, 190 insertions(+), 106 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fc27a226/frameworks/projects/Core/src/main/flex/CoreClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/CoreClasses.as b/frameworks/projects/Core/src/main/flex/CoreClasses.as
index 9109f2e..b2e22fc 100644
--- a/frameworks/projects/Core/src/main/flex/CoreClasses.as
+++ b/frameworks/projects/Core/src/main/flex/CoreClasses.as
@@ -159,6 +159,7 @@ internal class CoreClasses
     import org.apache.flex.core.IDataGridPresentationModel; IDataGridPresentationModel;
     import org.apache.flex.core.IDateChooserModel; IDateChooserModel;
 	import org.apache.flex.core.ParentDocumentBead; ParentDocumentBead;
+	import org.apache.flex.core.TransformBeadBase; TransformBeadBase;
 	import org.apache.flex.core.TransformModel; TransformModel;
 	import org.apache.flex.core.TransformCompoundModel; TransformCompoundModel;
 	import org.apache.flex.core.TransformRotateModel; TransformRotateModel;

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fc27a226/frameworks/projects/Core/src/main/flex/org/apache/flex/core/TransformBeadBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/TransformBeadBase.as
b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/TransformBeadBase.as
new file mode 100644
index 0000000..6ee35c9
--- /dev/null
+++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/TransformBeadBase.as
@@ -0,0 +1,100 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.core
+{
+	import org.apache.flex.events.Event;
+	import org.apache.flex.geom.Matrix;
+
+	COMPILE::SWF {
+		import flash.display.Sprite;
+		import flash.geom.Matrix;
+	}
+	
+	public class TransformBeadBase implements IBead
+	{
+		private var _strand:IStrand;
+		
+		public function TransformBeadBase()
+		{
+		}
+		
+		/**
+		 *  @copy org.apache.flex.core.IBead#strand
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */		
+		public function set strand(value:IStrand):void
+		{
+			_strand = value;
+			host.addEventListener(TransformModel.CHANGE, changeHandler);
+			var model:ITransformModel = transformModel;
+			if (model && model.matrix)
+			{
+				transform();
+			}
+		}
+		
+		public function get transformModel():ITransformModel
+		{
+			return host.getBeadByType(ITransformModel) as ITransformModel;
+		}
+				
+		COMPILE::SWF
+		public function transform():void
+		{
+			if (!transformModel || !transformModel.matrix)
+			{
+				return;
+			}
+			var element:Sprite = host.transformElement as Sprite;
+			var fjsm:org.apache.flex.geom.Matrix = transformModel.matrix;
+			var flashMatrix:flash.geom.Matrix = new flash.geom.Matrix(fjsm.a, fjsm.b, fjsm.c, fjsm.d,
fjsm.tx, fjsm.ty);
+			element.transform.matrix = flashMatrix;
+		}
+		/**
+		 * @flexjsignorecoercion HTMLElement
+		 */
+		COMPILE::JS
+		public function transform():void
+		{
+			// implementors should override this
+		}
+		
+		private function changeHandler(e:Event):void
+		{
+			transform();
+		}
+		
+		/**
+		 *  The host component. 
+		 * 
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		public function get host():ITransformHost
+		{
+			return _strand as ITransformHost;
+		}
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fc27a226/frameworks/projects/Core/src/main/flex/org/apache/flex/core/UIBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/UIBase.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/UIBase.as
index 32b2847..ebaa2d9 100644
--- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/UIBase.as
+++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/UIBase.as
@@ -138,7 +138,7 @@ package org.apache.flex.core
      *  @playerversion AIR 2.6
      *  @productversion FlexJS 0.0
      */
-	public class UIBase extends UIHTMLElementWrapper implements IStrandWithModel, IEventDispatcher,
IParentIUIBase, IStyleableObject, ILayoutChild
+	public class UIBase extends UIHTMLElementWrapper implements IStrandWithModel, IEventDispatcher,
IParentIUIBase, IStyleableObject, ILayoutChild, ITransformHost
 	{
         /**
          *  Constructor.
@@ -1374,5 +1374,17 @@ package org.apache.flex.core
             ValuesManager.valuesImpl.applyStyles(this, newStyle);
         };
 
+		COMPILE::SWF
+		public function get transformElement():IFlexJSElement
+		{
+			return element;
+		}
+		
+		COMPILE::JS
+		public function get transformElement():WrappedHTMLElement
+		{
+			return element;
+		}
+		
 	}
 }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fc27a226/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/GraphicContainer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/GraphicContainer.as
b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/GraphicContainer.as
index 8c3637f..3e8e40e 100644
--- a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/GraphicContainer.as
+++ b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/GraphicContainer.as
@@ -34,11 +34,6 @@ package org.apache.flex.svg
             super();
         }
 
-		public function get transformElement():IFlexJSElement
-		{
-			return element;
-		}
-
     }
 	
 	COMPILE::JS
@@ -73,7 +68,7 @@ package org.apache.flex.svg
 		}
 
 		
-		public function get transformElement():org.apache.flex.core.WrappedHTMLElement
+		override public function get transformElement():org.apache.flex.core.WrappedHTMLElement
 		{
 			return graphicGroup.element;
 		}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fc27a226/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/TransformBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/TransformBead.as
b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/TransformBead.as
index 91cf4b6..b042854 100644
--- a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/TransformBead.as
+++ b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/TransformBead.as
@@ -18,91 +18,30 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.flex.svg
 {
-	import org.apache.flex.core.IBeadTransform;
-	import org.apache.flex.core.IStrand;
-	import org.apache.flex.core.ITransformHost;
-	import org.apache.flex.core.ITransformModel;
-	import org.apache.flex.core.TransformModel;
-	import org.apache.flex.events.Event;
+	import org.apache.flex.core.TransformBeadBase;
 	import org.apache.flex.geom.Matrix;
 
-	COMPILE::SWF {
-		import flash.display.Sprite;
-		import flash.geom.Matrix;
-	}
-	
-	public class TransformBead implements IBeadTransform
+	public class TransformBead extends TransformBeadBase
 	{
-		private var _strand:IStrand;
-		
-		public function TransformBead()
-		{
-		}
-		
-		/**
-		 *  @copy org.apache.flex.core.IBead#strand
-		 *  
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion FlexJS 0.0
-		 */		
-		public function set strand(value:IStrand):void
-		{
-			_strand = value;
-			host.addEventListener(TransformModel.CHANGE, changeHandler);
-			var model:ITransformModel = transformModel;
-			if (model && model.matrix)
-			{
-				transform();
-			}
-		}
-		
-		public function get transformModel():ITransformModel
-		{
-			return host.getBeadByType(ITransformModel) as ITransformModel;
-		}
-				
-		COMPILE::SWF
-		public function transform():void
-		{
-			var element:Sprite = host.transformElement as Sprite;
-			var fjsm:org.apache.flex.geom.Matrix = transformModel.matrix;
-			var flashMatrix:flash.geom.Matrix = new flash.geom.Matrix(fjsm.a, fjsm.b, fjsm.c, fjsm.d,
fjsm.tx, fjsm.ty);
-			element.transform.matrix = flashMatrix;
-		}
 		/**
 		 * @flexjsignorecoercion HTMLElement
 		 */
 		COMPILE::JS
-		public function transform():void
+		override public function transform():void
 		{
+			if (!transformModel || !transformModel.matrix)
+			{
+				return;
+			}			
 			var element:org.apache.flex.core.WrappedHTMLElement = host.transformElement;
 			(element.parentNode as HTMLElement).setAttribute("overflow", "visible");
 			(element.parentNode as HTMLElement).setAttribute("pointer-events", "none");
 			element.setAttribute("pointer-events", "visiblePainted");
-			var fjsm:org.apache.flex.geom.Matrix = transformModel.matrix;
+			var fjsm:Matrix = transformModel.matrix;
 			var matrixArray:Array = [fjsm.a , fjsm.b, fjsm.c, fjsm.d, fjsm.tx, fjsm.ty];
 			var transformStr:String = "matrix(" + matrixArray.join(",") + ")";
 			element.setAttribute("transform", transformStr);
 		}
-		
-		private function changeHandler(e:Event):void
-		{
-			transform();
-		}
-		
-		/**
-		 *  The host component. 
-		 * 
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion FlexJS 0.0
-		 */
-		public function get host():ITransformHost
-		{
-			return _strand as ITransformHost;
-		}
+
 	}
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fc27a226/frameworks/projects/HTML5/src/main/flex/org/apache/flex/html5/TransformBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML5/src/main/flex/org/apache/flex/html5/TransformBead.as
b/frameworks/projects/HTML5/src/main/flex/org/apache/flex/html5/TransformBead.as
new file mode 100644
index 0000000..8964fc4
--- /dev/null
+++ b/frameworks/projects/HTML5/src/main/flex/org/apache/flex/html5/TransformBead.as
@@ -0,0 +1,44 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html5
+{
+	import org.apache.flex.core.TransformBeadBase;
+	import org.apache.flex.geom.Matrix;
+	
+	public class TransformBead extends TransformBeadBase
+	{
+		/**
+		 * @flexjsignorecoercion HTMLElement
+		 */
+		COMPILE::JS
+		override public function transform():void
+		{
+			if (!transformModel || !transformModel.matrix)
+			{
+				return;
+			}			
+			var element:org.apache.flex.core.WrappedHTMLElement = host.transformElement;
+			var fjsm:Matrix = transformModel.matrix;
+			var matrixArray:Array = [fjsm.a , fjsm.b, fjsm.c, fjsm.d, fjsm.tx, fjsm.ty];
+			var transformStr:String = "matrix(" + matrixArray.join(",") + ")";
+			element.style.transform = transformStr;
+		}
+		
+	}
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fc27a226/frameworks/projects/HTML5/src/main/resources/html5-manifest.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML5/src/main/resources/html5-manifest.xml b/frameworks/projects/HTML5/src/main/resources/html5-manifest.xml
index 1826767..41a714e 100644
--- a/frameworks/projects/HTML5/src/main/resources/html5-manifest.xml
+++ b/frameworks/projects/HTML5/src/main/resources/html5-manifest.xml
@@ -1,36 +1,29 @@
 <?xml version="1.0"?>
-<!--
-
-  Licensed to the Apache Software Foundation (ASF) under one or more
-  contributor license agreements.  See the NOTICE file distributed with
-  this work for additional information regarding copyright ownership.
-  The ASF licenses this file to You under the Apache License, Version 2.0
-  (the "License"); you may not use this file except in compliance with
-  the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
-
--->
+<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor 
+	license agreements. See the NOTICE file distributed with this work for additional 
+	information regarding copyright ownership. The ASF licenses this file to 
+	You under the Apache License, Version 2.0 (the "License"); you may not use 
+	this file except in compliance with the License. You may obtain a copy of 
+	the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required 
+	by applicable law or agreed to in writing, software distributed under the 
+	License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 
+	OF ANY KIND, either express or implied. See the License for the specific 
+	language governing permissions and limitations under the License. -->
 
 
 <componentPackage>
 
-    
-    <component id="Button" class="org.apache.flex.html5.Button"/>
-    <component id="Label" class="org.apache.flex.html5.Label"/>
-    <component id="TextButton" class="org.apache.flex.html5.TextButton"/>
-    <component id="TextInput" class="org.apache.flex.html5.TextInput"/>
-    <component id="TextArea" class="org.apache.flex.html5.TextArea"/>
-    <component id="CheckBox" class="org.apache.flex.html5.CheckBox"/>
-    <component id="RadioButton" class="org.apache.flex.html5.RadioButton"/>
-    <component id="List" class="org.apache.flex.html5.List"/>
-    <component id="DropDownList" class="org.apache.flex.html5.DropDownList"/>
-    <component id="ComboBox" class="org.apache.flex.html5.ComboBox"/>
+
+	<component id="Button" class="org.apache.flex.html5.Button" />
+	<component id="Label" class="org.apache.flex.html5.Label" />
+	<component id="TextButton" class="org.apache.flex.html5.TextButton" />
+	<component id="TextInput" class="org.apache.flex.html5.TextInput" />
+	<component id="TextArea" class="org.apache.flex.html5.TextArea" />
+	<component id="CheckBox" class="org.apache.flex.html5.CheckBox" />
+	<component id="RadioButton" class="org.apache.flex.html5.RadioButton" />
+	<component id="List" class="org.apache.flex.html5.List" />
+	<component id="DropDownList" class="org.apache.flex.html5.DropDownList" />
+	<component id="ComboBox" class="org.apache.flex.html5.ComboBox" />
+	<component id="TransformBead" class="org.apache.flex.html5.TransformBead" />
 
 </componentPackage>


Mime
View raw message