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 2021/07/29 21:25:23 UTC
[royale-asjs] branch develop updated: Experimental VDividedBox.
Reference #1137
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 af2fd31 Experimental VDividedBox. Reference #1137
af2fd31 is described below
commit af2fd3124c7d5506d5e90fb119a47a45c56d23b8
Author: Yishay Weiss <yi...@hotmail.com>
AuthorDate: Fri Jul 30 00:25:09 2021 +0300
Experimental VDividedBox. Reference #1137
---
.../src/main/royale/mx/containers/VDividedBox.as | 30 ++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/VDividedBox.as b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/VDividedBox.as
index 5620de8..f903016 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/VDividedBox.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/VDividedBox.as
@@ -76,6 +76,7 @@ public class VDividedBox extends DividedBox
//
//--------------------------------------------------------------------------
+ import org.apache.royale.events.MouseEvent;
/**
* Constructor.
*
@@ -88,8 +89,37 @@ public class VDividedBox extends DividedBox
{
super();
typeNames = "VDividedBox";
+ super.direction = "vertical";
+ addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
}
+ protected function mouseDownHandler(event:MouseEvent):void
+ {
+ if (event.target != this)
+ {
+ return;
+ }
+ addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
+ topMostEventDispatcher.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
+ }
+
+ protected function mouseUpHandler(event:MouseEvent):void
+ {
+ removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
+ topMostEventDispatcher.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
+ }
+
+ protected function mouseMoveHandler(event:MouseEvent):void
+ {
+ var h1:int = Math.floor(100 * event.localY / height);
+ h1 = Math.min(h1, 95);
+ h1 = Math.max(h1, 5);
+ getChildAt(0).percentHeight = h1;
+ getChildAt(1).percentHeight = 100 - h1;
+ _layout.layout();
+ }
+
+
//--------------------------------------------------------------------------
//
// Overridden properties