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:25 UTC

[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

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) + ";");
+};
+