[Cuis-dev] Question on Morphic coordinates and transforms
Phil B
pbpublist at gmail.com
Sun Dec 22 08:14:34 PST 2019
Drawing graphical elements of a simple, non-container, Morph are in local
coordinates. Keyboard and mouse events passed to the Morph would also be
in local coordinates.
About the only time when you, or your morph, would need to worry about
internalizing/externalizing is when you are specifically dealing with Morph
containers/containment (i.e. implementing a World, scrolling/virtual views,
etc.) The basic idea is that the parent or child needing to work
inward/outward would convert the coordinates to the local coordinates of
its children/parent so that when they are told to draw or handle input
events they can work in local coordinates, from their perspective.
On Sun, Dec 22, 2019 at 11:02 AM Thierry Goubier via Cuis-dev <
cuis-dev at lists.cuis.st> wrote:
> Hi Ken,
>
> thanks, I noticed that coordinates are local to the morph origin.
>
> But I see code where they are local to the owner origin (and hence the
> reason for Morph>>#externalize, Morph>>#internalize); this also shows
> up in the event processing (where you have all those methods with an
> additional parameter, #localPoint:) and in
> Morph>>#containsPoint:event: where you have a call to #internalize:...
>
> Or is that the Morphic API does not properly isolate the programmer
> from the specifics of the coordinate system used? The API should take
> care of all the internalize/externalize, right?
>
> At the moment, I'm writing quite a lot of code where I have to
> remember to add all those externalize / internalize calls all over the
> place. And I have the feeling I should not have to do that.
>
> Thierry
>
> Le dim. 22 déc. 2019 à 16:48, <ken.dickey at whidbey.com> a écrit :
> >
> > On 2019-12-22 07:16, Thierry Goubier via Cuis-dev wrote:
> > > Dear Cuis-er,
> > >
> > > I'm finding the Cuis Morphic coordinate system interesting, and I want
> > > a suggestion: what code convention do you use to remember your points
> > > are:
> > > - in the world coordinate system,
> > > - in the owner coordinate system,
> > > - in the morph instance coordinate system
> > > - in another referential than the three above (the owner owner
> > > coordinate system, for example) ?
> > >
> > > Regards,
> > >
> > > Thierry
> >
> > SImple.
> >
> > All morph coordinate locations are relative to their container.
> >
> > FYI,
> > -KenD
> --
> Cuis-dev mailing list
> Cuis-dev at lists.cuis.st
> https://lists.cuis.st/mailman/listinfo/cuis-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20191222/c6a9b427/attachment.htm>
More information about the Cuis-dev
mailing list