--- Begin Message ---
Hi Stef,
        I think that an automatic scaled behaviour is very useful for 
especially if you need to generate list of images, that automatically adapts
to their container (i.e. Thumbnails).

        Playing with AlpahImageMorph I found that the desired behaviour can be
obtained setting the "layout" state to the "#scaledAspect" symbol.

        So I've added the "ImageModel>>switchScaledLayout" method, that will 
call its MorphicAdapter, through the command "self changed:
#switchScaledLayout with: {}".
        Then I've created the "MorphicImageAdapter>>switchScaledLayout" method,
that switchs among the "#center" and "#scaledAspect" morph layouts (note:
"#center" is the default for the Spec's "MorpdicImageAdapter").
        Below the code the code I used:

        "Switch between scaled and fixed representation"

                widgetDo: [ :w | 
                        | oldLayout |
                        oldLayout := w layout.
                        oldLayout = #scaledAspect
                                ifTrue: [ w layout: #center ]
                                ifFalse: [ w layout: #scaledAspect ] ].

Please let me know if you have any advice,


View this message in context: 
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.

--- End Message ---

Reply via email to