This is an automated email from the ASF dual-hosted git repository.
aharui 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 d3311f9 Need an MX-specific fix that uses SystemManager because
host.height is 0. Should fix #716
d3311f9 is described below
commit d3311f9f7aab4c10528d467e5f47b77be58e4964
Author: Alex Harui <[email protected]>
AuthorDate: Sat Feb 15 16:49:02 2020 -0800
Need an MX-specific fix that uses SystemManager because host.height is 0.
Should fix #716
---
.../MXRoyale/src/main/resources/defaults.css | 2 +-
.../MXRoyale/src/main/royale/MXRoyaleClasses.as | 1 +
.../menuClasses/CascadingMenuWithOnScreenCheck.as | 59 ++++++++++++++++++++++
3 files changed, 61 insertions(+), 1 deletion(-)
diff --git a/frameworks/projects/MXRoyale/src/main/resources/defaults.css
b/frameworks/projects/MXRoyale/src/main/resources/defaults.css
index cfd625d..e2eef1f 100644
--- a/frameworks/projects/MXRoyale/src/main/resources/defaults.css
+++ b/frameworks/projects/MXRoyale/src/main/resources/defaults.css
@@ -58,7 +58,7 @@ Basic|CascadingMenu
IItemRenderer:
ClassReference("mx.controls.menuClasses.CascadingMenuItemRenderer");
IDataProviderItemRendererMapper:
ClassReference("mx.controls.listClasses.DataItemRendererFactoryForICollectionViewData");
IBeadController:
ClassReference("mx.controls.beads.controllers.CascadingMenuSelectionMouseController");
- IMenu:
ClassReference("org.apache.royale.html.CascadingMenuWithOnScreenCheck");
+ IMenu:
ClassReference("mx.controls.menuClasses.CascadingMenuWithOnScreenCheck");
}
Basic|ComboBoxList
diff --git a/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as
b/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as
index e519b85..862b1ca 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as
@@ -257,6 +257,7 @@ internal class MXRoyaleClasses
import mx.controls.menuClasses.MenuBarItemRenderer; MenuBarItemRenderer;
import mx.controls.menuClasses.CascadingMenuItemRenderer;
CascadingMenuItemRenderer;
+ import mx.controls.menuClasses.CascadingMenuWithOnScreenCheck;
CascadingMenuWithOnScreenCheck;
import mx.containers.beads.FormItemView; FormItemView;
import mx.containers.beads.FormItemContainer; FormItemContainer;
diff --git
a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/menuClasses/CascadingMenuWithOnScreenCheck.as
b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/menuClasses/CascadingMenuWithOnScreenCheck.as
new file mode 100644
index 0000000..8df55b9
--- /dev/null
+++
b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/menuClasses/CascadingMenuWithOnScreenCheck.as
@@ -0,0 +1,59 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 mx.controls.menuClasses
+{
+import org.apache.royale.core.IUIBase;
+import org.apache.royale.html.CascadingMenu;
+import org.apache.royale.utils.UIUtils;
+import mx.managers.SystemManager;
+
+ /**
+ * The CascadingMenuWithOnScreenCheck handles cascading menus in
MXRoyale
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+
+ public class CascadingMenuWithOnScreenCheck extends CascadingMenu
+ {
+ public function CascadingMenuWithOnScreenCheck()
+ {
+ super();
+ }
+
+ override public function show(component:IUIBase,
xoffset:Number=0, yoffset:Number=0):void
+ {
+ var host:SystemManager =
UIUtils.findPopUpHost(component).popUpParent as SystemManager;
+ // save the parent dimensions because when the menu is
added it can change the
+ // dimensions
+ var pw:Number = host.screen.width;
+ var ph:Number = host.screen.height;
+ super.show(component, xoffset, yoffset);
+ // check to see if we fit in the parent
+ if (y + height > ph)
+ {
+ y = ph - height;
+ }
+ }
+ }
+
+}