Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 41CDF200B76 for ; Mon, 25 Jul 2016 12:09:23 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 408C0160A8F; Mon, 25 Jul 2016 10:09:23 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 3DEE7160A9A for ; Mon, 25 Jul 2016 12:09:22 +0200 (CEST) Received: (qmail 99458 invoked by uid 500); 25 Jul 2016 10:09:20 -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 98844 invoked by uid 99); 25 Jul 2016 10:09:19 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 25 Jul 2016 10:09:19 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id B832DE78B1; Mon, 25 Jul 2016 10:09:19 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: harbs@apache.org To: commits@flex.apache.org Date: Mon, 25 Jul 2016 10:09:31 -0000 Message-Id: <4b5abd34a4434e6ebc342e837b69a7cc@git.apache.org> In-Reply-To: <01c31763342b44979d728c17bbddd158@git.apache.org> References: <01c31763342b44979d728c17bbddd158@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [13/21] git commit: [flex-asjs] [refs/heads/develop] - Added GraphicContainer archived-at: Mon, 25 Jul 2016 10:09:23 -0000 Added GraphicContainer Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/58bb1535 Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/58bb1535 Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/58bb1535 Branch: refs/heads/develop Commit: 58bb153540b3ede5aed0586eb97e9521ce5383d7 Parents: 6a28675 Author: Harbs Authored: Sun Jul 24 10:19:13 2016 +0300 Committer: Harbs Committed: Sun Jul 24 10:19:13 2016 +0300 ---------------------------------------------------------------------- .../Graphics/src/main/flex/GraphicsClasses.as | 1 + .../org/apache/flex/svg/GraphicContainer.as | 79 ++++++++++++++++++++ .../flex/org/apache/flex/svg/GraphicShape.as | 29 ++++--- .../flex/org/apache/flex/svg/LinearGradient.as | 8 +- 4 files changed, 102 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/58bb1535/frameworks/projects/Graphics/src/main/flex/GraphicsClasses.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Graphics/src/main/flex/GraphicsClasses.as b/frameworks/projects/Graphics/src/main/flex/GraphicsClasses.as index 1f71851..0cc1db9 100644 --- a/frameworks/projects/Graphics/src/main/flex/GraphicsClasses.as +++ b/frameworks/projects/Graphics/src/main/flex/GraphicsClasses.as @@ -28,6 +28,7 @@ package internal class GraphicsClasses { + import org.apache.flex.svg.GraphicContainer; GraphicContainer; import org.apache.flex.svg.GraphicShape; GraphicShape; import org.apache.flex.svg.Rect; Rect; import org.apache.flex.svg.Ellipse; Ellipse; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/58bb1535/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/GraphicContainer.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/GraphicContainer.as b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/GraphicContainer.as new file mode 100644 index 0000000..d156f2d --- /dev/null +++ b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/GraphicContainer.as @@ -0,0 +1,79 @@ +/** + * 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. + */ +package org.apache.flex.svg +{ + import org.apache.flex.core.ContainerBase; + import org.apache.flex.core.IParent; + import org.apache.flex.events.Event; + + COMPILE::JS + { + import org.apache.flex.core.WrappedHTMLElement; + } + + public class GraphicContainer extends ContainerBase + { + public function GraphicContainer() + { + super(); + } + + /** + * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement + */ + COMPILE::JS + override protected function createElement():WrappedHTMLElement + { + element = document.createElementNS('http://www.w3.org/2000/svg', 'svg') as WrappedHTMLElement; + + positioner = element; + + // absolute positioned children need a non-null + // position value in the parent. It might + // get set to 'absolute' if the container is + // also absolutely positioned + positioner.style.position = 'relative'; + element.flexjs_wrapper = this; + + /*addEventListener('childrenAdded', + runLayoutHandler); + addEventListener('elementRemoved', + runLayoutHandler);*/ + + return element; + } + /** + * @private + */ + override public function addElement(c:Object, dispatchEvent:Boolean = true):void + { + if(c is GraphicShape) + super.addElement(c, dispatchEvent); + else + throw new Error("Only svg elements can be added to svg containers"); + } + + /** + * @private + */ + override public function addElementAt(c:Object, index:int, dispatchEvent:Boolean = true):void + { + if(c is GraphicShape) + super.addElementAt(c, index, dispatchEvent); + else + throw new Error("Only svg elements can be added to svg containers"); + } + + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/58bb1535/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/GraphicShape.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/GraphicShape.as b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/GraphicShape.as index 8d14b67..d0fd171 100644 --- a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/GraphicShape.as +++ b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/GraphicShape.as @@ -76,17 +76,26 @@ package org.apache.flex.svg */ public function GraphicShape() { - COMPILE::JS - { - element = document.createElementNS('http://www.w3.org/2000/svg', 'svg') as WrappedHTMLElement; - element.flexjs_wrapper = this; - element.style.left = 0; - element.style.top = 0; - //element.offsetParent = null; - positioner = element; - positioner.style.position = 'relative'; - } + super(); } + + /** + * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement + */ + COMPILE::JS + override protected function createElement():WrappedHTMLElement + { + element = document.createElementNS('http://www.w3.org/2000/svg', 'svg') as WrappedHTMLElement; + element.flexjs_wrapper = this; + element.style.left = 0; + element.style.top = 0; + //element.offsetParent = null; + positioner = element; + positioner.style.position = 'relative'; + + return element; + } + COMPILE::SWF protected function applyStroke():void http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/58bb1535/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/LinearGradient.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/LinearGradient.as b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/LinearGradient.as index 619ae26..affee7a 100644 --- a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/LinearGradient.as +++ b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/LinearGradient.as @@ -18,6 +18,7 @@ package org.apache.flex.svg import org.apache.flex.graphics.GradientEntry; import org.apache.flex.graphics.IFill; import org.apache.flex.graphics.IGraphicShape; + import org.apache.flex.utils.CSSUtils; COMPILE::SWF { @@ -103,11 +104,8 @@ package org.apache.flex.svg //Set Offset stop.setAttribute('offset', String(gradientEntry.ratio * 100) + '%'); //Set Color - var color:String = Number(gradientEntry.color).toString(16); - if (color.length == 1) color = '00' + color; - if (color.length == 2) color = '00' + color; - if (color.length == 4) color = '00' + color; - stop.setAttribute('stop-color', '#' + String(color)); + CSSUtils.attributeFromColor(gradientEntry.color) + stop.setAttribute('stop-color', CSSUtils.attributeFromColor(gradientEntry.color)); //Set Alpha stop.setAttribute('stop-opacity', String(gradientEntry.alpha));