Made localX and localY settable
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/8645a4f0 Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/8645a4f0 Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/8645a4f0 Branch: refs/heads/develop Commit: 8645a4f07a78162abf2c9a5fd6d920aa2ebb020a Parents: 473f9df Author: Harbs <ha...@in-tools.com> Authored: Wed Jul 26 01:13:07 2017 +0300 Committer: Harbs <ha...@in-tools.com> Committed: Wed Jul 26 01:13:07 2017 +0300 ---------------------------------------------------------------------- .../flex/org/apache/flex/events/MouseEvent.as | 39 +++++++++++++++++--- 1 file changed, 33 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/8645a4f0/frameworks/projects/Core/src/main/flex/org/apache/flex/events/MouseEvent.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/events/MouseEvent.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/events/MouseEvent.as index b41b10c..cb52298 100644 --- a/frameworks/projects/Core/src/main/flex/org/apache/flex/events/MouseEvent.as +++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/events/MouseEvent.as @@ -244,8 +244,8 @@ package org.apache.flex.events { super(type, bubbles, cancelable); - // this.localX = localX; - // this.localY = localY; + this.localX = localX; + this.localY = localY; this.relatedObject = relatedObject; this.ctrlKey = ctrlKey; this.altKey = altKey; @@ -357,13 +357,19 @@ package org.apache.flex.events */ public function get clientX():Number { - return wrappedEvent.clientX; + return wrappedEvent ? wrappedEvent.clientX : _localX; } public function get localX():Number { return clientX; } + private var _localX:Number; + + public function set localX(value:Number):void + { + _localX = value; + } /** * Y-coordinate relative to the window. @@ -376,7 +382,7 @@ package org.apache.flex.events */ public function get clientY():Number { - return wrappedEvent.clientY; + return wrappedEvent ? wrappedEvent.clientY : _localY; } public function get localY():Number @@ -384,6 +390,13 @@ package org.apache.flex.events return clientY; } + private var _localY:Number; + + public function set localY(value:Number):void + { + _localY = value; + } + /** * X-coordinate relative to the monitor. * @type {number} @@ -395,7 +408,9 @@ package org.apache.flex.events */ public function get screenX():Number { - return wrappedEvent.screenX; + if(wrappedEvent) return wrappedEvent.screenX; + if (!target) return localX; + return stagePoint.x; } /** @@ -409,7 +424,19 @@ package org.apache.flex.events */ public function get screenY():Number { - return wrappedEvent.screenY; + if(wrappedEvent) return wrappedEvent.screenY; + if (!target) return localY; + return stagePoint.y; + } + private var _stagePoint:Point; + private function get stagePoint():Point + { + if (!_stagePoint) + { + var localPoint:Point = new Point(localX, localY); + _stagePoint = PointUtils.localToGlobal(localPoint, target); + } + return _stagePoint; } /**