History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: LPP-5636
Type: Bug Bug
Status: RetestBranch RetestBranch
Resolution: Fixed
Priority: P0 P0
Assignee: Unassigned
Reporter: John Yen
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
OpenLaszlo

Context-Menu doesn't work for the view with image resource

Created: 19/Mar/08 01:29 PM   Updated: 27/Mar/08 10:23 AM
Component/s: Kernel - swf6-8, LFC - Context Menu
Affects Version/s: Freya
Fix Version/s: RingDing (4.1), Mars

Time Tracking:
Not Specified

File Attachments: None
Image Attachments:

1. context_image.png
(53 kb)

2. face.png
(2 kb)

3. logo.gif
(2 kb)

Severity: Minor
Fixed in Change#: 8,424
Runtime: SWF7, SWF8
Flags: Support, Regression
Fix in hand: False


 Description  « Hide


The context menu doesn't work for the image resource part of the view.
When we click the background part, new items show perfectly, the issue is only happen when we click on the image part.
(please see attached screen shoot)

This is the test case I use:

<canvas>
    <view width="300" height="100" bgcolor="blue" resource="ol_logo_small.gif">
        <handler name="oninit">
                var cm = new LzContextMenu();
                cm.addItem(cm.makeMenuItem('new item 1'));
                cm.addItem(cm.makeMenuItem('new item 2'));
                setContextMenu(cm);
        </handler>
    </view>
</canvas>




 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
André Bargull - 20/Mar/08 01:56 PM
> canvas.subviews[0].sprite.getMCRef().menu = canvas.subviews[0].sprite.__LZbgRef.menu
This attaches the menu to the image, so what do we need to update in the swf-kernel?

- LzSprite#setContextMenu(..):
set the menu to the '__LZbgRef' and to the 'getMCRef'-movieclip

- LzMakeLoadSprite.updateAfterLoad(..)
set the menu (if any) to the 'getMCRef'-movieclip

Needs some testing b/c loading image<>sound and proxied<>non-proxied is a bit different.

Henry Minsky - 20/Mar/08 02:34 PM
The kernel needs to set the "menu" property on the movieclip which has the image resource in it, I believe.

André Bargull - 20/Mar/08 02:42 PM
> The kernel needs to set the "menu" property on the movieclip which has the image resource in it, I believe.

Yes, this is my 'getMCRef'-movieclip. My only concerns are about what this movieclip 'can be'. Normally, we expect that it is a plain movieclip, but for non-proxied sound-loading, it is an instance of 'SoundMC', for example.

Antun Karlovac - 25/Mar/08 10:04 AM
Hey all,

FYI, this is a regression between 4.0.5.2 and 4.0.10.

-Antun

André Bargull - 25/Mar/08 11:01 AM
> FYI, this is a regression between 4.0.5.2 and 4.0.10.
Most likely due to the same reason as in LPP-5533.

Henry Minsky - 25/Mar/08 06:22 PM
I am looking at how to copy the menu from any existing movie clip to the clip which contains the resource.
I think this copy operation should happen after any new resource clip is loaded, so the menu, if it exists,
is consistently present on the view even when the resource changes.


I think at one point we had thought about having a special movie clip just to catch right menu clicks, that would be
the only way to catch them if there is no resource and no movieclip for the bgcolor.


Henry Minsky - 25/Mar/08 06:27 PM
Bleh, I see four references to this.__LZrightmenuclip in the LzSprite.as class, but it is never actually created by anyone.

Henry Minsky - 25/Mar/08 06:43 PM
out for review

Henry Minsky - 25/Mar/08 06:45 PM
The fix I sent out for review does not cover one case; if a new image is loaded via setSource, there is no code which automatically will copy the menu that was on the sprite's movieclips over to the new movieclip.

The user can work around that by manually calling setContextMenu when the onload event comes back from
the image load, but we should have the media loader do this automatically.

André Bargull - 26/Mar/08 05:55 AM
> The fix I sent out for review does not cover one case; if a new image is loaded via setSource, there is no code which automatically will copy
> the menu that was on the sprite's movieclips over to the new movieclip.

Will you create a new changeset for that case? If you plan to do so, I'm not going to review the current change, instead I'll wait for next one.

Henry Minsky - 26/Mar/08 07:05 AM
See LPP-5670

r8424 | hqm | 2008-03-26 11:01:54 -0400 (Wed, 26 Mar 2008) | 63 lines
Changed paths:
   M /openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzMakeLoadSprite.as
   M /openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzSprite.as

Change 20080326-hqm-F by hqm@badtzmaru.local on 2008-03-26 10:42:53 EDT
    in /Users/hqm/openlaszlo/trunk4/WEB-INF/lps/lfc
    for http://svn.openlaszlo.org/openlaszlo/trunk/WEB-INF/lps/lfc

Summary: fix for context-menu bug on views with image resource

New Features:

Bugs Fixed: LPP-5636, LPP-5670

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

Documentation:

Release Notes:

Details:

+ Made setContextMenu set the menu on the foreground movieclip if
there is one
+ Made setResource copy the previous resource movieclip's menu to the
new resource movieclip.
  If there was not a menu property on the foreground movieclip, try
copying the menu property from the
  background-color movieclip.




Tests:

test case from bug report, right click over image area shows same menu
as over background area.

I used this test case, placed in the test/ directory, so as to access
the resource in
test/resources/gif/logo.gif


<canvas>
    <view width="300" height="100" bgcolor="blue" resource="resources/gif/logo.gif">
        <handler name="oninit">
                var cm = new LzContextMenu();
                cm.addItem(cm.makeMenuItem('new item 1'));
                cm.addItem(cm.makeMenuItem('new item 2'));
                setContextMenu(cm);
        </handler>
        <handler name="onclick">
          this.setSource("resources/png/face.png");
        </handler>
        
    </view>
</canvas>

Click right on image and background areas to verify that image and background have custom context menu
Click left on view to load new resource
Click right on image and background areas to verify that image and background have the custom context menu





Amy Muntz - 26/Mar/08 07:30 AM
Please merge to pagan-deities.

Mamye Kratt - 27/Mar/08 09:29 AM
(pagan-deities branch build r8434 - mars rc/4.0.11)

This change is not in the pagan-deities branch. I thought it was a requirement for 4.0.11.

Mamye Kratt - 27/Mar/08 09:34 AM
Test 1:
<canvas>
    <view width="300" height="200" bgcolor="blue" resource="logo.gif">
        <handler name="oninit">
                var cm = new LzContextMenu();
                cm.addItem(cm.makeMenuItem('new item 1'));
                cm.addItem(cm.makeMenuItem('new item 2'));
                setContextMenu(cm);
        </handler>
    </view>
</canvas>

Test 2:
<canvas>
    <view width="300" height="200" bgcolor="blue" resource="logo.gif">
        <handler name="oninit">
                var cm = new LzContextMenu();
                cm.addItem(cm.makeMenuItem('new item 1'));
                cm.addItem(cm.makeMenuItem('new item 2'));
                setContextMenu(cm);
        </handler>
        <handler name="onclick">
          this.setSource("resources/png/face.png");
        </handler>
        
    </view>
</canvas>

logo.gif:
test/resources/gif/logo.gif or attached


Mamye Kratt - 27/Mar/08 10:22 AM
(pagan-deities branch build r8436 - mars rc/4.0.11)

Was missing png file. This working now.

Mamye Kratt - 27/Mar/08 10:22 AM
<canvas>
      <view width="300" height="100" bgcolor="blue" resource="resources/gif/logo.gif">
          <handler name="oninit">
                  var cm = new LzContextMenu();
                  cm.addItem(cm.makeMenuItem('new item 1'));
                  cm.addItem(cm.makeMenuItem('new item 2'));
                  setContextMenu(cm);
          </handler>
          <handler name="onclick">
            this.setSource("resources/png/face.png");
          </handler>
          
      </view>
  </canvas>

Mamye Kratt - 27/Mar/08 10:23 AM
Test in trunk