How to rescale child Morph when father does ?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How to rescale child Morph when father does ?

Nicola Mingotti
Hi,

Considering this short snippet:
-------------------
"Prepare the rectangle containing the drawing."
r := RectangleMorph new.
r extent: 500@500.
r openInWindow.

p := PolygonMorph
         vertices: {(r left)@(r top). (r right)@(r bottom)}
         color: Color white borderWidth: 2 borderColor: Color white.

r addMorph: p.
--------------------

1] I see that the PolygonMorph 'p' translates with its father the RectangleMorph 'r'. Ok, as expected.

2] If I rescale 'r' with the Halo yellow button, 'p' is not rescaled and the effect is unexpected.

How can I make 'p' rescale with its father ?

bye
Nicola







_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
jrm
Reply | Threaded
Open this post in threaded view
|

Re: How to rescale child Morph when father does ?

jrm
Nicola,

This command will rescale the polygonMorph. I am not sure how it is used in your example.

1. Run your sample code and create the rectangle.
2. Use the Halo to resize the parent and make sure to maintain the aspect ratio
3. Launch Explore from the Halo. 
4. Find the polygon submorph and select it.
5. In the code space at the bottom of the Explorer do "self bounds: self owner bounds"

Probably not much help, but perhaps a hint to something that will.

-jrm

On Tue, Jul 30, 2019 at 12:43 AM Nicola Mingotti <[hidden email]> wrote:
Hi,

Considering this short snippet:
-------------------
"Prepare the rectangle containing the drawing."
r := RectangleMorph new.
r extent: 500@500.
r openInWindow.

p := PolygonMorph
         vertices: {(r left)@(r top). (r right)@(r bottom)}
         color: Color white borderWidth: 2 borderColor: Color white.

r addMorph: p.
--------------------

1] I see that the PolygonMorph 'p' translates with its father the RectangleMorph 'r'. Ok, as expected.

2] If I rescale 'r' with the Halo yellow button, 'p' is not rescaled and the effect is unexpected.

How can I make 'p' rescale with its father ?

bye
Nicola







_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: How to rescale child Morph when father does ?

Nicola Mingotti

Hi John,

Thank you for your suggestion.

In StackOverflow a guy suggested something else and also has given me some hints on how to look for solutions myself. See here: https://stackoverflow.com/questions/57269261/how-to-rescale-submorph-when-the-container-does/57279752#57279752

It will take me a while to solve this, there are still a lot of more fundamental things that i do not know and I need to get them sorted out.

bye
Nicola







On 8/2/19 8:36 PM, John-Reed Maffeo wrote:
Nicola,

This command will rescale the polygonMorph. I am not sure how it is used in your example.

1. Run your sample code and create the rectangle.
2. Use the Halo to resize the parent and make sure to maintain the aspect ratio
3. Launch Explore from the Halo. 
4. Find the polygon submorph and select it.
5. In the code space at the bottom of the Explorer do "self bounds: self owner bounds"

Probably not much help, but perhaps a hint to something that will.

-jrm

On Tue, Jul 30, 2019 at 12:43 AM Nicola Mingotti <[hidden email]> wrote:
Hi,

Considering this short snippet:
-------------------
"Prepare the rectangle containing the drawing."
r := RectangleMorph new.
r extent: 500@500.
r openInWindow.

p := PolygonMorph
         vertices: {(r left)@(r top). (r right)@(r bottom)}
         color: Color white borderWidth: 2 borderColor: Color white.

r addMorph: p.
--------------------

1] I see that the PolygonMorph 'p' translates with its father the RectangleMorph 'r'. Ok, as expected.

2] If I rescale 'r' with the Halo yellow button, 'p' is not rescaled and the effect is unexpected.

How can I make 'p' rescale with its father ?

bye
Nicola







_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners