[Laszlo-checkins] r13151 - openlaszlo/trunk/lps/components/extensions

bargull@openlaszlo.org bargull at openlaszlo.org
Wed Mar 4 02:52:56 PST 2009


Author: bargull
Date: 2009-03-04 02:52:53 -0800 (Wed, 04 Mar 2009)
New Revision: 13151

Modified:
   openlaszlo/trunk/lps/components/extensions/drawview.lzx
Log:
Change 20090304-bargull-0Bp by bargull at dell--p4--2-53 on 2009-03-04 02:53:21
    in /home/Admin/src/svn/openlaszlo/trunk
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: fix contextmenu for drawview

New Features:

Bugs Fixed: LPP-7823 (context menu on drawview)

Technical Reviewer: hminsky
QA Reviewer: (pending)
Doc Reviewer: (pending)

Documentation:

Release Notes:

Details:
- set "owner"-property on HTML5 canvas in dhtml, required for dhtml-kernel context-menu detection
- set context-menu on "context"-movieclip (init()) and "__bitmapmc"-movieclip (rebuildBitmap())
- override contextmenu-setter to apply/remove context-menu to "context" and "__bitmapmc"

    

Tests:
testcase at bugreport



Modified: openlaszlo/trunk/lps/components/extensions/drawview.lzx
===================================================================
--- openlaszlo/trunk/lps/components/extensions/drawview.lzx	2009-03-04 10:50:42 UTC (rev 13150)
+++ openlaszlo/trunk/lps/components/extensions/drawview.lzx	2009-03-04 10:52:53 UTC (rev 13151)
@@ -576,6 +576,7 @@
                 //Debug.write('_buildcanvas', this.__id, width, height);
 
                 this.__LZcanvas = document.createElement('canvas');
+                this.__LZcanvas.owner = this.sprite;
                 this.__LZcanvas.setAttribute('id', this.__id);
                 this.__LZcanvas.setAttribute('width', width);
                 this.__LZcanvas.setAttribute('height', height);
@@ -1006,6 +1007,9 @@
                     this.__drawing = drawcontainer.createEmptyMovieClip("drawing", drawcontainer.getNextHighestDepth());
 
                     context = drawcontainer;
+                    // Install right-click context menu if there is one
+                    var cmenu:LzContextMenu = this.sprite['__contextmenu'];
+                    if (cmenu) context.menu = cmenu.kernel.__LZcontextMenu();
                 }
                 this.context = context;
                 this.beginPath();
@@ -1370,8 +1374,29 @@
                     this.__bitmapdata = new flash.display.BitmapData(this.width, this.height, true, 0x000000ff);
                     // negative dimensions cause this to be null
                     if (this['__bitmapdata']) this.__bitmapmc.attachBitmap(this.__bitmapdata, 2, "auto", true);
+                    // Install right-click context menu if there is one
+                    var cmenu:LzContextMenu = this.sprite['__contextmenu'];
+                    if (cmenu) this.__bitmapmc.menu = cmenu.kernel.__LZcontextMenu();
                 }
 
+                override function $lzc$set_contextmenu (cmenu:LzContextMenu) :void {
+                    if (this['__bitmapmc']) {
+                        if (cmenu) {
+                            this.__bitmapmc.menu = cmenu.kernel.__LZcontextMenu();
+                        } else {
+                            delete this.__bitmapmc.menu;
+                        }
+                    }
+                    if (this.context) {
+                        if (cmenu) {
+                            this.context.menu = cmenu.kernel.__LZcontextMenu();
+                        } else {
+                            delete this.context.menu;
+                        }
+                    }
+                    super.$lzc$set_contextmenu(cmenu);
+                }
+
                 override function $lzc$set_width(w) {
                     this.__measurewidth = (w == null);
                     super.$lzc$set_width(w);



More information about the Laszlo-checkins mailing list