[Laszlo-checkins] r11782 - in openlaszlo/trunk: WEB-INF/lps/lfc/kernel/swf9 test/contextmenu

hqm@openlaszlo.org hqm at openlaszlo.org
Fri Nov 14 12:54:36 PST 2008


Author: hqm
Date: 2008-11-14 12:54:33 -0800 (Fri, 14 Nov 2008)
New Revision: 11782

Added:
   openlaszlo/trunk/test/contextmenu/lpp-6980.lzx
   openlaszlo/trunk/test/contextmenu/over-input.lzx
Modified:
   openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzSprite.as
Log:
Change 20081113-hqm-g by hqm at badtzmaru.home on 2008-11-13 23:48:45 EST
    in /Users/hqm/openlaszlo/trunk5
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: fix for contextmenu bug

New Features:

Bugs Fixed: LPP-6980

Technical Reviewer: max
QA Reviewer: andre
Doc Reviewer: (pending)

Documentation:

Release Notes:

Details:

+ If you set the "hitArea" property of Sprite to an empty sprite which is not
on the display list, then the sprite becomes transparent to mouse clicks.
This can be used to counteract the effect of setting mouseEnabled=true, 
which is needed to make the context menus work.

Tests:

lzpix (added contextmenu to the <photo> class)
test/contextmenu/lpp-6980.lzx
test/contextmenu/over-input.lzx




Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzSprite.as
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzSprite.as	2008-11-14 20:46:45 UTC (rev 11781)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzSprite.as	2008-11-14 20:54:33 UTC (rev 11782)
@@ -60,6 +60,10 @@
       var skiponload = false;
       var baseurl;
 
+      // Used for workaround for contextmenu bug; use as a null hitArea for sprites that
+      // we don't want to get mouse events.
+      public static var emptySprite:Sprite = new Sprite();
+
       // If null, the handcursor visibility is set to the value of LzMouseKernel.showhandcursor
       // whenevent a mouseover event happens.
       public var showhandcursor:* = null;
@@ -1320,7 +1324,21 @@
               // match what the user expects.
 
               // TODO: [20080914 anba] blocked by LPP-6980
+              var par = this;
+              while(par is Sprite) {
+                  par.mouseEnabled = true;
 
+                  // This hack turns off mouse events on sprites that
+                  // are not set as clickable, by setting 'hitArea' to
+                  // a zero size empty Sprite which is not on the
+                  // display list.
+                  if (par is LzSprite && !par.clickable) {
+                      par.hitArea = LzSprite.emptySprite;
+                  }
+
+                  par = par.parent;
+              }
+
               // "contextMenu" is a swf9 property on flash.display.Sprite
               this.contextMenu = cmenu;
           }

Added: openlaszlo/trunk/test/contextmenu/lpp-6980.lzx


Property changes on: openlaszlo/trunk/test/contextmenu/lpp-6980.lzx
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Added: openlaszlo/trunk/test/contextmenu/over-input.lzx


Property changes on: openlaszlo/trunk/test/contextmenu/over-input.lzx
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native



More information about the Laszlo-checkins mailing list