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 02:22:34 UTC
[1/6] git commit: [flex-asjs] [refs/heads/develop] - Firefox and IE11
needs a unit ('px') when specifying position values
Repository: flex-asjs
Updated Branches:
refs/heads/develop 72c900969 -> 715a5ac76
Firefox and IE11 needs a unit ('px') when specifying position values
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/1a16bd3c
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/1a16bd3c
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/1a16bd3c
Branch: refs/heads/develop
Commit: 1a16bd3c8a3acb92aa8976a0103c0f8a81bb6919
Parents: 72c9009
Author: Om <bi...@gmail.com>
Authored: Fri Sep 5 15:48:10 2014 -0700
Committer: Om <bi...@gmail.com>
Committed: Fri Sep 5 15:48:10 2014 -0700
----------------------------------------------------------------------
.../js/FlexJS/src/org/apache/flex/core/graphics/GraphicShape.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1a16bd3c/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 6f7f0f3..e0c4eac 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
@@ -100,6 +100,6 @@ org.apache.flex.core.graphics.GraphicShape.prototype.addedToParent = function()
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) + ";");
+ this.element.setAttribute("style", "position:absolute; left:" + String(x) + "px; top:" + String(y) + "px;");
};
[2/6] git commit: [flex-asjs] [refs/heads/develop] - Add Ellipse
Posted by bi...@apache.org.
Add Ellipse
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/e213ce76
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/e213ce76
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/e213ce76
Branch: refs/heads/develop
Commit: e213ce76e479db0428ea950ca7c7f670d4eb64a1
Parents: 1a16bd3
Author: Om <bi...@gmail.com>
Authored: Fri Sep 5 17:19:00 2014 -0700
Committer: Om <bi...@gmail.com>
Committed: Fri Sep 5 17:19:00 2014 -0700
----------------------------------------------------------------------
.../org/apache/flex/core/graphics/Ellipse.as | 40 +++++++++++++
.../org/apache/flex/core/graphics/Ellipse.js | 60 ++++++++++++++++++++
2 files changed, 100 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e213ce76/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/Ellipse.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/Ellipse.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/Ellipse.as
new file mode 100644
index 0000000..b851ac3
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/Ellipse.as
@@ -0,0 +1,40 @@
+package org.apache.flex.core.graphics
+{
+
+ public class Ellipse extends GraphicShape
+ {
+
+ private var _x:Number;
+ private var _y:Number;
+ private var _width:Number;
+ private var _height:Number;
+
+ /**
+ * Draw the ellipse.
+ * @param x The x position of the top-left corner of the bounding box of the ellipse.
+ * @param y The y position of the top-left corner of the bounding box of the ellipse.
+ * @param width The width of the ellipse.
+ * @param height The height of the ellipse.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function drawEllipse(x:Number, y:Number, width:Number, height:Number):void
+ {
+ graphics.clear();
+ if(stroke)
+ {
+ graphics.lineStyle(stroke.weight,stroke.color,stroke.alpha);
+ }
+ if(fill)
+ {
+ graphics.beginFill(fill.color,fill.alpha);
+ }
+ graphics.drawEllipse(x,y,width,height);
+ graphics.endFill();
+ }
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e213ce76/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Ellipse.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Ellipse.js b/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Ellipse.js
new file mode 100644
index 0000000..a2033df
--- /dev/null
+++ b/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Ellipse.js
@@ -0,0 +1,60 @@
+/**
+ * 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.
+ */
+
+goog.provide('org.apache.flex.core.graphics.Ellipse');
+
+goog.require('org.apache.flex.core.graphics.GraphicShape');
+
+
+
+/**
+ * @constructor
+ * @extends {org.apache.flex.core.graphics.GraphicShape}
+ */
+org.apache.flex.core.graphics.Ellipse = function() {
+ org.apache.flex.core.graphics.Ellipse.base(this, 'constructor');
+
+};
+goog.inherits(org.apache.flex.core.graphics.Ellipse,
+ org.apache.flex.core.graphics.GraphicShape);
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+org.apache.flex.core.graphics.Ellipse.prototype.FLEXJS_CLASS_INFO =
+ { names: [{ name: 'Ellipse',
+ qName: 'org.apache.flex.core.graphics.Ellipse' }] };
+
+
+/**
+ * @expose
+ * @param {number} x The x position of the top-left corner of the bounding box of the ellipse.
+ * @param {number} y The y position of the top-left corner of the bounding box of the ellipse.
+ * @param {number} width The width of the ellipse.
+ * @param {number} height The height of the ellipse.
+ */
+org.apache.flex.core.graphics.Ellipse.prototype.drawEllipse = function(x, y, width, height) {
+ var style = this.getStyleStr();
+ var ellipse = document.createElementNS('http://www.w3.org/2000/svg', 'ellipse');
+ ellipse.setAttribute('style', style);
+ ellipse.setAttribute('cx', String(width/2 + this.get_stroke().get_weight() ));
+ ellipse.setAttribute('cy', String(height/2 + this.get_stroke().get_weight() ));
+ ellipse.setAttribute('rx', String(width/2));
+ ellipse.setAttribute('ry', String(height/2));
+ this.element.appendChild(ellipse);
+ this.resize(x,y,width+this.get_stroke().get_weight()*2,height+this.get_stroke().get_weight()*2);
+};
[6/6] git commit: [flex-asjs] [refs/heads/develop] - Add a new method
getStyleStr
Posted by bi...@apache.org.
Add a new method getStyleStr
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/715a5ac7
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/715a5ac7
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/715a5ac7
Branch: refs/heads/develop
Commit: 715a5ac765c18a08fcb39dae30c9a1b15f1e6e38
Parents: 8404ff2
Author: Om <bi...@gmail.com>
Authored: Fri Sep 5 17:20:47 2014 -0700
Committer: Om <bi...@gmail.com>
Committed: Fri Sep 5 17:20:47 2014 -0700
----------------------------------------------------------------------
.../org/apache/flex/core/graphics/GraphicShape.js | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/715a5ac7/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 e0c4eac..e796691 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
@@ -90,6 +90,22 @@ org.apache.flex.core.graphics.GraphicShape.prototype.addedToParent = function()
//Don't do anything
};
+
+/**
+ * @expose
+ * return {String} The style attribute
+ */
+org.apache.flex.core.graphics.GraphicShape.prototype.getStyleStr = function() {
+ var color = Number(this.get_fill().get_color()).toString(16);
+ if (color.length == 2) color = '00' + color;
+ if (color.length == 4) color = '00' + color;
+ var strokeColor = Number(this.get_stroke().get_color()).toString(16);
+ if (strokeColor.length == 2) strokeColor = '00' + strokeColor;
+ if (strokeColor.length == 4) strokeColor = '00' + strokeColor;
+
+ return 'fill:#' + String(color) + ';stroke:#'+ String(strokeColor) + ';stroke-width:' + String(this.get_stroke().get_weight()) + ';fill-opacity:' + String(this.get_fill().get_alpha()) ;
+};
+
/**
* @expose
* @param {number} x X position
[3/6] git commit: [flex-asjs] [refs/heads/develop] - Draw a few
ellipses
Posted by bi...@apache.org.
Draw a few ellipses
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/255f822d
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/255f822d
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/255f822d
Branch: refs/heads/develop
Commit: 255f822dbce723a93c224c3e3fa38e842c971800
Parents: e213ce7
Author: Om <bi...@gmail.com>
Authored: Fri Sep 5 17:19:21 2014 -0700
Committer: Om <bi...@gmail.com>
Committed: Fri Sep 5 17:19:21 2014 -0700
----------------------------------------------------------------------
examples/FlexJSTest_SVG/src/GraphicsView.mxml | 26 ++++++++++++++++++++++
1 file changed, 26 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/255f822d/examples/FlexJSTest_SVG/src/GraphicsView.mxml
----------------------------------------------------------------------
diff --git a/examples/FlexJSTest_SVG/src/GraphicsView.mxml b/examples/FlexJSTest_SVG/src/GraphicsView.mxml
index 23f5e68..7a68173 100644
--- a/examples/FlexJSTest_SVG/src/GraphicsView.mxml
+++ b/examples/FlexJSTest_SVG/src/GraphicsView.mxml
@@ -24,6 +24,7 @@ limitations under the License.
>
<fx:Script>
<![CDATA[
+ import org.apache.flex.core.graphics.Ellipse;
import org.apache.flex.core.graphics.Rect;
import org.apache.flex.core.graphics.SolidColor;
import org.apache.flex.core.graphics.SolidColorStroke;
@@ -82,7 +83,32 @@ limitations under the License.
rect5.drawRect(0,750,50,200);
this.addElement(rect5);
+ var ellipse1:Ellipse = new Ellipse();
+ fill.color = 0x290149;
+ ellipse1.fill = fill;
+ stroke.color = 0x830011;
+ stroke.weight = 3;
+ ellipse1.stroke = stroke;
+ ellipse1.drawEllipse(300,300,50,200);
+ this.addElement(ellipse1);
+ var ellipse2:Ellipse = new Ellipse();
+ fill.color = 0x2222CC;
+ ellipse2.fill = fill;
+ stroke.color = 0xabcdef;
+ stroke.weight = 5;
+ ellipse2.stroke = stroke;
+ ellipse2.drawEllipse(100,100,500,200);
+ this.addElement(ellipse2);
+
+ var ellipse3:Ellipse = new Ellipse();
+ fill.color = 0xfedcba;
+ ellipse3.fill = fill;
+ stroke.color = 0x123456;
+ stroke.weight = 2;
+ ellipse3.stroke = stroke;
+ ellipse3.drawEllipse(250,150,300,250);
+ this.addElement(ellipse3);
}
]]>
[4/6] git commit: [flex-asjs] [refs/heads/develop] - Include Ellipse
in FlexJSUIClasses.as
Posted by bi...@apache.org.
Include Ellipse in FlexJSUIClasses.as
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/c32de247
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/c32de247
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/c32de247
Branch: refs/heads/develop
Commit: c32de2476fa33d6e59a98d9b770c0f08cf941f13
Parents: 255f822
Author: Om <bi...@gmail.com>
Authored: Fri Sep 5 17:20:01 2014 -0700
Committer: Om <bi...@gmail.com>
Committed: Fri Sep 5 17:20:01 2014 -0700
----------------------------------------------------------------------
frameworks/as/projects/FlexJSUI/src/FlexJSUIClasses.as | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c32de247/frameworks/as/projects/FlexJSUI/src/FlexJSUIClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/FlexJSUIClasses.as b/frameworks/as/projects/FlexJSUI/src/FlexJSUIClasses.as
index efab103..2df8fce 100644
--- a/frameworks/as/projects/FlexJSUI/src/FlexJSUIClasses.as
+++ b/frameworks/as/projects/FlexJSUI/src/FlexJSUIClasses.as
@@ -121,6 +121,7 @@ internal class FlexJSUIClasses
import org.apache.flex.core.SimpleStatesImpl; SimpleStatesImpl;
import org.apache.flex.core.graphics.GraphicShape; GraphicShape;
import org.apache.flex.core.graphics.Rect; Rect;
+ import org.apache.flex.core.graphics.Ellipse; Ellipse;
import org.apache.flex.core.graphics.SolidColor; SolidColor;
import org.apache.flex.core.graphics.SolidColorStroke; SolidColorStroke;
[5/6] git commit: [flex-asjs] [refs/heads/develop] - Clean up Rect
Posted by bi...@apache.org.
Clean up Rect
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/8404ff21
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/8404ff21
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/8404ff21
Branch: refs/heads/develop
Commit: 8404ff2180f9066052a642c09411c0c4b4c8425b
Parents: c32de24
Author: Om <bi...@gmail.com>
Authored: Fri Sep 5 17:20:22 2014 -0700
Committer: Om <bi...@gmail.com>
Committed: Fri Sep 5 17:20:22 2014 -0700
----------------------------------------------------------------------
.../src/org/apache/flex/core/graphics/Rect.as | 5 -----
.../src/org/apache/flex/core/graphics/Rect.js | 16 +---------------
2 files changed, 1 insertion(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/8404ff21/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/Rect.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/Rect.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/Rect.as
index a580e0f..5618870 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/Rect.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/Rect.as
@@ -9,11 +9,6 @@ package org.apache.flex.core.graphics
private var _width:Number;
private var _height:Number;
- public function Rect()
- {
- super();
- }
-
/**
* Draw the rectangle.
* @param x The x position of the top-left corner of the rectangle.
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/8404ff21/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 f06e318..e1cf279 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
@@ -25,11 +25,6 @@ goog.require('org.apache.flex.core.graphics.GraphicShape');
org.apache.flex.core.graphics.Rect = function() {
org.apache.flex.core.graphics.Rect.base(this, 'constructor');
- /**
- * @private
- * @type {number}
- */
- this.fillColor_ = 0;
};
goog.inherits(org.apache.flex.core.graphics.Rect,
org.apache.flex.core.graphics.GraphicShape);
@@ -53,16 +48,7 @@ org.apache.flex.core.graphics.Rect.prototype.FLEXJS_CLASS_INFO =
* @param {number} height The height of the rectangle.
*/
org.apache.flex.core.graphics.Rect.prototype.drawRect = function(x, y, width, height) {
- var color = Number(this.get_fill().get_color()).toString(16);
- if (color.length == 2) color = '00' + color;
- if (color.length == 4) color = '00' + color;
-
- var strokeColor = Number(this.get_stroke().get_color()).toString(16);
- if (strokeColor.length == 2) strokeColor = '00' + strokeColor;
- if (strokeColor.length == 4) strokeColor = '00' + strokeColor;
-
- var style = 'fill:#' + String(color) + ';stroke:#'+ String(strokeColor) + ';stroke-width:' + String(this.get_stroke().get_weight());
-
+ var style = this.getStyleStr();
var rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');
rect.setAttribute('style', style);
rect.setAttribute('x', String(this.get_stroke().get_weight()));