You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ha...@apache.org on 2016/07/25 10:09:36 UTC

[18/21] git commit: [flex-asjs] [refs/heads/develop] - Added DOMWrapper

Added DOMWrapper


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

Branch: refs/heads/develop
Commit: 66b6d423133a044203fbe15e5433bd06b625ca61
Parents: 580eded
Author: Harbs <ha...@in-tools.com>
Authored: Mon Jul 25 12:43:56 2016 +0300
Committer: Harbs <ha...@in-tools.com>
Committed: Mon Jul 25 12:43:56 2016 +0300

----------------------------------------------------------------------
 .../main/flex/org/apache/flex/svg/DOMWrapper.as | 56 ++++++++++++++++++++
 .../org/apache/flex/svg/GraphicContainer.as     |  4 +-
 2 files changed, 58 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/66b6d423/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/DOMWrapper.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/DOMWrapper.as b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/DOMWrapper.as
new file mode 100644
index 0000000..7bb20ff
--- /dev/null
+++ b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/DOMWrapper.as
@@ -0,0 +1,56 @@
+/**
+ * Licensed 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.svg
+{
+  COMPILE::JS
+    {
+        import org.apache.flex.core.WrappedHTMLElement;
+    }
+
+	import org.apache.flex.core.ContainerBase;
+
+	public class DOMWrapper extends ContainerBase
+	{
+
+		/**
+		 * Constructor
+		 *
+		 * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+		 */
+        public function DOMWrapper()
+        {
+			super();
+        }
+		
+		/**
+		 * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+		 */
+		COMPILE::JS
+		override protected function createElement():WrappedHTMLElement
+		{
+			element = document.createElementNS('http://www.w3.org/2000/svg', 'foreignObject') as WrappedHTMLElement;
+			element.flexjs_wrapper = this;
+			element.style.left = 0;
+			element.style.top = 0;
+			//element.offsetParent = null;
+			positioner = element;
+			positioner.style.position = 'relative';
+			
+			return element;
+		}
+
+
+	}
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/66b6d423/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 d156f2d..ed8ae6e 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
@@ -58,7 +58,7 @@ package org.apache.flex.svg
 		 */
 		override public function addElement(c:Object, dispatchEvent:Boolean = true):void
 		{
-			if(c is GraphicShape)
+			if(c is GraphicShape || c is DOMWrapper)
 				super.addElement(c, dispatchEvent);
 			else 
 				throw new Error("Only svg elements can be added to svg containers");
@@ -69,7 +69,7 @@ package org.apache.flex.svg
 		 */
 		override public function addElementAt(c:Object, index:int, dispatchEvent:Boolean = true):void
 		{
-			if(c is GraphicShape)
+			if(c is GraphicShape || c is DOMWrapper)
 				super.addElementAt(c, index, dispatchEvent);
 			else 
 				throw new Error("Only svg elements can be added to svg containers");