Return-Path: X-Original-To: apmail-flex-commits-archive@www.apache.org Delivered-To: apmail-flex-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E520811E0E for ; Thu, 11 Sep 2014 16:11:33 +0000 (UTC) Received: (qmail 50974 invoked by uid 500); 11 Sep 2014 16:11:33 -0000 Delivered-To: apmail-flex-commits-archive@flex.apache.org Received: (qmail 50946 invoked by uid 500); 11 Sep 2014 16:11:33 -0000 Mailing-List: contact commits-help@flex.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flex.apache.org Delivered-To: mailing list commits@flex.apache.org Received: (qmail 50938 invoked by uid 99); 11 Sep 2014 16:11:33 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 Sep 2014 16:11:33 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 905E39178DB; Thu, 11 Sep 2014 16:11:33 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: pent@apache.org To: commits@flex.apache.org Message-Id: <54b02b0e34344e42b154aadc08c660ed@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: [flex-asjs] [refs/heads/develop] - Fixed gjslint issues. Date: Thu, 11 Sep 2014 16:11:33 +0000 (UTC) Repository: flex-asjs Updated Branches: refs/heads/develop b08ecd7cf -> 1d58af673 Fixed gjslint issues. Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/1d58af67 Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/1d58af67 Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/1d58af67 Branch: refs/heads/develop Commit: 1d58af673d218c3a66830466a426f9615ce3f99f Parents: b08ecd7 Author: Peter Ent Authored: Thu Sep 11 12:11:28 2014 -0400 Committer: Peter Ent Committed: Thu Sep 11 12:11:28 2014 -0400 ---------------------------------------------------------------------- .../src/org/apache/flex/core/graphics/Circle.js | 21 +++++------ .../org/apache/flex/core/graphics/Ellipse.js | 20 +++++----- .../apache/flex/core/graphics/GraphicShape.js | 39 +++++++++++++------- .../src/org/apache/flex/core/graphics/Path.js | 14 +++---- .../src/org/apache/flex/core/graphics/Rect.js | 22 +++++------ 5 files changed, 64 insertions(+), 52 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1d58af67/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 13fb6f3..71d4716 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 @@ -50,21 +50,20 @@ org.apache.flex.core.graphics.Circle.prototype.drawCircle = function(x, y, radiu var style = this.getStyleStr(); var circle = document.createElementNS('http://www.w3.org/2000/svg', 'ellipse'); circle.setAttribute('style', style); - if(this.get_stroke()) - { - circle.setAttribute('cx', String(radius + this.get_stroke().get_weight())); + if (this.get_stroke()) + { + circle.setAttribute('cx', String(radius + this.get_stroke().get_weight())); circle.setAttribute('cy', String(radius + this.get_stroke().get_weight())); - this.setPosition(x-radius, y-radius, this.get_stroke().get_weight(), this.get_stroke().get_weight()); - } - else - { - circle.setAttribute('cx', String(radius)); + this.setPosition(x - radius, y - radius, this.get_stroke().get_weight(), this.get_stroke().get_weight()); + } + else + { + circle.setAttribute('cx', String(radius)); circle.setAttribute('cy', String(radius)); - this.setPosition(x-radius, y-radius, 0, 0); - } + this.setPosition(x - radius, y - radius, 0, 0); + } circle.setAttribute('rx', String(radius)); circle.setAttribute('ry', String(radius)); this.element.appendChild(circle); - }; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1d58af67/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 12b58ae..00a7400 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 @@ -51,18 +51,18 @@ org.apache.flex.core.graphics.Ellipse.prototype.drawEllipse = function(x, y, wid var style = this.getStyleStr(); var ellipse = document.createElementNS('http://www.w3.org/2000/svg', 'ellipse'); ellipse.setAttribute('style', style); - if(this.get_stroke()) - { - ellipse.setAttribute('cx', String(width / 2 + this.get_stroke().get_weight())); + if (this.get_stroke()) + { + ellipse.setAttribute('cx', String(width / 2 + this.get_stroke().get_weight())); ellipse.setAttribute('cy', String(height / 2 + this.get_stroke().get_weight())); - this.setPosition(x, y, this.get_stroke().get_weight()*2, this.get_stroke().get_weight()*2); - } - else - { - ellipse.setAttribute('cx', String(width / 2)); + this.setPosition(x, y, this.get_stroke().get_weight() * 2, this.get_stroke().get_weight() * 2); + } + else + { + ellipse.setAttribute('cx', String(width / 2)); ellipse.setAttribute('cy', String(height / 2)); - this.setPosition(x, y, 0, 0); - } + this.setPosition(x, y, 0, 0); + } ellipse.setAttribute('rx', String(width / 2)); ellipse.setAttribute('ry', String(height / 2)); this.element.appendChild(ellipse); http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1d58af67/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 61b11a3..465bb87 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 */ @@ -53,22 +54,23 @@ org.apache.flex.core.graphics.GraphicShape = function() { * @type {number} */ this.xOffset_ = 0; - + /** * @private * @type {number} */ this.yOffset_ = 0; - + /** * @expose * @type {Object} */ - this.element = document.createElementNS("http://www.w3.org/2000/svg","svg"); + this.element = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); }; + /** * Metadata * @@ -87,6 +89,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. */ @@ -94,6 +97,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. @@ -102,6 +106,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. @@ -110,6 +115,10 @@ org.apache.flex.core.graphics.GraphicShape.prototype.set_stroke = function(value this.stroke_ = value; }; + +/** + * @expose + */ org.apache.flex.core.graphics.GraphicShape.prototype.addedToParent = function() { var bbox = this.element.getBBox(); this.resize(this.x_, this.y_, bbox); @@ -122,13 +131,13 @@ org.apache.flex.core.graphics.GraphicShape.prototype.addedToParent = function() */ org.apache.flex.core.graphics.GraphicShape.prototype.getStyleStr = function() { var fillStr; - if(this.get_fill()) + if (this.get_fill()) { var color = Number(this.get_fill().get_color()).toString(16); if (color.length == 1) color = '00' + color; - if (color.length == 2) color = '00' + color; + if (color.length == 2) color = '00' + color; if (color.length == 4) color = '00' + color; - fillStr = 'fill:#' + String(color) + ';fill-opacity:' + String(this.get_fill().get_alpha()); + fillStr = 'fill:#' + String(color) + ';fill-opacity:' + String(this.get_fill().get_alpha()); } else { @@ -136,24 +145,25 @@ org.apache.flex.core.graphics.GraphicShape.prototype.getStyleStr = function() { } var strokeStr; - if(this.get_stroke()) + if (this.get_stroke()) { var strokeColor = Number(this.get_stroke().get_color()).toString(16); if (strokeColor.length == 1) strokeColor = '00' + strokeColor; if (strokeColor.length == 2) strokeColor = '00' + strokeColor; if (strokeColor.length == 4) strokeColor = '00' + strokeColor; - strokeStr = 'stroke:#' + String(strokeColor) + ';stroke-width:' + - String(this.get_stroke().get_weight()) + ';stroke-opacity:' + String(this.get_stroke().get_alpha()) + strokeStr = 'stroke:#' + String(strokeColor) + ';stroke-width:' + + String(this.get_stroke().get_weight()) + ';stroke-opacity:' + String(this.get_stroke().get_alpha()); } else { strokeStr = 'stroke:none'; } - - return fillStr + ';' + strokeStr ; + + return fillStr + ';' + strokeStr; }; + /** * @expose * @param {number} x X position. @@ -161,17 +171,20 @@ org.apache.flex.core.graphics.GraphicShape.prototype.getStyleStr = function() { * @param {Object} bbox The bounding box of the svg element. */ org.apache.flex.core.graphics.GraphicShape.prototype.resize = function(x, y, bbox) { - this.element.setAttribute('width', String(bbox.width + bbox.x + this.xOffset_) + 'px'); + this.element.setAttribute('width', String(bbox.width + bbox.x + this.xOffset_) + 'px'); this.element.setAttribute('height', String(bbox.height + bbox.y + this.yOffset_) + 'px'); this.element.setAttribute('style', 'position:absolute; left:' + String(x) + 'px; top:' + String(y) + 'px;'); - //this.element.setAttribute('viewBox', String(bbox.x - this.xOffset_) + ' ' + String(bbox.y - this.yOffset_) + + //this.element.setAttribute('viewBox', String(bbox.x - this.xOffset_) + ' ' + String(bbox.y - this.yOffset_) + // ' ' + String(bbox.x + this.xOffset_) + ' ' + String(bbox.y + this.yOffset_)); }; + /** * @expose * @param {number} x X position. * @param {number} y Y position. + * @param {number} xOffset offset from x position. + * @param {number} yOffset offset from y position. */ org.apache.flex.core.graphics.GraphicShape.prototype.setPosition = function(x, y, xOffset, yOffset) { this.x_ = x; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1d58af67/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 a5c4336..d530ef3 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 @@ -58,12 +58,12 @@ org.apache.flex.core.graphics.Path.prototype.drawPath = function(x, y, data) { path.setAttribute('style', style); path.setAttribute('d', data); this.element.appendChild(path); - if(this.get_stroke()) - { - this.setPosition(x, y, this.get_stroke().get_weight(), this.get_stroke().get_weight()); - } + if (this.get_stroke()) + { + this.setPosition(x, y, this.get_stroke().get_weight(), this.get_stroke().get_weight()); + } else - { - this.setPosition(x, y, 0, 0); - } + { + this.setPosition(x, y, 0, 0); + } }; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1d58af67/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 a3e4c37..bc3364a 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 @@ -51,18 +51,18 @@ org.apache.flex.core.graphics.Rect.prototype.drawRect = function(x, y, width, he var style = this.getStyleStr(); var rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect'); rect.setAttribute('style', style); - if(this.get_stroke()) - { - rect.setAttribute('x', String(this.get_stroke().get_weight() / 2)); - rect.setAttribute('y', String(this.get_stroke().get_weight() / 2)); + if (this.get_stroke()) + { + rect.setAttribute('x', String(this.get_stroke().get_weight() / 2)); + rect.setAttribute('y', String(this.get_stroke().get_weight() / 2)); this.setPosition(x, y, this.get_stroke().get_weight(), this.get_stroke().get_weight()); - } - else - { - rect.setAttribute('x', '0'); - rect.setAttribute('y', '0'); - this.setPosition(x, y, 0, 0); - } + } + else + { + rect.setAttribute('x', '0'); + rect.setAttribute('y', '0'); + this.setPosition(x, y, 0, 0); + } rect.setAttribute('width', String(width)); rect.setAttribute('height', String(height)); this.element.appendChild(rect);