[Cuis-dev] Box Morph video - PadWorkSpace.st
H. Hirzel
hannes.hirzel at gmail.com
Tue Nov 12 22:45:21 PST 2024
If I do not use #scaleBy: on the image morph and make sure the object of
class Form has the right size it works.
So there seems to be an issue with layout if the image morph has been
scaled.
--Hannes
On Tue, Nov 12, 2024 at 10:35 PM Hannes Hirzel <hannes.hirzel at gmail.com>
wrote:
> Another example which reads a JPG file from the directory
> 'Cuis-Smalltalk-Dev-master-UserFiles'.
>
> The picture file is 2258 x 1505 pixel in size.
>
> However the layout morph does not shrink to the size of the bear picture.
> It remains much larger.
>
> What am I missing here?
>
> Regards,
>
> Hannes
>
>
> labelMorph := LabelMorph new
> borderWidth: 2;
> borderColor: Color red;
> color: Color cyan;
> padding: 0.
>
> aForm := Form fromFileEntry: '920.bear.jpg' asFileEntry.
> "aForm inspect"
>
> imageMorph := ImageMorph newWith: aForm.
> imageMorph
> borderWidth: 6;
> borderColor: Color green;
> scaleBy: 0.2;
> padding: 0.
>
> layoutMorph := LayoutMorph newColumn
> borderWidth: 2;
> borderColor: Color yellow;
> padding: 0;
> separation: 0;
> addMorph: labelMorph;
> addMorph: imageMorph;
> openInWorld
>
>
>
> labelMorph := LabelMorph new
> borderWidth: 2;
> borderColor: Color red;
> color: Color cyan;
> padding: 0.
>
> aForm := Form fromFileEntry: '920.bear.jpg' asFileEntry.
> "aForm inspect"
>
> imageMorph := ImageMorph newWith: aForm.
> imageMorph
> borderWidth: 6;
> borderColor: Color green;
> scaleBy: 0.2;
> padding: 0.
>
> layoutMorph := LayoutMorph newColumn
> borderWidth: 2;
> borderColor: Color yellow;
> padding: 0;
> separation: 0;
> addMorph: labelMorph;
> addMorph: imageMorph;
> openInWorld
> On 12/11/2024 11:06 pm, Hannes Hirzel wrote:
>
> P.S.
>
> Removed duplicated code
>
>
> labelMorph := LabelMorph new
> borderWidth: 2;
> borderColor: Color red;
> color: Color cyan;
> padding: 0.
>
> imageMorph := ImageMorph new
> borderWidth: 6;
> borderColor: Color green;
> padding: 0.
>
> layoutMorph := LayoutMorph newColumn
> borderWidth: 2;
> borderColor: Color yellow;
> padding: 0;
> separation: 0;
> addMorph: labelMorph;
> addMorph: imageMorph;
> scaleBy: 3;
> openInWorld.
>
>
> labelMorph padding: 4.
>
> labelMorph padding: 6.
>
> labelMorph padding: 8.
>
> layoutMorph padding:0; morphExtent: layoutMorph minimumExtent.
>
> layoutMorph separation: 3.
>
> LayoutMorph exampleEdgesColumn.
> LayoutMorph exampleEdgesRow.
>
>
>
>
> On 12/11/2024 4:02 pm, H. Hirzel wrote:
>
> Hello
>
> I was watching the Box Morph video (Sep 2024, link is on
> https://cuis.st/community) with interest.
>
> I like that padding works similar to CSS.
>
> Below is the workspace code used for the demo four your convenience in
> case you need it.
>
> Regards
> Hannes
>
> ----------------------------------------------
> File: PadWorkSpace.st
> ----------------------------------------------
>
>
>
> labelMorph := LabelMorph new
> borderWidth: 2;
> borderColor: Color red;
> color: Color cyan;
> padding: 0.
>
> imageMorph := ImageMorph new
> borderWidth: 6;
> borderColor: Color green;
> padding: 0.
>
> layoutMorph := LayoutMorph new
> borderWidth: 2;
> borderColor: Color yellow;
> padding: 0;
> separation: 0;
> addMorph: labelMorph;
> addMorph: imageMorph;
> scaleBy: 3;
> openInWorld.
>
> labelMorph := LabelMorph newColumn
> borderWidth: 2;
> borderColor: Color red;
> color: Color cyan;
> padding: 0.
>
> imageMorph := ImageMorph new
> borderWidth: 6;
> borderColor: Color green;
> padding: 0.
>
> layoutMorph := LayoutMorph new
> borderWidth: 2;
> borderColor: Color yellow;
> padding: 0;
> separation: 0;
> addMorph: labelMorph;
> addMorph: imageMorph;
> scaleBy: 3;
> openInWorld.
>
>
> labelMorph := LabelMorph new
> borderWidth: 2;
> borderColor: Color red;
> color: Color cyan;
> padding: 0.
>
> imageMorph := ImageMorph new
> borderWidth: 6;
> borderColor: Color green;
> padding: 0.
>
> layoutMorph := LayoutMorph newColumn
> borderWidth: 2;
> borderColor: Color yellow;
> padding: 0;
> separation: 0;
> addMorph: labelMorph;
> addMorph: imageMorph;
> scaleBy: 3;
> openInWorld.
>
> labelMorph padding: 4.
>
> labelMorph padding: 6.
>
> labelMorph padding: 8.
>
> layoutMorph padding:0; morphExtent: layoutMorph minimumExtent.
>
> layoutMorph padding:0; morphExtent: layoutMorph minimumExtent.
>
> layoutMorph separation: 3.
>
> LayoutMorph exampleEdgesColumn.
> LayoutMorph exampleEdgesRow.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20241113/525aeda4/attachment-0001.htm>
More information about the Cuis-dev
mailing list