You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by bi...@apache.org on 2014/09/06 00:23:24 UTC

[1/3] git commit: [flex-asjs] [refs/heads/develop] - Add some variety in rect shapes and colors

Repository: flex-asjs
Updated Branches:
  refs/heads/develop 60f17d1bc -> 72c900969


Add some variety in rect shapes and colors


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

Branch: refs/heads/develop
Commit: 25edf1feee9e95d7c0d316e6dbc38a0daaec68f0
Parents: 60f17d1
Author: Om <bi...@gmail.com>
Authored: Fri Sep 5 15:10:56 2014 -0700
Committer: Om <bi...@gmail.com>
Committed: Fri Sep 5 15:19:22 2014 -0700

----------------------------------------------------------------------
 examples/FlexJSTest_SVG/src/GraphicsView.mxml | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/25edf1fe/examples/FlexJSTest_SVG/src/GraphicsView.mxml
----------------------------------------------------------------------
diff --git a/examples/FlexJSTest_SVG/src/GraphicsView.mxml b/examples/FlexJSTest_SVG/src/GraphicsView.mxml
index a4569fc..23f5e68 100644
--- a/examples/FlexJSTest_SVG/src/GraphicsView.mxml
+++ b/examples/FlexJSTest_SVG/src/GraphicsView.mxml
@@ -36,7 +36,7 @@ limitations under the License.
 				fill.alpha = 0.5;
 				
 				var stroke:SolidColorStroke = new SolidColorStroke();
-				stroke.weight = 2;
+				stroke.weight = 10;
 				stroke.color = 0x00FF00;
 				stroke.alpha = 0.9;
 				
@@ -49,29 +49,37 @@ limitations under the License.
 				var rect2:Rect = new Rect();
 				fill.color = 0xCC9900;
 				rect2.fill = fill;
+				stroke.color = 0x333333;
+				stroke.weight = 5;
 				rect2.stroke = stroke;
-				rect2.drawRect(200,200,100,300);
+				rect2.drawRect(100,200,100,300);
 				this.addElement(rect2);
 				
 				var rect3:Rect = new Rect();
-				fill.color = 0x99CC99;
+				fill.color = 0xCCCC11;
 				rect3.fill = fill;
+				stroke.color = 0x0000CC;
+				stroke.weight = 1;
 				rect3.stroke = stroke;
-				rect3.drawRect(200,500,200,200);
+				rect3.drawRect(400,600,200,200);
 				this.addElement(rect3);
 				
 				var rect4:Rect = new Rect();
 				fill.color = 0xAA33EE;
 				rect4.fill = fill;
+				stroke.color = 0x11C309;
+				stroke.weight = 2;
 				rect4.stroke = stroke;
-				rect4.drawRect(200,700,200,100);
+				rect4.drawRect(500,700,200,100);
 				this.addElement(rect4);
 				
 				var rect5:Rect = new Rect();
 				fill.color = 0x11CC44;
 				rect5.fill = fill;
+				stroke.color = 0x830011;
+				stroke.weight = 3;
 				rect5.stroke = stroke;
-				rect5.drawRect(200,750,50,200);
+				rect5.drawRect(0,750,50,200);
 				this.addElement(rect5);
 				
 				


[2/3] git commit: [flex-asjs] [refs/heads/develop] - Don't extend UIBase. Just create an SVG element in the constructor. Add an empty addedToParent method (it would be better to make this implement IUIBase) Add a resize method that would update the svg

Posted by bi...@apache.org.
Don't extend UIBase.  Just create an SVG element in the constructor.
Add an empty addedToParent method (it would be better to make this implement IUIBase)
Add a resize method that would update the svg element to match the drawn shape


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

Branch: refs/heads/develop
Commit: f1ae81b7acdfd916be2ee4225309a5c6c5a1a72f
Parents: 25edf1f
Author: Om <bi...@gmail.com>
Authored: Fri Sep 5 15:16:24 2014 -0700
Committer: Om <bi...@gmail.com>
Committed: Fri Sep 5 15:19:35 2014 -0700

----------------------------------------------------------------------
 .../apache/flex/core/graphics/GraphicShape.js   | 46 +++++++++++---------
 1 file changed, 25 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f1ae81b7/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/GraphicShape.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/GraphicShape.js b/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/GraphicShape.js
index beb0bf5..6f7f0f3 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/GraphicShape.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/GraphicShape.js
@@ -12,20 +12,17 @@
  * limitations under the License.
  */
 
+//TODO Should implment IUIBase
 goog.provide('org.apache.flex.core.graphics.GraphicShape');
 
-goog.require('org.apache.flex.core.UIBase');
 goog.require('org.apache.flex.core.graphics.SolidColor');
 goog.require('org.apache.flex.core.graphics.SolidColorStroke');
 
 
-
 /**
  * @constructor
- * @extends {org.apache.flex.core.UIBase}
  */
 org.apache.flex.core.graphics.GraphicShape = function() {
-  org.apache.flex.core.graphics.GraphicShape.base(this, 'constructor');
 
   /**
    * @private
@@ -39,23 +36,12 @@ org.apache.flex.core.graphics.GraphicShape = function() {
    */
   this.stroke_ = null;
   
-};
-goog.inherits(org.apache.flex.core.graphics.GraphicShape,
-    org.apache.flex.core.UIBase);
-
-/**
- * @override
- */
-org.apache.flex.core.graphics.GraphicShape.prototype.createElement =
-    function() {
-
+    /**
+   * @expose
+   */
   this.element = document.createElementNS("http://www.w3.org/2000/svg","svg");
-  this.element.setAttribute('width',1000);
-  this.element.setAttribute('height',1000);
-
-  this.positioner = this.element;
 
-  return this.element;
+  
 };
 
 /**
@@ -92,10 +78,28 @@ org.apache.flex.core.graphics.GraphicShape.prototype.get_stroke = function() {
   return this.stroke_;
 };
 
-
 /**
+ * @expose
  * @param {org.apache.flex.core.graphics.SolidColorStroke} value The stroke object.
  */
 org.apache.flex.core.graphics.GraphicShape.prototype.set_stroke = function(value) {
   this.stroke_ = value;
-};
\ No newline at end of file
+};
+
+org.apache.flex.core.graphics.GraphicShape.prototype.addedToParent = function() {
+  //Don't do anything
+};
+
+/**
+ * @expose
+ * @param {number} x X position
+ * @param {number} y Y position
+ * @param {number} w Width
+ * @param {number} h Height
+ */
+org.apache.flex.core.graphics.GraphicShape.prototype.resize = function(x,y,w,h) {
+  this.element.setAttribute("width", String(w) + "px");
+  this.element.setAttribute("height", String(h) + "px");
+  this.element.setAttribute("style", "position:absolute; left:" + String(x) + "; top:" + String(y) + ";");
+};
+


[3/3] git commit: [flex-asjs] [refs/heads/develop] - Adjust the x and y of the rect to account for the stroke weight After drawing, call resize on the svg element with the correct dimensions

Posted by bi...@apache.org.
Adjust the x and y of the rect to account for the stroke weight
After drawing, call resize on the svg element with the correct dimensions


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

Branch: refs/heads/develop
Commit: 72c900969d67308dfa846916aa9b605c73f1ed1b
Parents: f1ae81b
Author: Om <bi...@gmail.com>
Authored: Fri Sep 5 15:17:24 2014 -0700
Committer: Om <bi...@gmail.com>
Committed: Fri Sep 5 15:19:36 2014 -0700

----------------------------------------------------------------------
 frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Rect.js | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/72c90096/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Rect.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Rect.js b/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Rect.js
index 570cb16..f06e318 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Rect.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Rect.js
@@ -65,10 +65,11 @@ org.apache.flex.core.graphics.Rect.prototype.drawRect = function(x, y, width, he
 
 	var rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');
 	rect.setAttribute('style', style);
-	rect.setAttribute('x', String(x));
-	rect.setAttribute('y', String(y));
+	rect.setAttribute('x', String(this.get_stroke().get_weight()));
+	rect.setAttribute('y', String(this.get_stroke().get_weight()));
 	rect.setAttribute('width', String(width));
 	rect.setAttribute('height', String(height));
 	rect.setAttribute('fill-opacity', String(this.get_fill().get_alpha()));
 	this.element.appendChild(rect);
+	this.resize(x,y,width+this.get_stroke().get_weight()*2,height+this.get_stroke().get_weight()*2);
 };