You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by pe...@apache.org on 2014/09/08 21:38:40 UTC
git commit: [flex-asjs] [refs/heads/develop] - Fixed issues uncovered
by gjslint.
Repository: flex-asjs
Updated Branches:
refs/heads/develop 3f556bcda -> 1bfdcb2e6
Fixed issues uncovered by gjslint.
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/1bfdcb2e
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/1bfdcb2e
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/1bfdcb2e
Branch: refs/heads/develop
Commit: 1bfdcb2e6e0ff903d1cc892ef72b38ff979b4693
Parents: 3f556bc
Author: Peter Ent <pe...@apache.org>
Authored: Mon Sep 8 15:38:36 2014 -0400
Committer: Peter Ent <pe...@apache.org>
Committed: Mon Sep 8 15:38:36 2014 -0400
----------------------------------------------------------------------
.../src/org/apache/flex/core/graphics/Circle.js | 24 ++++-----
.../org/apache/flex/core/graphics/Ellipse.js | 18 +++----
.../apache/flex/core/graphics/GraphicShape.js | 53 ++++++++++++--------
.../src/org/apache/flex/core/graphics/Path.js | 18 +++----
.../src/org/apache/flex/core/graphics/Rect.js | 18 +++----
.../org/apache/flex/core/graphics/SolidColor.js | 14 +++---
.../flex/core/graphics/SolidColorStroke.js | 21 ++++----
7 files changed, 91 insertions(+), 75 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1bfdcb2e/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Circle.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Circle.js b/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Circle.js
index a9208d5..ecf9afd 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Circle.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Circle.js
@@ -42,19 +42,19 @@ org.apache.flex.core.graphics.Circle.prototype.FLEXJS_CLASS_INFO =
/**
* @expose
- * @param {number} x The x location of the center of the circle
- * @param {number} y The y location of the center of the circle
+ * @param {number} x The x location of the center of the circle.
+ * @param {number} y The y location of the center of the circle.
* @param {number} radius The radius of the circle.
*/
org.apache.flex.core.graphics.Circle.prototype.drawCircle = function(x, y, radius) {
- var style = this.getStyleStr();
- var circle = document.createElementNS('http://www.w3.org/2000/svg', 'ellipse');
- circle.setAttribute('style', style);
- circle.setAttribute('cx', String(radius + this.get_stroke().get_weight() ));
- circle.setAttribute('cy', String(radius + this.get_stroke().get_weight() ));
- circle.setAttribute('rx', String(radius));
- circle.setAttribute('ry', String(radius));
- this.element.appendChild(circle);
-// this.resize(x-radius,y-radius,radius*2+this.get_stroke().get_weight()*2,radius*2+this.get_stroke().get_weight()*2);
- this.setPosition(x-radius+this.get_stroke().get_weight(),y-radius+this.get_stroke().get_weight());
+ var style = this.getStyleStr();
+ var circle = document.createElementNS('http://www.w3.org/2000/svg', 'ellipse');
+ circle.setAttribute('style', style);
+ circle.setAttribute('cx', String(radius + this.get_stroke().get_weight()));
+ circle.setAttribute('cy', String(radius + this.get_stroke().get_weight()));
+ circle.setAttribute('rx', String(radius));
+ circle.setAttribute('ry', String(radius));
+ this.element.appendChild(circle);
+// this.resize(x-radius,y-radius,radius*2+this.get_stroke().get_weight()*2,radius*2+this.get_stroke().get_weight()*2);
+ this.setPosition(x - radius + this.get_stroke().get_weight(), y - radius + this.get_stroke().get_weight());
};
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1bfdcb2e/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
index cca3c47..4c41191 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Ellipse.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Ellipse.js
@@ -48,13 +48,13 @@ org.apache.flex.core.graphics.Ellipse.prototype.FLEXJS_CLASS_INFO =
* @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.setPosition(x+this.get_stroke().get_weight(),y+this.get_stroke().get_weight());
+ 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.setPosition(x + this.get_stroke().get_weight(), y + this.get_stroke().get_weight());
};
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1bfdcb2e/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 6f5cb13..271c52c 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
@@ -19,6 +19,7 @@ goog.require('org.apache.flex.core.graphics.SolidColor');
goog.require('org.apache.flex.core.graphics.SolidColorStroke');
+
/**
* @constructor
*/
@@ -29,34 +30,35 @@ org.apache.flex.core.graphics.GraphicShape = function() {
* @type {org.apache.flex.core.graphics.SolidColor}
*/
this.fill_ = null;
-
+
/**
* @private
* @type {org.apache.flex.core.graphics.SolidColorStroke}
*/
this.stroke_ = null;
-
+
/**
* @private
* @type {number}
*/
this.x_ = 0;
-
+
/**
* @private
* @type {number}
*/
this.y_ = 0;
-
+
/**
* @expose
* @type {SVGElement}
*/
- this.element = document.createElementNS("http://www.w3.org/2000/svg","svg");
+ this.element = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
+
-
};
+
/**
* Metadata
*
@@ -67,7 +69,6 @@ org.apache.flex.core.graphics.GraphicShape.prototype.FLEXJS_CLASS_INFO =
qName: 'org.apache.flex.core.graphics.GraphicShape' }] };
-
/**
* @expose
* @return {org.apache.flex.core.graphics.SolidColor} The fill object.
@@ -76,6 +77,7 @@ org.apache.flex.core.graphics.GraphicShape.prototype.get_fill = function() {
return this.fill_;
};
+
/**
* @param {org.apache.flex.core.graphics.SolidColor} value The fill object.
*/
@@ -83,6 +85,7 @@ org.apache.flex.core.graphics.GraphicShape.prototype.set_fill = function(value)
this.fill_ = value;
};
+
/**
* @expose
* @return {org.apache.flex.core.graphics.SolidColorStroke} The stroke object.
@@ -91,6 +94,7 @@ 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.
@@ -99,15 +103,19 @@ org.apache.flex.core.graphics.GraphicShape.prototype.set_stroke = function(value
this.stroke_ = value;
};
+
+/**
+ * @override
+ */
org.apache.flex.core.graphics.GraphicShape.prototype.addedToParent = function() {
var bbox = this.element.getBBox();
- this.resize(this.x_,this.y_,bbox.width+this.x_*2,bbox.height+this.y_*2);
+ this.resize(this.x_, this.y_, bbox.width + this.x_ * 2, bbox.height + this.y_ * 2);
};
/**
* @expose
- * return {String} The style attribute
+ * @return {String} The style attribute.
*/
org.apache.flex.core.graphics.GraphicShape.prototype.getStyleStr = function() {
var color = Number(this.get_fill().get_color()).toString(16);
@@ -117,28 +125,31 @@ org.apache.flex.core.graphics.GraphicShape.prototype.getStyleStr = function() {
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()) ;
+ 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
- * @param {number} y Y position
- * @param {number} w Width
- * @param {number} h Height
+ * @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) + "px; top:" + String(y) + "px;");
+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) + 'px; top:' + String(y) + 'px;');
};
+
/**
* @expose
- * @param {number} x X position
- * @param {number} y Y position
+ * @param {number} x X position.
+ * @param {number} y Y position.
*/
-org.apache.flex.core.graphics.GraphicShape.prototype.setPosition = function(x,y) {
+org.apache.flex.core.graphics.GraphicShape.prototype.setPosition = function(x, y) {
this.x_ = x;
this.y_ = y;
};
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1bfdcb2e/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Path.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Path.js b/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Path.js
index f488ec2..9867771 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Path.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Path.js
@@ -42,21 +42,21 @@ org.apache.flex.core.graphics.Path.prototype.FLEXJS_CLASS_INFO =
/**
* @expose
- * @param {number} x The x location of the center of the Path
- * @param {number} y The y location of the center of the Path
+ * @param {number} x The x location of the center of the Path.
+ * @param {number} y The y location of the center of the Path.
* @param {string} data A string containing a compact represention of the path segments.
* The value is a space-delimited string describing each path segment. Each
* segment entry has a single character which denotes the segment type and
* two or more segment parameters.
- *
+ *
* If the segment command is upper-case, the parameters are absolute values.
* If the segment command is lower-case, the parameters are relative values.
*/
org.apache.flex.core.graphics.Path.prototype.drawPath = function(x, y, data) {
- var style = this.getStyleStr();
- var path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
- path.setAttribute('style', style);
- path.setAttribute('d', data);
- this.element.appendChild(path);
- this.setPosition(x+this.get_stroke().get_weight(),y+this.get_stroke().get_weight());
+ var style = this.getStyleStr();
+ var path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
+ path.setAttribute('style', style);
+ path.setAttribute('d', data);
+ this.element.appendChild(path);
+ this.setPosition(x + this.get_stroke().get_weight(), y + this.get_stroke().get_weight());
};
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1bfdcb2e/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 18d6467..be79982 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
@@ -48,13 +48,13 @@ 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 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()/2));
- rect.setAttribute('y', String(this.get_stroke().get_weight()/2));
- rect.setAttribute('width', String(width));
- rect.setAttribute('height', String(height));
- this.element.appendChild(rect);
- this.setPosition(x+this.get_stroke().get_weight(),y+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() / 2));
+ rect.setAttribute('y', String(this.get_stroke().get_weight() / 2));
+ rect.setAttribute('width', String(width));
+ rect.setAttribute('height', String(height));
+ this.element.appendChild(rect);
+ this.setPosition(x + this.get_stroke().get_weight(), y + this.get_stroke().get_weight());
};
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1bfdcb2e/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/SolidColor.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/SolidColor.js b/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/SolidColor.js
index e15a95e..ee8e963 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/SolidColor.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/SolidColor.js
@@ -15,6 +15,7 @@
goog.provide('org.apache.flex.core.graphics.SolidColor');
+
/**
* @constructor
*/
@@ -25,15 +26,16 @@ org.apache.flex.core.graphics.SolidColor = function() {
* @type {number}
*/
this.alpha_ = 1.0;
-
+
/**
* @private
* @type {number}
*/
this.color_ = 1.0;
-
+
};
+
/**
* Metadata
*
@@ -46,7 +48,7 @@ org.apache.flex.core.graphics.SolidColor.prototype.FLEXJS_CLASS_INFO =
/**
* @expose
- * @return {number} color
+ * @return {number} color.
*/
org.apache.flex.core.graphics.SolidColor.prototype.get_color = function() {
return this.color_;
@@ -54,7 +56,7 @@ org.apache.flex.core.graphics.SolidColor.prototype.get_color = function() {
/**
- * @param {number} value color
+ * @param {number} value color.
*/
org.apache.flex.core.graphics.SolidColor.prototype.set_color = function(value) {
this.color_ = value;
@@ -63,7 +65,7 @@ org.apache.flex.core.graphics.SolidColor.prototype.set_color = function(value) {
/**
* @expose
- * @return {number} alpha
+ * @return {number} alpha.
*/
org.apache.flex.core.graphics.SolidColor.prototype.get_alpha = function() {
return this.alpha_;
@@ -71,7 +73,7 @@ org.apache.flex.core.graphics.SolidColor.prototype.get_alpha = function() {
/**
- * @param {number} value alpha
+ * @param {number} value alpha.
*/
org.apache.flex.core.graphics.SolidColor.prototype.set_alpha = function(value) {
this.alpha_ = value;
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1bfdcb2e/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/SolidColorStroke.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/SolidColorStroke.js b/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/SolidColorStroke.js
index 8785016..6e9cc7a 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/SolidColorStroke.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/SolidColorStroke.js
@@ -15,6 +15,7 @@
goog.provide('org.apache.flex.core.graphics.SolidColorStroke');
+
/**
* @constructor
*/
@@ -25,21 +26,22 @@ org.apache.flex.core.graphics.SolidColorStroke = function() {
* @type {number}
*/
this.alpha_ = 1.0;
-
+
/**
* @private
* @type {number}
*/
this.color_ = 1.0;
-
+
/**
* @private
* @type {number}
*/
this.weight_ = 1.0;
-
+
};
+
/**
* Metadata
*
@@ -52,7 +54,7 @@ org.apache.flex.core.graphics.SolidColorStroke.prototype.FLEXJS_CLASS_INFO =
/**
* @expose
- * @return {number} color
+ * @return {number} color.
*/
org.apache.flex.core.graphics.SolidColorStroke.prototype.get_color = function() {
return this.color_;
@@ -60,7 +62,7 @@ org.apache.flex.core.graphics.SolidColorStroke.prototype.get_color = function()
/**
- * @param {number} value color
+ * @param {number} value color.
*/
org.apache.flex.core.graphics.SolidColorStroke.prototype.set_color = function(value) {
this.color_ = value;
@@ -69,7 +71,7 @@ org.apache.flex.core.graphics.SolidColorStroke.prototype.set_color = function(va
/**
* @expose
- * @return {number} alpha
+ * @return {number} alpha.
*/
org.apache.flex.core.graphics.SolidColorStroke.prototype.get_alpha = function() {
return this.alpha_;
@@ -77,15 +79,16 @@ org.apache.flex.core.graphics.SolidColorStroke.prototype.get_alpha = function()
/**
- * @param {number} value alpha
+ * @param {number} value alpha.
*/
org.apache.flex.core.graphics.SolidColorStroke.prototype.set_alpha = function(value) {
this.alpha_ = value;
};
+
/**
* @expose
- * @return {number} weight
+ * @return {number} weight.
*/
org.apache.flex.core.graphics.SolidColorStroke.prototype.get_weight = function() {
return this.weight_;
@@ -93,7 +96,7 @@ org.apache.flex.core.graphics.SolidColorStroke.prototype.get_weight = function()
/**
- * @param {number} value weight
+ * @param {number} value weight.
*/
org.apache.flex.core.graphics.SolidColorStroke.prototype.set_weight = function(value) {
this.weight_ = value;