Morphic

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

Morphic

d3orn
Hey there,
I'm currently working on a Morph holding different submorphs and now I would like to create something like a minimap of this supermorph holding a representation of the submorphs.
Therefore I created a x: 200 and y: displaywidth morph
now I would like to copy the supermorph and scaling down his width to 200 and then center it inside the minimapMorph..
This is very the problems starts^^
I therefore create a new Morph and adding all the submorphs to this, then I calculate the factor (supermorph width / 200)
now I would like to scale the supermorph copy and all it's submorphs but I don't know exactly how I could do this...
Any help would be very nice
thx
Reply | Threaded
Open this post in threaded view
|

Re: Morphic

Ricardo Moran
Hi,

I think you can do it by adding a flex shell to your morph and then changing the extent of the shell. Something like this:

t := morph addFlexShell.
t extent: 100@100.

Cheers
Richo

On Sat, Oct 9, 2010 at 3:13 PM, d3orn <[hidden email]> wrote:

Hey there,
I'm currently working on a Morph holding different submorphs and now I would
like to create something like a minimap of this supermorph holding a
representation of the submorphs.
Therefore I created a x: 200 and y: displaywidth morph
now I would like to copy the supermorph and scaling down his width to 200
and then center it inside the minimapMorph..
This is very the problems starts^^
I therefore create a new Morph and adding all the submorphs to this, then I
calculate the factor (supermorph width / 200)
now I would like to scale the supermorph copy and all it's submorphs but I
don't know exactly how I could do this...
Any help would be very nice
thx
--
View this message in context: http://forum.world.st/Morphic-tp2969771p2969771.html
Sent from the Squeak - Dev mailing list archive at Nabble.com.




Reply | Threaded
Open this post in threaded view
|

Re: Morphic

d3orn
the problem with extent is, that is will only scale the supermorph to a given size (for example 200) but I have to scale all the submorphs with the same "factor" too
Reply | Threaded
Open this post in threaded view
|

Re: Morphic

Darius Clarke
PerhapsĀ iteratingĀ over the submorphs...

morph submorphsDo: [:aMorph |
aMorph extent: 200 ].

On Sat, Oct 9, 2010 at 12:08 PM, d3orn <[hidden email]> wrote:

the problem with extent is, that is will only scale the supermorph to a given
size (for example 200) but I have to scale all the submorphs with the same
"factor" too

--
View this message in context: http://forum.world.st/Morphic-tp2969771p2969801.html
Sent from the Squeak - Dev mailing list archive at Nabble.com.




Reply | Threaded
Open this post in threaded view
|

Re: Morphic

Ricardo Moran
In reply to this post by d3orn
Yes, I know. That's why I suggest you to wrap a flex shell on the morph, because it takes care of the submorph scaling for you. Try executing this on a workspace:

m := Morph new openInWorld extent: 300@300.
m addMorph: (RectangleMorph new extent: 200@200).
m addMorph: (EllipseMorph new extent: 100@100).

And then this:

t := m addFlexShell.
t extent: 100@100

You'll see that the three morphs get scaled correctly.

Cheers
Richo

On Sat, Oct 9, 2010 at 4:08 PM, d3orn <[hidden email]> wrote:

the problem with extent is, that is will only scale the supermorph to a given
size (for example 200) but I have to scale all the submorphs with the same
"factor" too

--
View this message in context: http://forum.world.st/Morphic-tp2969771p2969801.html
Sent from the Squeak - Dev mailing list archive at Nabble.com.




Reply | Threaded
Open this post in threaded view
|

Re: Morphic

d3orn
oh that's just awesome that's exactly what I need
thx a lot!
Reply | Threaded
Open this post in threaded view
|

Re: Morphic

d3orn
Now the only thing missing is that the t should be a copy of m so that m is big and t is scaled^^
but this doesn't work for my with the submorphs
and for my case I do get a Morph and a little TransformMorph (100@100) ^^
Going to work on it tomorrow but thx for further help
Reply | Threaded
Open this post in threaded view
|

Re: Morphic

d3orn
mhm something is still not working the way it should
the supermorph (i named it container) is copied and the flex is added but then after the extent it is way to small

        factor := self height / container height.   "the factor which the container is scaled"
        me := self copyContainer.                     "copy of the container"
        t := me addFlexShell.
        t extent: (factor * me height) @ (factor * me width).
        t center: self center.
        self addMorph: t.

thx for any help and cheerio