You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2016/11/02 15:14:43 UTC
[38/43] git commit: [flex-asjs] [refs/heads/refactor-sprite] - move a
few more Graphics classes to HTML
move a few more Graphics classes to HTML
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/e020ba83
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/e020ba83
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/e020ba83
Branch: refs/heads/refactor-sprite
Commit: e020ba837067597d9ff97f828214c359455af13b
Parents: c60efc6
Author: Alex Harui <ah...@apache.org>
Authored: Mon Oct 31 09:23:03 2016 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Nov 1 08:02:15 2016 -0700
----------------------------------------------------------------------
.../flex/org/apache/flex/svg/BinaryImage.as | 87 ------------
.../src/main/flex/org/apache/flex/svg/Image.as | 133 -------------------
.../flex/org/apache/flex/svg/beads/ImageView.as | 87 ------------
.../flex/org/apache/flex/svg/BinaryImage.as | 87 ++++++++++++
.../src/main/flex/org/apache/flex/svg/Image.as | 133 +++++++++++++++++++
.../flex/org/apache/flex/svg/beads/ImageView.as | 87 ++++++++++++
6 files changed, 307 insertions(+), 307 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e020ba83/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/BinaryImage.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/BinaryImage.as b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/BinaryImage.as
deleted file mode 100644
index c03793c..0000000
--- a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/BinaryImage.as
+++ /dev/null
@@ -1,87 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You 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.IBinaryImage;
- import org.apache.flex.core.IBinaryImageModel;
- import org.apache.flex.core.ValuesManager;
- import org.apache.flex.core.IBinaryImageLoader;
- import org.apache.flex.utils.BinaryData;
-
- /**
- * The Image class is a component that displays a bitmap. The Image uses
- * the following beads:
- *
- * org.apache.flex.core.IBeadModel: the data model for the Image, including the url/binary property.
- * org.apache.flex.core.IBeadView: constructs the visual elements of the component.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class BinaryImage extends Image implements IBinaryImage
- {
- /**
- * constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function BinaryImage()
- {
- super();
- }
-
- override public function addedToParent():void
- {
- var c:Class = ValuesManager.valuesImpl.getValue(this, "iBinaryImageLoader") as Class;
- if (c)
- {
- if (c)
- {
- var loader:IBinaryImageLoader = (new c()) as IBinaryImageLoader;
- addBead(loader);
- }
- }
- super.addedToParent();
- }
-
- /**
- * The binary bitmap data.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- * @flexjsignorecoercion org.apache.flex.core.IImageModel
- */
- public function get binary():BinaryData
- {
- return (model as IBinaryImageModel).binary;
- }
- public function set binary(value:BinaryData):void
- {
- (model as IBinaryImageModel).binary = value;
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e020ba83/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/Image.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/Image.as b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/Image.as
deleted file mode 100644
index cd0729f..0000000
--- a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/Image.as
+++ /dev/null
@@ -1,133 +0,0 @@
-/**
- * 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.ImageBase;
-
- COMPILE::JS
- {
- import org.apache.flex.core.WrappedHTMLElement;
- }
- public class Image extends ImageBase
- {
- /**
- * constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.7
- */
- public function Image()
- {
- 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.setAttribute('x', 0);
- element.setAttribute('y', 0);
- //element.offsetParent = null;
- positioner = element;
- positioner.style.position = 'relative';
- addImageElement();
- return element;
- }
-
- COMPILE::JS
- protected var _image:WrappedHTMLElement;
-
- /**
- * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
- */
- COMPILE::JS
- protected function addImageElement():void
- {
- if (_image == null) {
- _image = document.createElementNS('http://www.w3.org/2000/svg', 'image') as WrappedHTMLElement;
- _image.setAttribute("width", "100%");
- _image.setAttribute("height", "100%");
- _image.flexjs_wrapper = this;
- element.appendChild(_image);
- }
- }
-
- COMPILE::JS
- override public function get imageElement():Element
- {
- return _image;
- }
-
- COMPILE::JS
- override public function get transformElement():WrappedHTMLElement
- {
- return _image;
- }
-
- COMPILE::JS
- override public function applyImageData(binaryDataAsString:String):void
- {
- (_image as SVGImageElement).setAttributeNS('http://www.w3.org/1999/xlink','href', binaryDataAsString);
- }
- COMPILE::JS
- override public function setWidth(value:Number, noEvent:Boolean=false):void
- {
- super.setWidth(value, noEvent);
- positioner.setAttribute("width", value);
- }
-
- COMPILE::JS
- override public function setHeight(value:Number, noEvent:Boolean=false):void
- {
- super.setHeight(value, noEvent);
- positioner.setAttribute("height", value);
- }
-
- COMPILE::JS
- override public function setX(value:Number):void
- {
- super.setX(value);
- positioner.setAttribute("x", value);
-
- }
- COMPILE::JS
- override public function setY(value:Number):void
- {
- super.setY(value);
- positioner.setAttribute("y", value);
-
- }
-
- COMPILE::JS
- override public function set x(value:Number):void
- {
- super.x = value;
- positioner.setAttribute("x", value);
- }
-
- COMPILE::JS
- override public function set y(value:Number):void
- {
- super.y = value;
- positioner.setAttribute("y", value);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e020ba83/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/beads/ImageView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/beads/ImageView.as b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/beads/ImageView.as
deleted file mode 100644
index 8cbd789..0000000
--- a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/beads/ImageView.as
+++ /dev/null
@@ -1,87 +0,0 @@
-
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You 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.beads
-{
- import org.apache.flex.core.ImageViewBase;
- COMPILE::JS
- {
- import org.apache.flex.core.UIBase;
- import org.apache.flex.core.ValuesManager;
- }
-
- /**
- * The ImageView class creates the visual elements of the org.apache.flex.svg.Image component.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class ImageView extends ImageViewBase
- {
- /**
- * constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function ImageView()
- {
- }
-
- COMPILE::JS
- override protected function sizeChangedHandler(event:Object):void
- {
- super.sizeChangedHandler(event);
- var host:UIBase = _strand as UIBase;
-
- var left:* = ValuesManager.valuesImpl.getValue(host, "left");
- var right:* = ValuesManager.valuesImpl.getValue(host, "right");
- var l:Number = isNaN(left) ? NaN : left;
- var r:Number = isNaN(right) ? NaN : right;
-
- var top:* = ValuesManager.valuesImpl.getValue(host, "top");
- var bottom:* = ValuesManager.valuesImpl.getValue(host, "bottom");
- var t:Number = isNaN(top) ? NaN : top;
- var b:Number = isNaN(bottom) ? NaN : bottom;
-
- var p:Object = host.positioner;
-
- if (!isNaN(l) &&
- !isNaN(r)) {
- // if just using size constraints and image will not shrink or grow
- var computedWidth:Number = (host.positioner.offsetParent as HTMLElement).offsetWidth -
- l - r;
- p.setAttribute("width", computedWidth);
-
- }
- if (!isNaN(t) &&
- !isNaN(b)) {
- // if just using size constraints and image will not shrink or grow
- var computedHeight:Number = (host.positioner.offsetParent as HTMLElement).offsetHeight -
- t - b;
- p.setAttribute("height", computedHeight);
- }
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e020ba83/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/BinaryImage.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/BinaryImage.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/BinaryImage.as
new file mode 100644
index 0000000..c03793c
--- /dev/null
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/BinaryImage.as
@@ -0,0 +1,87 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You 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.IBinaryImage;
+ import org.apache.flex.core.IBinaryImageModel;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.core.IBinaryImageLoader;
+ import org.apache.flex.utils.BinaryData;
+
+ /**
+ * The Image class is a component that displays a bitmap. The Image uses
+ * the following beads:
+ *
+ * org.apache.flex.core.IBeadModel: the data model for the Image, including the url/binary property.
+ * org.apache.flex.core.IBeadView: constructs the visual elements of the component.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class BinaryImage extends Image implements IBinaryImage
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function BinaryImage()
+ {
+ super();
+ }
+
+ override public function addedToParent():void
+ {
+ var c:Class = ValuesManager.valuesImpl.getValue(this, "iBinaryImageLoader") as Class;
+ if (c)
+ {
+ if (c)
+ {
+ var loader:IBinaryImageLoader = (new c()) as IBinaryImageLoader;
+ addBead(loader);
+ }
+ }
+ super.addedToParent();
+ }
+
+ /**
+ * The binary bitmap data.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ * @flexjsignorecoercion org.apache.flex.core.IImageModel
+ */
+ public function get binary():BinaryData
+ {
+ return (model as IBinaryImageModel).binary;
+ }
+ public function set binary(value:BinaryData):void
+ {
+ (model as IBinaryImageModel).binary = value;
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e020ba83/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/Image.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/Image.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/Image.as
new file mode 100644
index 0000000..cd0729f
--- /dev/null
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/Image.as
@@ -0,0 +1,133 @@
+/**
+ * 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.ImageBase;
+
+ COMPILE::JS
+ {
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+ public class Image extends ImageBase
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.7
+ */
+ public function Image()
+ {
+ 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.setAttribute('x', 0);
+ element.setAttribute('y', 0);
+ //element.offsetParent = null;
+ positioner = element;
+ positioner.style.position = 'relative';
+ addImageElement();
+ return element;
+ }
+
+ COMPILE::JS
+ protected var _image:WrappedHTMLElement;
+
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ COMPILE::JS
+ protected function addImageElement():void
+ {
+ if (_image == null) {
+ _image = document.createElementNS('http://www.w3.org/2000/svg', 'image') as WrappedHTMLElement;
+ _image.setAttribute("width", "100%");
+ _image.setAttribute("height", "100%");
+ _image.flexjs_wrapper = this;
+ element.appendChild(_image);
+ }
+ }
+
+ COMPILE::JS
+ override public function get imageElement():Element
+ {
+ return _image;
+ }
+
+ COMPILE::JS
+ override public function get transformElement():WrappedHTMLElement
+ {
+ return _image;
+ }
+
+ COMPILE::JS
+ override public function applyImageData(binaryDataAsString:String):void
+ {
+ (_image as SVGImageElement).setAttributeNS('http://www.w3.org/1999/xlink','href', binaryDataAsString);
+ }
+ COMPILE::JS
+ override public function setWidth(value:Number, noEvent:Boolean=false):void
+ {
+ super.setWidth(value, noEvent);
+ positioner.setAttribute("width", value);
+ }
+
+ COMPILE::JS
+ override public function setHeight(value:Number, noEvent:Boolean=false):void
+ {
+ super.setHeight(value, noEvent);
+ positioner.setAttribute("height", value);
+ }
+
+ COMPILE::JS
+ override public function setX(value:Number):void
+ {
+ super.setX(value);
+ positioner.setAttribute("x", value);
+
+ }
+ COMPILE::JS
+ override public function setY(value:Number):void
+ {
+ super.setY(value);
+ positioner.setAttribute("y", value);
+
+ }
+
+ COMPILE::JS
+ override public function set x(value:Number):void
+ {
+ super.x = value;
+ positioner.setAttribute("x", value);
+ }
+
+ COMPILE::JS
+ override public function set y(value:Number):void
+ {
+ super.y = value;
+ positioner.setAttribute("y", value);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e020ba83/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/beads/ImageView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/beads/ImageView.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/beads/ImageView.as
new file mode 100644
index 0000000..8cbd789
--- /dev/null
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/beads/ImageView.as
@@ -0,0 +1,87 @@
+
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You 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.beads
+{
+ import org.apache.flex.core.ImageViewBase;
+ COMPILE::JS
+ {
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.ValuesManager;
+ }
+
+ /**
+ * The ImageView class creates the visual elements of the org.apache.flex.svg.Image component.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ImageView extends ImageViewBase
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ImageView()
+ {
+ }
+
+ COMPILE::JS
+ override protected function sizeChangedHandler(event:Object):void
+ {
+ super.sizeChangedHandler(event);
+ var host:UIBase = _strand as UIBase;
+
+ var left:* = ValuesManager.valuesImpl.getValue(host, "left");
+ var right:* = ValuesManager.valuesImpl.getValue(host, "right");
+ var l:Number = isNaN(left) ? NaN : left;
+ var r:Number = isNaN(right) ? NaN : right;
+
+ var top:* = ValuesManager.valuesImpl.getValue(host, "top");
+ var bottom:* = ValuesManager.valuesImpl.getValue(host, "bottom");
+ var t:Number = isNaN(top) ? NaN : top;
+ var b:Number = isNaN(bottom) ? NaN : bottom;
+
+ var p:Object = host.positioner;
+
+ if (!isNaN(l) &&
+ !isNaN(r)) {
+ // if just using size constraints and image will not shrink or grow
+ var computedWidth:Number = (host.positioner.offsetParent as HTMLElement).offsetWidth -
+ l - r;
+ p.setAttribute("width", computedWidth);
+
+ }
+ if (!isNaN(t) &&
+ !isNaN(b)) {
+ // if just using size constraints and image will not shrink or grow
+ var computedHeight:Number = (host.positioner.offsetParent as HTMLElement).offsetHeight -
+ t - b;
+ p.setAttribute("height", computedHeight);
+ }
+ }
+
+ }
+}