[Newbies] Subclassing PasteUpMorph

Michael Rice limitcase at gmail.com
Fri May 6 17:00:19 UTC 2016


A morph is a morph, of course, of course
Unless the morph is an Etoys morph

Got it. Thanks!

On Fri, May 6, 2016 at 10:33 AM, Bert Freudenberg <bert at freudenbergs.de>
wrote:

> On 04.05.2016, at 19:48, Michael Rice <limitcase at gmail.com> wrote:
> >
> > I'm experimenting with subclassing PasteUpMorph to get some additional
> behavior. One thing I want to do is have my subclass open with a
> CircleMorph at 0 at 0. I already get that behavior, the CircleMorph in the
> upper left corner, but want my subclass' origin to be at its center, and
> the CircleMorph drawn there. My current initialize method,
> >
> > initialize
> >       ""
> >
> >       super initialize.
> >       self originAtCenter; addMorph: ((CircleMorph new) color: Color
> white) centeredNear: 0 at 0.
> >
> > still places it in the upper left corner.
> >
> > How do I get the origin, 0 at 0, at the center?
>
> You could use
>
>         circle x: 0 y: 0.
>
> The originAtCenter flag only affects the PasteUpMorph’s cartesianOrigin
> which is used by Etoys (via the x/y methods) and puts the origin at either
> its lowerLeft corner or its center, just as in Math (and unlike Squeak).
>
> That said, Morphic currently does not use a fully transform-based graphics
> engine. You cannot easily transform the coordinate system for submorphs.
> Etoys gets around this by applying the origin offset in its x/y accessors
> (which also flip the y direction from downwards to upwards).
>
> - Bert -
>
>
>
>
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20160506/127a3934/attachment.htm


More information about the Beginners mailing list