You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by pe...@apache.org on 2015/01/05 23:13:19 UTC
[1/3] git commit: [flex-asjs] [refs/heads/develop] - Made all event
names lowercase for JavaScript.
Repository: flex-asjs
Updated Branches:
refs/heads/develop 22c78cef6 -> c7099238d
Made all event names lowercase for JavaScript.
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/d9d3dd0d
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/d9d3dd0d
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/d9d3dd0d
Branch: refs/heads/develop
Commit: d9d3dd0d8ff5a6b1532eb05eb419be7b35cac2bb
Parents: 22c78ce
Author: Peter Ent <pe...@apache.org>
Authored: Mon Jan 5 16:43:45 2015 -0500
Committer: Peter Ent <pe...@apache.org>
Committed: Mon Jan 5 16:43:45 2015 -0500
----------------------------------------------------------------------
.../FlexJS/src/org/apache/flex/events/MouseEvent.js | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d9d3dd0d/frameworks/js/FlexJS/src/org/apache/flex/events/MouseEvent.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/events/MouseEvent.js b/frameworks/js/FlexJS/src/org/apache/flex/events/MouseEvent.js
index ace4423..95f77a2 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/events/MouseEvent.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/events/MouseEvent.js
@@ -34,43 +34,43 @@ goog.inherits(org.apache.flex.events.MouseEvent,
/**
* @type {string}
*/
-org.apache.flex.events.MouseEvent.ROLL_OVER = 'rollOver';
+org.apache.flex.events.MouseEvent.ROLL_OVER = 'rollover';
/**
* @type {string}
*/
-org.apache.flex.events.MouseEvent.ROLL_OUT = 'rollOout';
+org.apache.flex.events.MouseEvent.ROLL_OUT = 'rollout';
/**
* @type {string}
*/
-org.apache.flex.events.MouseEvent.MOUSE_OVER = 'mouseOver';
+org.apache.flex.events.MouseEvent.MOUSE_OVER = 'mouseover';
/**
* @type {string}
*/
-org.apache.flex.events.MouseEvent.MOUSE_OUT = 'mouseOut';
+org.apache.flex.events.MouseEvent.MOUSE_OUT = 'mouseout';
/**
* @type {string}
*/
-org.apache.flex.events.MouseEvent.MOUSE_UP = 'mouseUp';
+org.apache.flex.events.MouseEvent.MOUSE_UP = 'mouseup';
/**
* @type {string}
*/
-org.apache.flex.events.MouseEvent.MOUSE_DOWN = 'mouseDown';
+org.apache.flex.events.MouseEvent.MOUSE_DOWN = 'mousedown';
/**
* @type {string}
*/
-org.apache.flex.events.MouseEvent.MOUSE_MOVE = 'mouseMove';
+org.apache.flex.events.MouseEvent.MOUSE_MOVE = 'mousemove';
/**
[3/3] git commit: [flex-asjs] [refs/heads/develop] - Added
DataTipBead.
Posted by pe...@apache.org.
Added DataTipBead.
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/c7099238
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/c7099238
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/c7099238
Branch: refs/heads/develop
Commit: c7099238d91a0bd9520e29dbc53e78b0cb138561
Parents: 975188f
Author: Peter Ent <pe...@apache.org>
Authored: Mon Jan 5 17:11:49 2015 -0500
Committer: Peter Ent <pe...@apache.org>
Committed: Mon Jan 5 17:11:49 2015 -0500
----------------------------------------------------------------------
.../as/projects/FlexJSJX/basic-manifest.xml | 1 +
frameworks/as/projects/FlexJSJX/defaults.css | 5 +
.../as/projects/FlexJSJX/src/FlexJSJXClasses.as | 2 +
.../org/apache/flex/charts/beads/ChartView.as | 2 +
.../org/apache/flex/charts/beads/DataTipBead.as | 160 ++++++++++
.../flex/charts/optimized/SVGBoxItemRenderer.as | 49 +--
.../flex/charts/optimized/SVGChartDataGroup.as | 10 +
.../charts/supportClasses/BoxItemRenderer.as | 33 +++
.../apache/flex/html/accessories/ToolTipBead.as | 33 ++-
.../html/supportClasses/GraphicsItemRenderer.as | 295 +++++++++++++++++++
.../as/projects/FlexJSUI/src/FlexJSUIClasses.as | 4 +-
.../apache/flex/charts/core/IChartDataGroup.as | 11 +
.../charts/supportClasses/ChartDataGroup.as | 26 ++
.../flex/core/graphics/GraphicsContainer.as | 16 +
.../ListSingleSelectionMouseController.as | 13 +-
.../apache/flex/core/ISelectableItemRenderer.js | 115 ++++++++
.../apache/flex/core/graphics/GraphicShape.js | 8 +
.../flex/core/graphics/GraphicsContainer.js | 22 ++
18 files changed, 746 insertions(+), 59 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c7099238/frameworks/as/projects/FlexJSJX/basic-manifest.xml
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSJX/basic-manifest.xml b/frameworks/as/projects/FlexJSJX/basic-manifest.xml
index 0dac3c8..92f3700 100644
--- a/frameworks/as/projects/FlexJSJX/basic-manifest.xml
+++ b/frameworks/as/projects/FlexJSJX/basic-manifest.xml
@@ -39,6 +39,7 @@
<component id="PieSeries" class="org.apache.flex.charts.supportClasses.PieSeries" />
<component id="StackedColumnChart" class="org.apache.flex.charts.StackedColumnChart" />
<component id="StackedBarChart" class="org.apache.flex.charts.StackedBarChart" />
+ <component id="DataTipBead" class="org.apache.flex.charts.beads.DataTipBead" />
<component id="HorizontalCategoryAxisBead" class="org.apache.flex.charts.beads.HorizontalCategoryAxisBead" />
<component id="HorizontalLinearAxisBead" class="org.apache.flex.charts.beads.HorizontalLinearAxisBead" />
<component id="VerticalCategoryAxisBead" class="org.apache.flex.charts.beads.VerticalCategoryAxisBead" />
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c7099238/frameworks/as/projects/FlexJSJX/defaults.css
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSJX/defaults.css b/frameworks/as/projects/FlexJSJX/defaults.css
index d2c8648..4ba635b 100644
--- a/frameworks/as/projects/FlexJSJX/defaults.css
+++ b/frameworks/as/projects/FlexJSJX/defaults.css
@@ -32,6 +32,11 @@ BarChart
IVerticalAxisGroup: ClassReference("org.apache.flex.charts.supportClasses.ChartAxisGroup");
}
+BoxItemRenderer
+{
+ IBeadController: ClassReference("org.apache.flex.html.beads.controllers.ItemRendererMouseController");
+}
+
ColumnChart
{
IBeadModel: ClassReference("org.apache.flex.html.beads.models.ArraySelectionModel");
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c7099238/frameworks/as/projects/FlexJSJX/src/FlexJSJXClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSJX/src/FlexJSJXClasses.as b/frameworks/as/projects/FlexJSJX/src/FlexJSJXClasses.as
index 0e9027e..06fa320 100644
--- a/frameworks/as/projects/FlexJSJX/src/FlexJSJXClasses.as
+++ b/frameworks/as/projects/FlexJSJX/src/FlexJSJXClasses.as
@@ -31,6 +31,7 @@ internal class FlexJSJXClasses
import org.apache.flex.charts.beads.ChartView; ChartView;
import org.apache.flex.charts.beads.ChartItemRendererFactory; ChartItemRendererFactory;
import org.apache.flex.charts.beads.DataItemRendererFactoryForSeriesData; DataItemRendererFactoryForSeriesData;
+ import org.apache.flex.charts.beads.DataTipBead; DataTipBead;
import org.apache.flex.charts.beads.HorizontalCategoryAxisBead; HorizontalCategoryAxisBead;
import org.apache.flex.charts.beads.HorizontalLinearAxisBead; HorizontalLinearAxisBead;
import org.apache.flex.charts.beads.VerticalCategoryAxisBead; VerticalCategoryAxisBead;
@@ -74,6 +75,7 @@ internal class FlexJSJXClasses
import org.apache.flex.html.beads.controllers.DateFieldMouseController; DateFieldMouseController;
import org.apache.flex.html.supportClasses.DataGridColumn; DataGridColumn;
import org.apache.flex.html.supportClasses.DateChooserButton; DateChooserButton;
+ import org.apache.flex.html.supportClasses.GraphicsItemRenderer; GraphicsItemRenderer;
import org.apache.flex.html.beads.TitleBarView; TitleBarView;
import org.apache.flex.html.beads.TitleBarMeasurementBead; TitleBarMeasurementBead;
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c7099238/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/beads/ChartView.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/beads/ChartView.as b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/beads/ChartView.as
index ee06b4d..6593d1a 100644
--- a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/beads/ChartView.as
+++ b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/beads/ChartView.as
@@ -85,6 +85,8 @@ package org.apache.flex.charts.beads
}
handleLocalChange(null);
+
+ IEventDispatcher(_strand).dispatchEvent( new Event("viewCreated") );
}
public function get horizontalAxisGroup():IAxisGroup
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c7099238/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/beads/DataTipBead.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/beads/DataTipBead.as b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/beads/DataTipBead.as
new file mode 100644
index 0000000..8725f2d
--- /dev/null
+++ b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/beads/DataTipBead.as
@@ -0,0 +1,160 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.charts.beads
+{
+ import org.apache.flex.charts.core.IChartDataGroup;
+ import org.apache.flex.charts.core.IChartItemRenderer;
+ import org.apache.flex.charts.core.IChartSeries;
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.events.MouseEvent;
+ import org.apache.flex.events.utils.MouseUtils;
+ import org.apache.flex.geom.Point;
+ import org.apache.flex.html.accessories.ToolTipBead;
+ import org.apache.flex.html.beads.IListView;
+ import org.apache.flex.utils.PointUtils;
+
+ /**
+ * The DataTipBead can be added to a chart to produce a helpful tip when the
+ * moves over an itemRenderer.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DataTipBead extends ToolTipBead implements IBead
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DataTipBead()
+ {
+ }
+
+ private var _strand:IStrand;
+
+ override public function set strand(value:IStrand):void
+ {
+ super.strand = value;
+ _strand = value;
+
+ IEventDispatcher(_strand).addEventListener("viewCreated", handleViewCreated);
+ }
+
+ private var _labelFunction:Function;
+
+ /**
+ * An optional function that can format the data tip text.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get labelFunction():Function
+ {
+ return _labelFunction;
+ }
+ public function set labelFunction(value:Function):void
+ {
+ _labelFunction = value;
+ }
+
+ /**
+ * @private
+ */
+ private function handleViewCreated( event:Event ):void
+ {
+ // find the data group
+ var chart:IListView = _strand.getBeadByType(IListView) as IListView;
+ var dataGroup:IChartDataGroup = chart.dataGroup as IChartDataGroup;
+ IEventDispatcher(dataGroup).addEventListener(MouseEvent.MOUSE_OVER, rollOverHandler);
+ }
+
+ /**
+ * @private
+ * Overrides the ToolTipBead's function to determine the text to display
+ * based on the chart series and current value.
+ */
+ override protected function rollOverHandler( event:MouseEvent ):void
+ {
+ var renderer:IChartItemRenderer = findItemRenderer(event);
+ if (renderer)
+ {
+ var series:IChartSeries = renderer.series;
+ var result:String;
+
+ if (labelFunction) {
+ result = labelFunction(renderer);
+ }
+ else {
+ if (series.xField) result = renderer.data[series.xField];
+ else if (series.yField) result = renderer.data[series.yField];
+ }
+ this.toolTip = result;
+
+ super.rollOverHandler(event);
+ }
+ }
+
+ /**
+ * @private
+ * Override's the ToolTipBead's function to position the data tip just above
+ * the itemRenderer.
+ */
+ override protected function determinePosition(base:Point, local:Object):Point
+ {
+ // always want above the renderer
+ var pt:Point = new Point(0, -20);
+ pt = PointUtils.localToGlobal(pt, local);
+ return pt;
+ }
+
+ /**
+ * @private
+ */
+ private function findItemRenderer(event:MouseEvent):IChartItemRenderer
+ {
+ var base:Object = MouseUtils.eventTarget(event);
+
+ if (base is IChartDataGroup)
+ {
+ var dataGroup:IChartDataGroup = base as IChartDataGroup;
+ var point:Point = new Point(event.localX, event.localY);
+ var renderer:IChartItemRenderer = dataGroup.getItemRendererUnderPoint(point);
+ return renderer;
+ }
+ else
+ {
+ while (base != null && !(base is IChartItemRenderer)) {
+ base = base.parent;
+ }
+ return base as IChartItemRenderer;
+ }
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c7099238/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/optimized/SVGBoxItemRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/optimized/SVGBoxItemRenderer.as b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/optimized/SVGBoxItemRenderer.as
index 5e4f1e5..8b7055c 100644
--- a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/optimized/SVGBoxItemRenderer.as
+++ b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/optimized/SVGBoxItemRenderer.as
@@ -26,6 +26,7 @@ package org.apache.flex.charts.optimized
import org.apache.flex.core.graphics.SolidColor;
import org.apache.flex.core.graphics.SolidColorStroke;
import org.apache.flex.html.supportClasses.DataItemRenderer;
+ import org.apache.flex.html.supportClasses.GraphicsItemRenderer;
/**
* The SVGBoxItemRenderer draws its graphics directly into a SVGChartDataGroup
@@ -36,7 +37,7 @@ package org.apache.flex.charts.optimized
* @playerversion AIR 2.6
* @productversion FlexJS 0.0
*/
- public class SVGBoxItemRenderer extends DataItemRenderer implements IChartItemRenderer
+ public class SVGBoxItemRenderer extends GraphicsItemRenderer implements IChartItemRenderer
{
/**
* constructor.
@@ -109,44 +110,6 @@ package org.apache.flex.charts.optimized
_xField = value;
}
- private var _fill:IFill;
-
- /**
- * The color used to fill the interior of the box.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get fill():IFill
- {
- return _fill;
- }
- public function set fill(value:IFill):void
- {
- _fill = value;
- }
-
- private var _stroke:IStroke;
-
- /**
- * The outline of the box.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get stroke():IStroke
- {
- return _stroke;
- }
- public function set stroke(value:IStroke):void
- {
- _stroke = value;
- }
-
/**
* @copy org.apache.flex.supportClasses.UIItemRendererBase#data
*
@@ -195,12 +158,8 @@ package org.apache.flex.charts.optimized
protected function drawBar():void
{
if ((this.width > 0) && (this.height > 0))
- {
- var hsdg:SVGChartDataGroup = this.itemRendererParent as SVGChartDataGroup;
-
- hsdg.fill = fill;
- hsdg.stroke = stroke;
- hsdg.drawRect(this.x, this.y, this.width, this.height);
+ {
+ this.drawRect(0, 0, this.width, this.height);
}
}
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c7099238/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/optimized/SVGChartDataGroup.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/optimized/SVGChartDataGroup.as b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/optimized/SVGChartDataGroup.as
index 79345a8..67207ad 100644
--- a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/optimized/SVGChartDataGroup.as
+++ b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/optimized/SVGChartDataGroup.as
@@ -28,6 +28,7 @@ package org.apache.flex.charts.optimized
import org.apache.flex.core.UIBase;
import org.apache.flex.core.graphics.GraphicsContainer;
import org.apache.flex.events.Event;
+ import org.apache.flex.geom.Point;
/**
* The SVGChartDataGroup serves as the drawing canvas for SVG itemRenderers. Rather than having
@@ -142,6 +143,8 @@ package org.apache.flex.charts.optimized
var base:UIBase = value as UIBase;
base.addedToParent();
+
+ super.addElement(value, dispatchEvent);
}
/**
@@ -160,6 +163,8 @@ package org.apache.flex.charts.optimized
var base:UIBase = value as UIBase;
base.addedToParent();
+
+ super.addElementAt(value, index, dispatchEvent);
}
/**
@@ -169,5 +174,10 @@ package org.apache.flex.charts.optimized
{
// might need to do something with this
}
+
+ public function getItemRendererUnderPoint(point:Point):IChartItemRenderer
+ {
+ return null;
+ }
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c7099238/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/supportClasses/BoxItemRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/supportClasses/BoxItemRenderer.as b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/supportClasses/BoxItemRenderer.as
index 00dd1e5..1bec3b1 100644
--- a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/supportClasses/BoxItemRenderer.as
+++ b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/supportClasses/BoxItemRenderer.as
@@ -20,9 +20,11 @@ package org.apache.flex.charts.supportClasses
{
import org.apache.flex.charts.core.IChartItemRenderer;
import org.apache.flex.charts.core.IChartSeries;
+ import org.apache.flex.core.IBead;
import org.apache.flex.core.graphics.IFill;
import org.apache.flex.core.graphics.IStroke;
import org.apache.flex.core.graphics.Rect;
+ import org.apache.flex.core.graphics.SolidColor;
import org.apache.flex.html.supportClasses.DataItemRenderer;
/**
@@ -51,6 +53,16 @@ package org.apache.flex.charts.supportClasses
super();
}
+ override public function addedToParent():void
+ {
+ super.addedToParent();
+ }
+
+ override public function addBead(bead:IBead):void
+ {
+ super.addBead(bead);
+ }
+
private var _series:IChartSeries;
/**
@@ -217,5 +229,26 @@ package org.apache.flex.charts.supportClasses
}
}
}
+
+ private var hoverFill:SolidColor;
+
+ override public function updateRenderer():void
+ {
+ super.updateRenderer();
+
+ if (down||selected||hovered) {
+ if (hoverFill == null) {
+ hoverFill = new SolidColor();
+ hoverFill.color = (fill as SolidColor).color;
+ hoverFill.alpha = 0.5;
+ }
+ filledRect.fill = hoverFill;
+ }
+ else {
+ filledRect.fill = fill;
+ }
+
+ filledRect.drawRect(filledRect.x, filledRect.y, filledRect.width, filledRect.height);
+ }
}
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c7099238/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/accessories/ToolTipBead.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/accessories/ToolTipBead.as b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/accessories/ToolTipBead.as
index a1556c2..64afbef 100644
--- a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/accessories/ToolTipBead.as
+++ b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/accessories/ToolTipBead.as
@@ -26,11 +26,12 @@ package org.apache.flex.html.accessories
import org.apache.flex.core.UIBase;
import org.apache.flex.events.Event;
import org.apache.flex.events.IEventDispatcher;
- import org.apache.flex.events.MouseEvent;
- import org.apache.flex.geom.Point;
+ import org.apache.flex.events.MouseEvent;
+ import org.apache.flex.events.utils.MouseUtils;
+ import org.apache.flex.geom.Point;
import org.apache.flex.html.ToolTip;
import org.apache.flex.utils.PointUtils;
- import org.apache.flex.utils.UIUtils;
+ import org.apache.flex.utils.UIUtils;
/**
* The ToolTipBead class is a specialty bead that can be used with
@@ -89,7 +90,7 @@ package org.apache.flex.html.accessories
{
_strand = value;
- IEventDispatcher(_strand).addEventListener(MouseEvent.ROLL_OVER, rollOverHandler);
+ IEventDispatcher(_strand).addEventListener(MouseEvent.MOUSE_OVER, rollOverHandler, false);
}
private var tt:ToolTip;
@@ -98,28 +99,42 @@ package org.apache.flex.html.accessories
/**
* @private
*/
- private function rollOverHandler( event:MouseEvent ):void
+ protected function rollOverHandler( event:MouseEvent ):void
{
- IEventDispatcher(_strand).addEventListener(MouseEvent.ROLL_OUT, rollOutHandler);
+ IEventDispatcher(_strand).addEventListener(MouseEvent.MOUSE_OUT, rollOutHandler, false);
var comp:IUIBase = _strand as IUIBase
host = UIUtils.findPopUpHost(comp);
+ if (tt) host.removeElement(tt);
+
tt = new ToolTip();
tt.text = toolTip;
- var pt:Point = new Point(comp.width, comp.height);
- pt = PointUtils.localToGlobal(pt, comp);
+ var pt:Point = determinePosition(new Point(MouseUtils.localX(event), MouseUtils.localY(event)), event.target);
tt.x = pt.x;
tt.y = pt.y;
host.addElement(tt);
}
+
+ /**
+ * @private
+ * Determines the position of the toolTip.
+ */
+ protected function determinePosition(base:Point, local:Object):Point
+ {
+ var comp:IUIBase = _strand as IUIBase;
+ var pt:Point = new Point(comp.width, comp.height);
+ pt = PointUtils.localToGlobal(pt, comp);
+ return pt;
+ }
/**
* @private
*/
private function rollOutHandler( event:MouseEvent ):void
{
- if (tt)
+ if (tt) {
host.removeElement(tt);
+ }
tt = null;
}
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c7099238/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/supportClasses/GraphicsItemRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/supportClasses/GraphicsItemRenderer.as b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/supportClasses/GraphicsItemRenderer.as
new file mode 100644
index 0000000..4d90c03
--- /dev/null
+++ b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/supportClasses/GraphicsItemRenderer.as
@@ -0,0 +1,295 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.html.supportClasses
+{
+ import org.apache.flex.core.ISelectableItemRenderer;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.core.graphics.GraphicsContainer;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.utils.MXMLDataInterpreter;
+
+ /**
+ * The GraphicsItemRenderer provides a base class for itemRenderers that use graphics rather than
+ * components.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class GraphicsItemRenderer extends GraphicsContainer implements ISelectableItemRenderer
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function GraphicsItemRenderer()
+ {
+ super();
+ }
+
+ /**
+ * @private
+ */
+ override public function addedToParent():void
+ {
+ super.addedToParent();
+
+ // very common for item renderers to be resized by their containers,
+ addEventListener("widthChanged", sizeChangeHandler);
+ addEventListener("heightChanged", sizeChangeHandler);
+
+ // each MXML file can also have styles in fx:Style block
+ ValuesManager.valuesImpl.init(this);
+
+ MXMLDataInterpreter.generateMXMLProperties(this, mxmlProperties);
+ MXMLDataInterpreter.generateMXMLInstances(this, this, MXMLDescriptor);
+
+ dispatchEvent(new Event("initBindings"));
+ dispatchEvent(new Event("initComplete"));
+
+ }
+
+ private var _labelField:String = "label";
+
+ /**
+ * The name of the field within the data to use as a label. Some itemRenderers use this field to
+ * identify the value they should show while other itemRenderers ignore this if they are showing
+ * complex information.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get labelField():String
+ {
+ return _labelField;
+ }
+ public function set labelField(value:String):void
+ {
+ _labelField = value;
+ }
+
+ private var _index:int;
+
+ /**
+ * The position with the dataProvider being shown by the itemRenderer instance.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get index():int
+ {
+ return _index;
+ }
+ public function set index(value:int):void
+ {
+ _index = value;
+ }
+
+ private var _selected:Boolean;
+
+ /**
+ * Whether or not the itemRenderer is in a selected state.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get selected():Boolean
+ {
+ return _selected;
+ }
+ public function set selected(value:Boolean):void
+ {
+ _selected = value;
+ updateRenderer();
+ }
+
+ private var _hovered:Boolean;
+
+ /**
+ * Whether or not the itemRenderer is in a hovered state.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get hovered():Boolean
+ {
+ return _hovered;
+ }
+ public function set hovered(value:Boolean):void
+ {
+ _hovered = value;
+ updateRenderer();
+ }
+
+ private var _down:Boolean;
+
+ /**
+ * Whether or not the itemRenderer is in a down (or pre-selected) state.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get down():Boolean
+ {
+ return _down;
+ }
+ public function set down(value:Boolean):void
+ {
+ _down = value;
+ updateRenderer();
+ }
+
+ private var _data:Object;
+
+ [Bindable("__NoChangeEvent__")]
+ /**
+ * The data being represented by this itemRenderer. This can be something simple like a String or
+ * a Number or something very complex.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get data():Object
+ {
+ return _data;
+ }
+ public function set data(value:Object):void
+ {
+ _data = value;
+ }
+
+ private var _dataField:String;
+
+ /**
+ * The name of the field within the data the itemRenderer should use.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get dataField():String
+ {
+ return _dataField;
+ }
+ public function set dataField(value:String):void
+ {
+ _dataField = value;
+ }
+
+ private var _itemRendererParent:Object;
+
+ /**
+ * The parent container for the itemRenderer instance.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get itemRendererParent():Object
+ {
+ return _itemRendererParent;
+ }
+ public function set itemRendererParent(value:Object):void
+ {
+ _itemRendererParent = value;
+ }
+
+ /**
+ * @private
+ */
+ public function updateRenderer():void
+ {
+// if (down)
+// backgroundColor = downColor;
+// else if (hovered)
+// backgroundColor = highlightColor;
+// else if (selected)
+// backgroundColor = selectedColor;
+ }
+
+ /**
+ * @copy org.apache.flex.core.ItemRendererClassFactory#mxmlContent
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public var mxmlContent:Array;
+
+ /**
+ * @private
+ */
+ public function get MXMLDescriptor():Array
+ {
+ return null;
+ }
+
+ private var mxmlProperties:Array ;
+
+ /**
+ * @private
+ */
+ public function generateMXMLAttributes(data:Array):void
+ {
+ mxmlProperties = data;
+ }
+
+ /**
+ * @private
+ */
+ private function sizeChangeHandler(event:Event):void
+ {
+ adjustSize();
+ }
+
+ /**
+ * This function is called whenever the itemRenderer changes size. Sub-classes should override
+ * this method an handle the size change.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function adjustSize():void
+ {
+ // handle in subclass
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c7099238/frameworks/as/projects/FlexJSUI/src/FlexJSUIClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/FlexJSUIClasses.as b/frameworks/as/projects/FlexJSUI/src/FlexJSUIClasses.as
index 2ce4a2d..bdda6ef 100644
--- a/frameworks/as/projects/FlexJSUI/src/FlexJSUIClasses.as
+++ b/frameworks/as/projects/FlexJSUI/src/FlexJSUIClasses.as
@@ -125,6 +125,7 @@ internal class FlexJSUIClasses
import org.apache.flex.utils.EffectTimer; EffectTimer;
import org.apache.flex.utils.Timer; Timer;
import org.apache.flex.utils.UIUtils; UIUtils;
+ import org.apache.flex.core.ISelectableItemRenderer; ISelectableItemRenderer;
import org.apache.flex.core.SimpleStatesImpl; SimpleStatesImpl;
import org.apache.flex.core.graphics.GraphicShape; GraphicShape;
import org.apache.flex.core.graphics.Rect; Rect;
@@ -138,7 +139,8 @@ internal class FlexJSUIClasses
import org.apache.flex.core.graphics.LinearGradient; LinearGradient;
import org.apache.flex.core.DataBindingBase; DataBindingBase;
import org.apache.flex.effects.PlatformWiper; PlatformWiper;
- import org.apache.flex.events.DragEvent; DragEvent;
+ import org.apache.flex.events.DragEvent; DragEvent;
+ import org.apache.flex.events.utils.MouseUtils; MouseUtils;
import org.apache.flex.geom.Rectangle; Rectangle;
import mx.core.ClassFactory; ClassFactory;
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c7099238/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/core/IChartDataGroup.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/core/IChartDataGroup.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/core/IChartDataGroup.as
index d32874e..da4777e 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/core/IChartDataGroup.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/core/IChartDataGroup.as
@@ -19,6 +19,7 @@
package org.apache.flex.charts.core
{
import org.apache.flex.core.IItemRendererParent;
+ import org.apache.flex.geom.Point;
/**
* The IChartDataGroup is the interface for the parent element of
@@ -40,5 +41,15 @@ package org.apache.flex.charts.core
* @productversion FlexJS 0.0
*/
function getItemRendererForSeriesAtIndex(series:IChartSeries, index:int):IChartItemRenderer;
+
+ /**
+ * Returns the first itemRenderer that encompasses the point.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function getItemRendererUnderPoint(point:Point):IChartItemRenderer;
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c7099238/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/supportClasses/ChartDataGroup.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/supportClasses/ChartDataGroup.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/supportClasses/ChartDataGroup.as
index 0ab5ff2..f6bbd89 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/supportClasses/ChartDataGroup.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/supportClasses/ChartDataGroup.as
@@ -21,6 +21,8 @@ package org.apache.flex.charts.supportClasses
import org.apache.flex.charts.core.IChartDataGroup;
import org.apache.flex.charts.core.IChartItemRenderer;
import org.apache.flex.charts.core.IChartSeries;
+ import org.apache.flex.core.IUIBase;
+ import org.apache.flex.geom.Point;
import org.apache.flex.html.supportClasses.NonVirtualDataGroup;
/**
@@ -70,5 +72,29 @@ package org.apache.flex.charts.supportClasses
return null;
}
+
+ /**
+ * Returns the first itemRenderer that encompasses the point.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function getItemRendererUnderPoint(point:Point):IChartItemRenderer
+ {
+ var n:int = numChildren;
+ for(var i:int=0; i < n; i++)
+ {
+ var child:IUIBase = getChildAt(i) as IUIBase;
+ if (child) {
+ if (child.x <= point.x && point.x <= (child.x+child.width) &&
+ child.y <= point.y && point.y <= (child.y+child.height))
+ return child as IChartItemRenderer;
+ }
+ }
+
+ return null;
+ }
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c7099238/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/GraphicsContainer.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/GraphicsContainer.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/GraphicsContainer.as
index 32fd418..504b91e 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/GraphicsContainer.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/GraphicsContainer.as
@@ -15,6 +15,8 @@
package org.apache.flex.core.graphics
{
import flash.display.GraphicsPath;
+ import flash.display.Shape;
+ import flash.display.Sprite;
import flash.geom.Point;
import flash.geom.Rectangle;
import flash.text.TextFieldType;
@@ -65,6 +67,20 @@ package org.apache.flex.core.graphics
endFill();
}
+ public function createRect(x:Number, y:Number, width:Number, height:Number):void
+ {
+ var color:uint = (fill as SolidColor).color;
+ var alpha:uint = (fill as SolidColor).alpha;
+
+ var shape:Sprite = new Sprite();
+ shape.graphics.beginFill(color,alpha);
+ shape.graphics.drawRect(0, 0, width, height);
+ shape.graphics.endFill();
+ shape.x = x;
+ shape.y = y;
+ this.addChild(shape);
+ }
+
/**
* Draw the ellipse.
* @param x The x position of the top-left corner of the bounding box of the ellipse.
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c7099238/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/controllers/ListSingleSelectionMouseController.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/controllers/ListSingleSelectionMouseController.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/controllers/ListSingleSelectionMouseController.as
index 79e6352..553af6d 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/controllers/ListSingleSelectionMouseController.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/controllers/ListSingleSelectionMouseController.as
@@ -19,13 +19,14 @@
package org.apache.flex.html.beads.controllers
{
import org.apache.flex.core.IBeadController;
- import org.apache.flex.core.ISelectableItemRenderer;
import org.apache.flex.core.IItemRendererParent;
import org.apache.flex.core.IRollOverModel;
+ import org.apache.flex.core.ISelectableItemRenderer;
import org.apache.flex.core.ISelectionModel;
import org.apache.flex.core.IStrand;
import org.apache.flex.events.Event;
import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.events.MouseEvent;
import org.apache.flex.html.beads.IListView;
@@ -105,7 +106,8 @@ package org.apache.flex.html.beads.controllers
listView = value.getBeadByType(IListView) as IListView;
dataGroup = listView.dataGroup;
dataGroup.addEventListener("selected", selectedHandler, true);
- dataGroup.addEventListener("rollover", rolloverHandler, true);
+ IEventDispatcher(_strand).addEventListener(MouseEvent.ROLL_OVER, rolloverHandler);
+// dataGroup.addEventListener(MouseEvent.ROLL_OVER, rolloverHandler, true);
}
private function selectedHandler(event:Event):void
@@ -116,8 +118,11 @@ package org.apache.flex.html.beads.controllers
private function rolloverHandler(event:Event):void
{
- IRollOverModel(listModel).rollOverIndex = ISelectableItemRenderer(event.target).index;
- listView.host.dispatchEvent(new Event("rollover"));
+ var renderer:ISelectableItemRenderer = event.target as ISelectableItemRenderer;
+ if (renderer) {
+ trace("ListSingleSelectionMouseController.ROLL_OVER");
+ IRollOverModel(listModel).rollOverIndex = renderer.index;
+ }
}
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c7099238/frameworks/js/FlexJS/src/org/apache/flex/core/ISelectableItemRenderer.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/ISelectableItemRenderer.js b/frameworks/js/FlexJS/src/org/apache/flex/core/ISelectableItemRenderer.js
new file mode 100644
index 0000000..94f7782
--- /dev/null
+++ b/frameworks/js/FlexJS/src/org/apache/flex/core/ISelectableItemRenderer.js
@@ -0,0 +1,115 @@
+/**
+ * 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.
+ */
+
+/**
+ * org.apache.flex.core.ISelectableItemRenderer
+ *
+ * @fileoverview
+ *
+ * @suppress {checkTypes}
+ */
+
+goog.provide('org.apache.flex.core.ISelectableItemRenderer');
+
+goog.require('org.apache.flex.core.IItemRenderer');
+
+
+
+/**
+ * @interface
+ * @extends {org.apache.flex.events.IEventDispatcher}
+ * @extends {org.apache.flex.core.IItemRenderer}
+ */
+org.apache.flex.core.ISelectableItemRenderer = function() {
+};
+
+
+/**
+ * @expose
+ * @param {Object} value
+ */
+org.apache.flex.core.ISelectableItemRenderer.prototype.set_labelField = function(value) {};
+
+
+/**
+ * @expose
+ * @return {Object} The labelField.
+ */
+org.apache.flex.core.ISelectableItemRenderer.prototype.get_labelField = function() {};
+
+
+/**
+ * @expose
+ * @param {number} value
+ */
+org.apache.flex.core.ISelectableItemRenderer.prototype.set_index = function(value) {};
+
+
+/**
+ * @expose
+ * @return {number} The selected index.
+ */
+org.apache.flex.core.ISelectableItemRenderer.prototype.get_index = function() {};
+
+
+/**
+ * @expose
+ * @param {Object} value
+ */
+org.apache.flex.core.ISelectableItemRenderer.prototype.set_selected = function(value) {};
+
+
+/**
+ * @expose
+ * @return {Object} Whether or not the item in the selected state.
+ */
+org.apache.flex.core.ISelectableItemRenderer.prototype.get_selected = function() {};
+
+
+/**
+ * @expose
+ * @param {Object} value
+ */
+org.apache.flex.core.ISelectableItemRenderer.prototype.set_hovered = function(value) {};
+
+
+/**
+ * @expose
+ * @return {Object} Whether or not the item is in the hovered state.
+ */
+org.apache.flex.core.ISelectableItemRenderer.prototype.get_hovered = function() {};
+
+
+/**
+ * @expose
+ * @param {Object} value
+ */
+org.apache.flex.core.ISelectableItemRenderer.prototype.set_down = function(value) {};
+
+
+/**
+ * @expose
+ * @return {Object} Whether or not the item is in the down state.
+ */
+org.apache.flex.core.ISelectableItemRenderer.prototype.get_down = function() {};
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+org.apache.flex.core.ISelectableItemRenderer.prototype.FLEXJS_CLASS_INFO =
+{ names: [{ name: 'ISelectableItemRenderer', qName: 'org.apache.flex.core.ISelectableItemRenderer'}],
+ interfaces: [org.apache.flex.core.IItemRenderer] };
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c7099238/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 740cf90..cf58278 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
@@ -68,6 +68,10 @@ org.apache.flex.core.graphics.GraphicShape = function() {
* @type {SVGElement}
*/
this.element = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
+ this.element.flexjs_wrapper = this;
+ this.element.offsetLeft = 0;
+ this.element.offsetTop = 0;
+ this.element.offsetParent = null;
};
goog.inherits(org.apache.flex.core.graphics.GraphicShape,
org.apache.flex.core.UIBase);
@@ -186,6 +190,8 @@ org.apache.flex.core.graphics.GraphicShape.prototype.resize = function(x, y, bbo
if (!isNaN(y)) this.element.style.left = String(y) + 'px';
this.element.style.width = String(width) + 'px';
this.element.style.height = String(height) + 'px';
+ this.element.offsetLeft = x;
+ this.element.offsetTop = y;
};
@@ -201,5 +207,7 @@ org.apache.flex.core.graphics.GraphicShape.prototype.setPosition = function(x, y
this.y_ = y;
this.xOffset_ = xOffset;
this.yOffset_ = yOffset;
+ this.element.offsetLeft = xOffset;
+ this.element.offsetTop = yOffset;
};
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c7099238/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/GraphicsContainer.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/GraphicsContainer.js b/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/GraphicsContainer.js
index 656568b..c6d7d30 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/GraphicsContainer.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/GraphicsContainer.js
@@ -86,6 +86,7 @@ org.apache.flex.core.graphics.GraphicsContainer.prototype.set_x = function(value
this.element.setAttribute('x', String(value) + 'px');
this.element.style.position = 'absolute';
this.element.style.left = String(value) + 'px';
+ this.element.offsetLeft = value;
};
@@ -97,6 +98,7 @@ org.apache.flex.core.graphics.GraphicsContainer.prototype.set_y = function(value
this.element.setAttribute('y', String(value) + 'px');
this.element.style.position = 'absolute';
this.element.style.top = String(value) + 'px';
+ this.element.offsetTop = value;
};
@@ -110,6 +112,10 @@ org.apache.flex.core.graphics.GraphicsContainer.prototype.set_y = function(value
org.apache.flex.core.graphics.GraphicsContainer.prototype.drawRect = function(x, y, width, height) {
var style = this.getStyleStr();
var rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');
+ rect.flexjs_wrapper = this;
+ rect.offsetLeft = x;
+ rect.offsetTop = y;
+ rect.offsetParent = this;
rect.setAttribute('style', style);
rect.setAttribute('x', String(x) + 'px');
rect.setAttribute('y', String(y) + 'px');
@@ -129,6 +135,10 @@ org.apache.flex.core.graphics.GraphicsContainer.prototype.drawRect = function(x,
org.apache.flex.core.graphics.GraphicsContainer.prototype.drawEllipse = function(x, y, width, height) {
var style = this.getStyleStr();
var ellipse = document.createElementNS('http://www.w3.org/2000/svg', 'ellipse');
+ ellipse.flexjs_wrapper = this;
+ ellipse.offsetLeft = x;
+ ellipse.offsetTop = y;
+ ellipse.offsetParent = this;
ellipse.setAttribute('style', style);
ellipse.setAttribute('cx', String(x + width / 2));
ellipse.setAttribute('cy', String(y + height / 2));
@@ -147,6 +157,10 @@ org.apache.flex.core.graphics.GraphicsContainer.prototype.drawEllipse = function
org.apache.flex.core.graphics.GraphicsContainer.prototype.drawCircle = function(x, y, radius) {
var style = this.getStyleStr();
var circle = document.createElementNS('http://www.w3.org/2000/svg', 'ellipse');
+ circle.flexjs_wrapper = this;
+ circle.offsetLeft = x;
+ circle.offsetTop = y;
+ circle.offsetParent = this;
circle.setAttribute('style', style);
circle.setAttribute('cx', String(x));
circle.setAttribute('cy', String(y));
@@ -169,6 +183,10 @@ org.apache.flex.core.graphics.GraphicsContainer.prototype.drawCircle = function(
org.apache.flex.core.graphics.GraphicsContainer.prototype.drawPath = function(data) {
var style = this.getStyleStr();
var path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
+ path.flexjs_wrapper = this;
+ path.offsetLeft = 0;
+ path.offsetTop = 0;
+ path.offsetParent = this;
path.setAttribute('style', style);
path.setAttribute('d', data);
this.element.appendChild(path);
@@ -184,6 +202,10 @@ org.apache.flex.core.graphics.GraphicsContainer.prototype.drawPath = function(da
org.apache.flex.core.graphics.GraphicsContainer.prototype.drawText = function(value, x, y) {
var style = this.getStyleStr();
var text = document.createElementNS('http://www.w3.org/2000/svg', 'text');
+ text.flexjs_wrapper = this;
+ text.offsetLeft = x;
+ text.offsetTop = y;
+ text.offsetParent = this;
text.setAttribute('style', style);
text.setAttribute('x', String(x) + 'px');
text.setAttribute('y', String(y + 15) + 'px');
[2/3] git commit: [flex-asjs] [refs/heads/develop] - Cross platform
mouse utility functions.
Posted by pe...@apache.org.
Cross platform mouse utility functions.
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/975188f3
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/975188f3
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/975188f3
Branch: refs/heads/develop
Commit: 975188f379d908c1a13086a4489bb566ee1badcc
Parents: d9d3dd0
Author: Peter Ent <pe...@apache.org>
Authored: Mon Jan 5 16:44:23 2015 -0500
Committer: Peter Ent <pe...@apache.org>
Committed: Mon Jan 5 16:44:23 2015 -0500
----------------------------------------------------------------------
.../org/apache/flex/events/utils/MouseUtils.as | 77 ++++++++++++++++++++
.../org/apache/flex/events/utils/MouseUtils.js | 44 +++++++++++
2 files changed, 121 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/975188f3/frameworks/as/projects/FlexJSUI/src/org/apache/flex/events/utils/MouseUtils.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/events/utils/MouseUtils.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/events/utils/MouseUtils.as
new file mode 100644
index 0000000..de2add3
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/events/utils/MouseUtils.as
@@ -0,0 +1,77 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.events.utils
+{
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.MouseEvent;
+
+ /**
+ * This class maps common event functions for MouseEvent
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class MouseUtils
+ {
+ public function MouseUtils()
+ {
+ }
+
+ /**
+ * Returns the event target.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ static public function eventTarget(event:Event):Object
+ {
+ return event.target;
+ }
+
+ /**
+ * Returns the localX value.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ static public function localX(event:MouseEvent):Number
+ {
+ return event.localX;
+ }
+
+ /**
+ * Returns the localY value.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ static public function localY(event:MouseEvent):Number
+ {
+ return event.localY;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/975188f3/frameworks/js/FlexJS/src/org/apache/flex/events/utils/MouseUtils.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/events/utils/MouseUtils.js b/frameworks/js/FlexJS/src/org/apache/flex/events/utils/MouseUtils.js
new file mode 100644
index 0000000..9ec27eb
--- /dev/null
+++ b/frameworks/js/FlexJS/src/org/apache/flex/events/utils/MouseUtils.js
@@ -0,0 +1,44 @@
+/**
+ * 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.
+ */
+
+
+goog.provide('org.apache.flex.events.utils.MouseUtils');
+
+
+/**
+ * @param {Object} event The event.
+ * @return {Object} class instance associated with the event.target.
+ */
+org.apache.flex.events.utils.MouseUtils.eventTarget = function(event) {
+ var target = event.target;
+ return target.flexjs_wrapper;
+};
+
+
+/**
+ * @param {Object} event The event.
+ * @return {number} The x position of the mouse with respect to its parent.
+ */
+org.apache.flex.events.utils.MouseUtils.localX = function(event) {
+ return event.clientX;
+};
+
+
+/**
+ * @param {Object} event The event.
+ * @return {number} The y position of the mouse with respect to its parent.
+ */
+org.apache.flex.events.utils.MouseUtils.localY = function(event) {
+ return event.clientY;
+};