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 [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
On 04.05.2016, at 19:48, Michael Rice <[hidden email]> 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? 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 [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners smime.p7s (5K) Download Attachment |
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 <[hidden email]> wrote: On 04.05.2016, at 19:48, Michael Rice <[hidden email]> wrote: _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
Free forum by Nabble | Edit this page |