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 <[email protected]> Authored: Fri Sep 5 17:20:47 2014 -0700 Committer: Om <[email protected]> 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
