You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by yi...@apache.org on 2022/01/09 15:48:28 UTC
[royale-asjs] branch develop updated: Improve DragBead's behavior when out of screen bounds
This is an automated email from the ASF dual-hosted git repository.
yishayw pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
The following commit(s) were added to refs/heads/develop by this push:
new a39ce62 Improve DragBead's behavior when out of screen bounds
new c7f0724 Merge branch 'develop' of https://github.com/apache/royale-asjs into develop
a39ce62 is described below
commit a39ce626a66347d72879559401e38ef2f602c3f8
Author: Yishay Weiss <yi...@hotmail.com>
AuthorDate: Sun Jan 9 17:48:10 2022 +0200
Improve DragBead's behavior when out of screen bounds
---
.../org/apache/royale/html/beads/DragBead.as | 33 +++++++++++++++++++---
1 file changed, 29 insertions(+), 4 deletions(-)
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/DragBead.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/DragBead.as
index d61e141..bae8843 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/DragBead.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/DragBead.as
@@ -27,6 +27,10 @@ package org.apache.royale.html.beads
import org.apache.royale.core.IChild;
import org.apache.royale.geom.Point;
import org.apache.royale.geom.Rectangle;
+ COMPILE::JS
+ {
+ import org.apache.royale.events.utils.MouseEventConverter;
+ }
/**
* @langversion 3.0
@@ -103,13 +107,26 @@ package org.apache.royale.html.beads
protected function mouseDownHandler(event:MouseEvent):void
{
startingPoint = new Point(event.clientX, event.clientY);
- _host.topMostEventDispatcher.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
- _host.topMostEventDispatcher.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
+ COMPILE::JS
+ {
+ window.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
+ window.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
+ }
+ COMPILE::SWF
+ {
+ _host.topMostEventDispatcher.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
+ _host.topMostEventDispatcher.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
+ }
}
protected function mouseMoveHandler(event:MouseEvent):void
{
+ COMPILE::JS
+ {
+ event = MouseEventConverter.convert(event);
+ }
+
var xDelta:Number = event.clientX - startingPoint.x;
var yDelta:Number = event.clientY - startingPoint.y;
var potentialX:Number = _host.x + xDelta;
@@ -130,8 +147,16 @@ package org.apache.royale.html.beads
protected function mouseUpHandler(event:MouseEvent):void
{
- _host.topMostEventDispatcher.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
- _host.topMostEventDispatcher.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
+ COMPILE::SWF
+ {
+ _host.topMostEventDispatcher.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
+ _host.topMostEventDispatcher.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
+ }
+ COMPILE::JS
+ {
+ window.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
+ window.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
+ }
}
}