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

Key: LPP-2169
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: P1 P1
Assignee: Mamye Kratt
Reporter: Sarah Allen
Votes: 0
Watchers: 0
Operations

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

setting clip=true when drawview clips, removes non-rectangular mask

Created: 11/Jun/06 08:18 PM   Updated: 12/Sep/06 02:37 PM
Component/s: Laszlo Foundation Classes (LFC)
Affects Version/s: None
Fix Version/s: 3.4

Time Tracking:
Not Specified

File Attachments: 1. Zip Archive LPP-2169_combined.zip (66 kb)


Severity: Minor
Fixed in Change#: 1,537
Runtime: N/A
Fix in hand: False


 Description  « Hide
This behavior was unexpected for me. Maybe if the view already has a mask, clip=true should be a noop

<canvas>
<drawview width="500" height="500" clip="true">
    <method event="onconstruct">
            this.moveTo(100, 100);
            this.lineTo(100, 200);
            this.quadraticCurveTo(150, 250, 200, 200);
            this.closePath();

            this.fillStyle = 0x0000ff;
            this.clip();
    </method>
    <view name="thatIWantClipped" resource="photo.jpg"/>
</drawview>

</canvas>

 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Philip Romanik - 21/Jun/06 10:19 PM
I want to be sure I understand the unexpected behavior. When I run your sample app, I don't see the drawview clip; I see the full image without any mask. Is that what you have been seeing?

I'm attaching a modified file. Can you take a look at it? There are 3 examples. The first is identical to the code in the bug report. The second is similar, although the size of the view is smaller than the image. The third one calls a method, removeMask(), to simulate what I think you'd like to see.

If the third example shows the correct behavior I'll look into modifying LzDrawView to cancel a rectangular mask when clip() is called.

Thanks!

Phil


Philip Romanik - 21/Jun/06 10:21 PM
The third case hopefully shows the desired behavior when a rectangle mask and drawview clip() are present.

Sarah Allen - 22/Jun/06 11:13 AM
Yes, the third case is the desired behavior. It is not intuitive that clip=true means: apply a rectangular mask. If I call this.clip() I would expect clip=true to be a no op.

Philip Romanik - 22/Jun/06 03:24 PM
Patch sent to Henry for review. 2 line change suggested.


Index: LzDrawView.as
===================================================================
--- LzDrawView.as (revision 1059)
+++ LzDrawView.as (working copy)
@@ -145,6 +145,8 @@
 // @keywords private
 //------------------------------------------------------------------------------
 LzDrawView.prototype.clip = function() {
+ if (this.mask)
+ this.removeMask(); // Remove any mask created by clip="true"
     if (this.__LZmaskClip == null){
         this.applyMask(true);
     }

Philip Romanik - 09/Aug/06 10:38 AM
clip() modified to remove any existing mask.

Mamye Kratt - 12/Sep/06 02:37 PM
(LegalsPR3)
Test case now displays properly.