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/04/13 11:33:09 UTC

[royale-asjs] branch develop updated: Emulation - make sure menus are hidden correctly when dp is an Array

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 573da7afd7 Emulation - make sure menus are hidden correctly when dp is an Array
573da7afd7 is described below

commit 573da7afd757a2d6e22c4f283ad4f48d4e3ea9c5
Author: Yishay Weiss <yi...@hotmail.com>
AuthorDate: Wed Apr 13 14:33:00 2022 +0300

    Emulation - make sure menus are hidden correctly when dp is an Array
---
 .../CascadingMenuSelectionMouseController.as       | 33 +++++++++++++++-------
 1 file changed, 23 insertions(+), 10 deletions(-)

diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/controllers/CascadingMenuSelectionMouseController.as b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/controllers/CascadingMenuSelectionMouseController.as
index 5e5ea69d12..8f627dbad7 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/controllers/CascadingMenuSelectionMouseController.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/controllers/CascadingMenuSelectionMouseController.as
@@ -37,6 +37,7 @@ package mx.controls.beads.controllers
 	import org.apache.royale.html.beads.models.MenuModel;
 	import org.apache.royale.utils.PointUtils;
 	import org.apache.royale.geom.Point;
+	import mx.collections.ArrayCollection;
 
 /**
  *  The CascadingMenuSelectionMouseController is the default controller for emulation cascading menu
@@ -115,21 +116,33 @@ package mx.controls.beads.controllers
 		 */
 		override protected function getMenuWithDataProvider(menuList:Array, dp:Object):IMenu
 		{
-			if (!(dp is XMLListCollection))
+			if (dp is XMLListCollection)
 			{
-				return super.getMenuWithDataProvider(menuList, dp);
-			}
-			var xmlListCollection:XMLListCollection = dp as XMLListCollection;
-			// go over open menus and return the one with the given data provider
-			for (var i:int = 0; i < menuList.length; i++)
+				var xmlListCollection:XMLListCollection = dp as XMLListCollection;
+				// go over open menus and return the one with the given data provider
+				for (var i:int = 0; i < menuList.length; i++)
+				{
+					var cascadingMenu:IMenu = menuList[i] as IMenu;
+					if (cascadingMenu && (cascadingMenu.dataProvider as XMLListCollection).toXMLString() == xmlListCollection.toXMLString())
+					{
+						return cascadingMenu;
+					}
+				}
+				return null;
+			} else if (dp is Array)
 			{
-				var cascadingMenu:IMenu = menuList[i] as IMenu;
-				if (cascadingMenu && (cascadingMenu.dataProvider as XMLListCollection).toXMLString() == xmlListCollection.toXMLString())
+				for (i = 0; i < menuList.length; i++)
 				{
-					return cascadingMenu;
+					cascadingMenu = menuList[i] as IMenu;
+					if (dp == (cascadingMenu.dataProvider as ArrayCollection).source)
+					{
+						return cascadingMenu;
+					}
 				}
+				return null;
+			} else {
+				return super.getMenuWithDataProvider(menuList, dp);
 			}
-			return null;
 		}
 
 		override protected function getParentMenuBar():IEventDispatcher