[Cuis-dev] Clipping operation

Thierry Goubier thierry.goubier at gmail.com
Thu Apr 30 04:36:07 PDT 2020


I had a similar issue, and what I did is to create an InsideMorph, as
a subclass of Morph.

a ViewportMorph is at the same level than scrollbars (in my case), and
has a single submorph: an InsideMorph. The InsideMorph can have many
submorphs.
The ViewportMorph clips the InsideMorph. Like that, the submorphs of
the InsideMorph are all clipped to the ViewportMorph bounds.

InsideMorph has only two methods: #drawOn: (that does nothing, but
turns off the Morph drawing code), and #morphExtent which returns its
owner extent (ViewportMorph).

Thierry

Le jeu. 30 avr. 2020 à 11:39, Hilaire Fernandes via Cuis-dev
<cuis-dev at lists.cuis.st> a écrit :
>
> The more I look the more it looks odd and I may have to handle it differently.
>
> The DrGeo canvas has both drawing operations and submorphs:
>
> operations to draw the axes, graduations and grid, I can get those drawings clipped by adding the canvas to a morph responding true to clipsLastSubmorph message
> submorphs added to the canvas, those are lines, circles, polyline, locus to represent the geometric items. I like to use morph for this, it is a good level of abstraction, easier to interact with for debugging and optimizing, particularly for the locus. They all require to be clipped too, to the canvas bounds. From my understanding, I think I have a problem here with the clipsLastSubmorphh pardigm and I may need a dedicated MorphicCanvas.
>
> Hilaire
>
> Le 30/04/2020 à 10:28, Thierry Goubier via Cuis-dev a écrit :
>
> in Cuis, Submorph clipping only happens for one submorph, and only if aMorph>>#clippedSubmorph is true (and that clips to the parent morph, so, if your wheel morphs are submorphs of your overall frame, then incorrect clipping for the clipped submorph).
>
> In a case like yours, you will probably need to add a morph that do nothing but clipping, to ensure that the morph you are drawing in has the exact same bounds as its parents.
>
> --
> GNU Dr. Geo
> http://drgeo.eu
>
> --
> Cuis-dev mailing list
> Cuis-dev at lists.cuis.st
> https://lists.cuis.st/mailman/listinfo/cuis-dev


More information about the Cuis-dev mailing list