+ // Forward the MENU_SELECT event to the desired menu
+ // first, to give it a chance to modify its items
+ o.contextMenu.dispatchEvent(e);
+ cm.customItems = o.contextMenu.customItems;
Don't you need to copy over the "builtInItems", too?
+ // If we hit a view with no menu, use the canvas menu as the default
+ if (iobj.contextMenu == null) {
+ return canvas.sprite;
+ } else {
The canvas' context-menu and the default context-menu are different
objects. See LPP-8113 for a testcase.
On 4/28/2009 4:33 AM, Henry Minsky wrote:
again, this is a change against 4.2 branch
I haven't established any performance increase with this change yet, but
it still seems like a good idea to remove the
mouseEnabled=true hack that we had put in place before.
Change 20090427-hqm-Q by [email protected] on 2009-04-27 22:00:56 EDT
in /Users/hqm/openlaszlo/4.2
for http://svn.openlaszlo.org/openlaszlo/branches/4.2
Summary: fix for swf9 context menus, mouseEnabled no longer always set
to true on every sprite
New Features:
Bugs Fixed: LPP-6980
Technical Reviewer: andre
QA Reviewer: max
Doc Reviewer: (pending)
Documentation:
Release Notes:
Details:
+ To work around the original bug (context menus don't work when
mouseEnabled == false on any parent), I created a context menu at the
very top level of the sprite hierarchy. This menu is the only context
menu in the entire application that is active. This is ensured by
having a "right-click-trap" sprite as the immediate child , that has
mouseEnabled = false.
The Laszlo app canvas sprite and its children are children of this
'right click trap' sprite.
+ the onmenuopen event on the active contextmenu is forwarded to the
appropriate view's menu , giving the view a chance to dynamically set
items when menu is opened
+ mouseEnabled is once again false by default for views, and is only
set to true for clickable views. This should hopefully help with the
CPU usage problem.
Tests:
test/contextmenu/api.lzx in swf9
test/contextmenu/lpp-6980.lzx in swf9
Files:
M test/contextmenu/api.lzx
M test/contextmenu/lpp-6980.lzx
M WEB-INF/lps/lfc/kernel/swf9/LFCApplication.as
M WEB-INF/lps/lfc/kernel/swf9/LzSprite.as
Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20090427-hqm-Q.tar