[Cuis-dev] Clipping morph

Juan Vuletich juan at jvuletich.org
Mon Jun 7 07:37:21 PDT 2021


Hi Hilaire,

On 6/5/2021 5:47 AM, Hilaire Fernandes via Cuis-dev wrote:
>
> Hi,
>
> The behavior of Morph clipping has changed.
>
> When I set my drawable canvas clipsSubmorphs to true, there is no 
> drawing appearing.
>

I guess you mean your morph. #ClipsSubmorphs is implemented by morphs, 
not by the canvas.

> I took a look at:
>
> MorphicCanvas>>clippingByCurrentMorphDo: aBlock
>
>     * my drawable answers true to clipsSubmorphsReally
>

You should not redefine this method. Your morph should only define 
#clipsSubmorphs.

>     * the clipRect attribute meets the bounds of the drawable
>
> Not sure what is is happening.
>
> Thanks
>
> Hilaire
>
> -- 
> GNU Dr. Geo
> http://drgeo.eu
> http://blog.drgeo.eu

Let's try a simple example in a Workspace.

"Pull repo"
ChangeSet installNewUpdates.
Feature require: 'VectorGraphics'.
m1 := M3Exp01Morph new.
m2 := M3Exp02Morph new.
m1 addMorph: m2.
m1 openInWorld

This opens a m1 happy face, covered by an unclipped round rectangle. 
Zoom it with the halo handle. Then, using the middle button, open the 
halo of the inner M3Exp02Morph. Make it smaller, so the round rectangle 
partially covers the smiley. Now add this method to M3Exp01Morph:

clipsSubmorphs
     ^true

and Restore Display. You can see the red interior and green border of 
the inner morph, clipped to the happy M3Exp01Morph.

Vector canvas can clip morphs to the arbitrary shape of the outer morph. 
But it has a limitation: In a containment branch, there can be only one 
morph that clips submorphs. Do you need more than one clipping morph? 
Can you provide an example showing the problem you see, so I can 
reproduce it?

Thanks,

-- 
Juan Vuletich
www.cuis-smalltalk.org
https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev
https://github.com/jvuletich
https://www.linkedin.com/in/juan-vuletich-75611b3
@JuanVuletich

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20210607/88027aff/attachment.htm>


More information about the Cuis-dev mailing list