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

git commit: [flex-asjs] [refs/heads/refactor-sprite] - Image working on SVG too.

Repository: flex-asjs
Updated Branches:
  refs/heads/refactor-sprite f469e1896 -> e45f83648


Image working on SVG too.


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

Branch: refs/heads/refactor-sprite
Commit: e45f83648d173b218cc3ee774f51df4b1e2840c3
Parents: f469e18
Author: yishayw <yi...@hotmail.com>
Authored: Mon Oct 10 12:19:31 2016 +0300
Committer: yishayw <yi...@hotmail.com>
Committed: Mon Oct 10 12:19:31 2016 +0300

----------------------------------------------------------------------
 .../main/flex/org/apache/flex/core/IBinaryImage.as   |  3 ---
 .../src/main/flex/org/apache/flex/core/IImage.as     |  3 +++
 .../src/main/flex/org/apache/flex/core/ImageBase.as  |  8 +++++++-
 .../main/flex/org/apache/flex/core/ImageViewBase.as  |  4 ++--
 .../src/main/flex/org/apache/flex/svg/BinaryImage.as |  6 ------
 .../src/main/flex/org/apache/flex/svg/Image.as       |  6 ++++++
 .../main/flex/org/apache/flex/html/BinaryImage.as    |  6 ------
 .../HTML/src/main/flex/org/apache/flex/html/Image.as |  5 +++++
 .../org/apache/flex/html/beads/BinaryImageLoader.as  | 15 +++++++++++++--
 9 files changed, 36 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e45f8364/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IBinaryImage.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IBinaryImage.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IBinaryImage.as
index 45640be..8ae9393 100644
--- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IBinaryImage.as
+++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IBinaryImage.as
@@ -43,8 +43,5 @@ package org.apache.flex.core
         function get binary():BinaryData;
         function set binary(value:BinaryData):void;
 		
-		COMPILE::JS
-		function applyBinaryDataAsString(binaryDataAsString:String):void;
-		
 	}
 }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e45f8364/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IImage.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IImage.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IImage.as
index 9f93239..69eee85 100644
--- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IImage.as
+++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IImage.as
@@ -43,5 +43,8 @@ package org.apache.flex.core
         function set url(value:String):void;
 		COMPILE::JS
 		function get imageElement():Element;
+		COMPILE::JS
+		function applyImageData(binaryDataAsString:String):void;
+
 	}
 }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e45f8364/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ImageBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ImageBase.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ImageBase.as
index 674c23d..71454a7 100644
--- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ImageBase.as
+++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ImageBase.as
@@ -73,6 +73,12 @@ package org.apache.flex.core
 			return null;
 			// override this
 		}
-
+		
+		COMPILE::JS
+		public function applyImageData(binaryDataAsString:String):void
+		{
+			// override this
+		}
+		
 	}
 }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e45f8364/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ImageViewBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ImageViewBase.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ImageViewBase.as
index 2bf4570..264fb07 100644
--- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ImageViewBase.as
+++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ImageViewBase.as
@@ -100,7 +100,7 @@ package org.apache.flex.core
 		
 		/**
 		 * @private
-         * @flexjsignorecoercion HTMLImageELement
+         * @flexjsignorecoercion org.apache.flex.core.IImage
 		 */
 		protected function handleUrlChange(event:Event):void
 		{
@@ -115,7 +115,7 @@ package org.apache.flex.core
             {
 				if (_model.url) {
                     setupLoader();
-	                (host.element as HTMLImageElement).src = _model.url;
+	                (host as IImage).applyImageData(_model.url);
 				}
             }
 		}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e45f8364/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/BinaryImage.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/BinaryImage.as b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/BinaryImage.as
index 6413c7c..c03793c 100644
--- a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/BinaryImage.as
+++ b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/BinaryImage.as
@@ -83,11 +83,5 @@ package org.apache.flex.svg
 			(model as IBinaryImageModel).binary = value;
 		}
         
-		COMPILE::JS
-		public function applyBinaryDataAsString(binaryDataAsString:String):void
-		{
-			(_image as SVGImageElement).setAttributeNS('http://www.w3.org/1999/xlink','href', binaryDataAsString);
-		}
-
 	}
 }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e45f8364/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/Image.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/Image.as b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/Image.as
index e84fd94..0524e41 100644
--- a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/Image.as
+++ b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/Image.as
@@ -76,5 +76,11 @@ package org.apache.flex.svg
 			return _image;
 		}
 
+		COMPILE::JS
+		override public function applyImageData(binaryDataAsString:String):void
+		{
+			(_image as SVGImageElement).setAttributeNS('http://www.w3.org/1999/xlink','href', binaryDataAsString);
+		}
+
     }
 }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e45f8364/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/BinaryImage.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/BinaryImage.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/BinaryImage.as
index 899ac3f..1ae61bf 100644
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/BinaryImage.as
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/BinaryImage.as
@@ -84,11 +84,5 @@ package org.apache.flex.html
 			(model as IBinaryImageModel).binary = value;
 		}
         
-		COMPILE::JS
-		public function applyBinaryDataAsString(binaryDataAsString:String):void
-		{
-			(element as HTMLImageElement).src = binaryDataAsString;
-		}
-
 	}
 }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e45f8364/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/Image.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/Image.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/Image.as
index 0b83b62..7ddca27 100644
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/Image.as
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/Image.as
@@ -63,6 +63,11 @@ package org.apache.flex.html
 			return element;
 		}
 
+		COMPILE::JS
+		override public function applyImageData(binaryDataAsString:String):void
+		{
+			(element as HTMLImageElement).src = binaryDataAsString;
+		}
 
 	}
 }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e45f8364/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/BinaryImageLoader.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/BinaryImageLoader.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/BinaryImageLoader.as
index a4adf24..0e429d3 100644
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/BinaryImageLoader.as
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/BinaryImageLoader.as
@@ -18,10 +18,13 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.flex.html.beads
 {
+	import org.apache.flex.core.CallLaterBead;
+	import org.apache.flex.core.IBeadModel;
 	import org.apache.flex.core.IBinaryImageLoader;
 	import org.apache.flex.core.IBinaryImageModel;
 	import org.apache.flex.core.IImageView;
 	import org.apache.flex.core.IStrand;
+	import org.apache.flex.core.ValuesManager;
 	import org.apache.flex.events.Event;
 
     COMPILE::JS
@@ -59,7 +62,15 @@ package org.apache.flex.html.beads
 		
 		private function get model():IBinaryImageModel
 		{
-			return _strand.getBeadByType(IBinaryImageModel) as IBinaryImageModel;
+			var result:IBinaryImageModel = _strand.getBeadByType(IBinaryImageModel) as IBinaryImageModel;
+			if (!result && _strand)
+			{
+				var c:Class = ValuesManager.valuesImpl.getValue(_strand, "iBeadModel") as Class;
+				var model:IBinaryImageModel = new c as IBinaryImageModel;
+				_strand.addBead(model);
+				result = model;
+			}
+			return result;
 		}
 		
 		/**
@@ -102,7 +113,7 @@ package org.apache.flex.html.beads
 // I don't think we need to specify the type.
 //                    var blob = new Blob([response], {type: "image/png"});
                     _objectURL = URLUtils.createObjectURL(blob);
-                    (_strand as IBinaryImage).applyBinaryDataAsString(_objectURL);
+                    (_strand as IBinaryImage).applyImageData(_objectURL);
                 }
             }
         }