Repository: flex-asjs Updated Branches: refs/heads/svg-rename 11136dcb4 -> a3b297b51
Added line properties Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/a3b297b5 Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/a3b297b5 Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/a3b297b5 Branch: refs/heads/svg-rename Commit: a3b297b51015a2a71190df33ed618f3df4f8188d Parents: 11136dc Author: Harbs <[email protected]> Authored: Sun Jul 24 20:32:42 2016 +0300 Committer: Harbs <[email protected]> Committed: Sun Jul 24 20:32:42 2016 +0300 ---------------------------------------------------------------------- .../flex/org/apache/flex/graphics/IStroke.as | 2 + .../apache/flex/graphics/SolidColorStroke.as | 76 ++++++++++++++++++-- 2 files changed, 74 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a3b297b5/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/IStroke.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/IStroke.as b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/IStroke.as index a2c647f..c850cac 100644 --- a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/IStroke.as +++ b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/IStroke.as @@ -31,6 +31,8 @@ package org.apache.flex.graphics function set lineJoin(val:String):void; function get miterLimit():Number; function set miterLimit(val:Number):void; + function get lineDash():Array; + function set lineDash(val:Array):void; } } http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a3b297b5/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/SolidColorStroke.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/SolidColorStroke.as b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/SolidColorStroke.as index e301250..d64c35b 100644 --- a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/SolidColorStroke.as +++ b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/graphics/SolidColorStroke.as @@ -19,13 +19,16 @@ package org.apache.flex.graphics COMPILE::SWF { import flash.display.CapsStyle; - import flash.display.JointStyle; + import flash.display.JointStyle; } public class SolidColorStroke implements IStroke { - public function SolidColorStroke() + public function SolidColorStroke(color:uint = 0x000000,weight:Number = 1, alpha:Number = 1.0) { + _color = isNaN(color) ? 0 : color; + _weight = isNaN(weight) ? 1 : weight; + _alpha = isNaN(alpha) ? 1 : alpha; COMPILE::SWF { _lineCap = "none"; @@ -131,11 +134,32 @@ package org.apache.flex.graphics COMPILE::JS public function addStrokeAttrib(value:IGraphicShape):String { - return 'stroke:' + CSSUtils.attributeFromColor(color) + ';stroke-width:' + - String(weight) + ';stroke-opacity:' + String(alpha); + var att:Array = []; + att.push('stroke:' + CSSUtils.attributeFromColor(color)); + att.push('stroke-width:' + String(weight)); + att.push('stroke-opacity:' + String(alpha)); + att.push('stroke-linecap:' + lineCap); + att.push('stroke-linejoin:' + lineJoin); + att.push('stroke-miterlimit:' + String(miterLimit)); + if(lineDash && lineDash.length) + att.push('stroke-dasharray:' + lineDash.join(",")); + return att.join(";"); }; private var _lineCap:String; + /** + * The cap type on line segments. + * Possible values are butt round and square. + * + * @default butt + * + * @see org.apache.flex.graphics.LineStyle + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.3 + */ public function get lineCap():String { return _lineCap; @@ -161,6 +185,20 @@ package org.apache.flex.graphics } private var _lineJoin:String = "miter"; + + /** + * The join type of two segments. + * Possible values are miter round and bevel. + * + * @default miter + * + * @see org.apache.flex.graphics.LineStyle + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.7 + */ public function get lineJoin():String { return _lineJoin; @@ -170,6 +208,16 @@ package org.apache.flex.graphics _lineJoin = val; } private var _miterLimit:Number = 4; + /** + * The miter limit at the join of two segments. + * + * @default 4 + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.7 + */ public function get miterLimit():Number { return _miterLimit; @@ -179,5 +227,25 @@ package org.apache.flex.graphics _miterLimit = val; } + private var _lineDash:Array; + /** + * An array describing the pattern of line dashes. + * + * @default [none] + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.7 + */ + public function get lineDash():Array + { + return _lineDash; + } + public function set lineDash(val:Array):void + { + _lineDash = val; + } + } }
