[Laszlo-checkins] r11793 - openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9

hqm@openlaszlo.org hqm at openlaszlo.org
Sat Nov 15 19:04:05 PST 2008


Author: hqm
Date: 2008-11-15 19:04:03 -0800 (Sat, 15 Nov 2008)
New Revision: 11793

Modified:
   openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzSprite.as
Log:
Change 20081115-hqm-l by hqm at badtzmaru.home on 2008-11-15 13:49:21 EST
    in /Users/hqm/openlaszlo/trunk5
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: use hitArea/mouseEnabled hack on all LzSprites

New Features:

Bugs Fixed: LPP-7349

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

Documentation:

Release Notes:

Details:
    
+ I have just set mouseEnabled=true on all LzSprites, and keep the
hitArea = emptySprite on all LzSprite by default.
    
+ When clickable is enabled, the hitArea is removed, and the
SimpleButton is used to catch mouse clicks.

When clickable is disabled, the hitArea=emptySprite is set again.

I don't think this has any noticable performance implications, but I'm
not sure.

Tests:

test case from bug report
lzpix works (with contextmenu attached to <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-16 00:19:46 UTC (rev 11792)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzSprite.as	2008-11-16 03:04:03 UTC (rev 11793)
@@ -132,7 +132,8 @@
               this.isroot = true;
               this.mouseEnabled = true;// @devnote: see LPP-6980
           } else {
-              this.mouseEnabled = false;
+              this.mouseEnabled = true;
+              this.hitArea = LzSprite.emptySprite;
           }
       }
 
@@ -724,10 +725,10 @@
           this.clickable = c;
           this.buttonMode = c;
           this.tabEnabled = false;
-          this.mouseEnabled = c || this.isroot;// @devnote: see LPP-6980
           var cb:SimpleButton = this.clickbutton;
           //trace('sprite setClickable' , c, 'cb',cb);
           if (this.clickable) {
+              this.hitArea = null;
               attachMouseEvents(this);
               // TODO [hqm 2008-01] The Flash Sprite docs 
               // explain how to add a sprite to the tab order using tabEnabled property. 
@@ -756,6 +757,7 @@
                   removeMouseEvents(cb);
                   this.clickbutton = null;
               }
+              this.hitArea = LzSprite.emptySprite;
           }
       }
 
@@ -1323,22 +1325,7 @@
               // where it checks for a resource or bgcolor sprite, in order to make the clickable region
               // 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;
           }



More information about the Laszlo-checkins mailing list