Re: [Newbies] Subclassing PasteUpMorph
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 Freudenbergwrote: > On 04.05.2016, at 19:48, Michael Rice 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@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@0. > > > > still places it in the upper left corner. > > > > How do I get the origin, 0@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@lists.squeakfoundation.org > http://lists.squeakfoundation.org/mailman/listinfo/beginners > > ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Subclassing PasteUpMorph
On 04.05.2016, at 19:48, Michael Ricewrote: > > 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@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@0. > > still places it in the upper left corner. > > How do I get the origin, 0@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 - smime.p7s Description: S/MIME cryptographic signature ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
[Newbies] Subclassing PasteUpMorph
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@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@0. still places it in the upper left corner. How do I get the origin, 0@0, at the center? My only other method, so far, sets my subclass default bounds. defaultBounds "answer the default bounds for the receiver" ^ 0 @ 0 corner: 400 @ 400 ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners