<div dir="ltr">If I do not use #scaleBy: on the image morph and make sure the object of class Form has the right size it works.<div><br></div><div>So there seems to be an issue  with layout if the image morph has been scaled.</div><div><br></div><div>--Hannes</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Nov 12, 2024 at 10:35 PM Hannes Hirzel <<a href="mailto:hannes.hirzel@gmail.com">hannes.hirzel@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><u></u>

  
    
  
  <div>
    <p>Another example which reads a JPG file from the directory
      'Cuis-Smalltalk-Dev-master-UserFiles'.</p>
    <p>The picture file is 2258 x 1505 pixel in size.</p>
    <p>However the layout morph does not shrink to the size of the bear
      picture. It remains much larger.</p>
    <p>What am I missing here?</p>
    <p>Regards,</p>
    <p>Hannes<br>
    </p>
    <p><br>
    </p>
    <p>labelMorph := LabelMorph new<br>
        borderWidth: 2;<br>
        borderColor: Color red;<br>
        color: Color cyan;<br>
        padding: 0.<br>
      <br>
      aForm := Form fromFileEntry: '920.bear.jpg' asFileEntry.<br>
      "aForm inspect"<br>
      <br>
      imageMorph := ImageMorph newWith: aForm.<br>
      imageMorph<br>
         borderWidth: 6;<br>
         borderColor: Color green;<br>
         scaleBy: 0.2;<br>
         padding: 0.<br>
      <br>
      layoutMorph := LayoutMorph newColumn<br>
          borderWidth: 2;<br>
          borderColor: Color yellow;<br>
          padding: 0;<br>
          separation: 0;<br>
          addMorph: labelMorph;<br>
          addMorph: imageMorph;<br>
          openInWorld<br>
    </p>
    <p><br>
    </p>
    <p><br>
    </p>
    <p>labelMorph := LabelMorph new<br>
        borderWidth: 2;<br>
        borderColor: Color red;<br>
        color: Color cyan;<br>
        padding: 0.<br>
      <br>
      aForm := Form fromFileEntry: '920.bear.jpg' asFileEntry.<br>
      "aForm inspect"<br>
      <br>
      imageMorph := ImageMorph newWith: aForm.<br>
      imageMorph<br>
         borderWidth: 6;<br>
         borderColor: Color green;<br>
         scaleBy: 0.2;<br>
         padding: 0.<br>
      <br>
      layoutMorph := LayoutMorph newColumn<br>
          borderWidth: 2;<br>
          borderColor: Color yellow;<br>
          padding: 0;<br>
          separation: 0;<br>
          addMorph: labelMorph;<br>
          addMorph: imageMorph;<br>
          openInWorld<br>
    </p>
    <div>On 12/11/2024 11:06 pm, Hannes Hirzel
      wrote:<br>
    </div>
    <blockquote type="cite">
      
      <p>P.S.<br>
      </p>
      <p>Removed duplicated code <br>
      </p>
      <p><br>
      </p>
      <p>labelMorph := LabelMorph new<br>
          borderWidth: 2;<br>
          borderColor: Color red;<br>
          color: Color cyan;<br>
          padding: 0.<br>
        <br>
        imageMorph := ImageMorph new<br>
           borderWidth: 6;<br>
           borderColor: Color green;<br>
           padding: 0.<br>
        <br>
        layoutMorph := LayoutMorph newColumn<br>
            borderWidth: 2;<br>
            borderColor: Color yellow;<br>
            padding: 0;<br>
            separation: 0;<br>
            addMorph: labelMorph;<br>
            addMorph: imageMorph;<br>
            scaleBy: 3;<br>
            openInWorld.<br>
        <br>
        <br>
        labelMorph padding: 4.<br>
        <br>
        labelMorph padding: 6.<br>
        <br>
        labelMorph padding: 8.<br>
        <br>
        layoutMorph padding:0; morphExtent: layoutMorph minimumExtent.<br>
        <br>
        layoutMorph separation: 3.<br>
        <br>
        LayoutMorph exampleEdgesColumn.<br>
        LayoutMorph exampleEdgesRow.<br>
      </p>
      <p><br>
      </p>
      <p><br>
      </p>
      <p><br>
      </p>
      <div>On 12/11/2024 4:02 pm, H. Hirzel
        wrote:<br>
      </div>
      <blockquote type="cite">
        
        <div dir="ltr">Hello
          <div><br>
          </div>
          <div>I was watching the Box Morph video (Sep 2024, link is on
            <a href="https://cuis.st/community" target="_blank">https://cuis.st/community</a>)
            with interest.</div>
          <div><br>
          </div>
          <div>I like that padding works similar to CSS.</div>
          <div><br>
          </div>
          <div>Below is the workspace code used for the demo four your
            convenience in case you need it.</div>
          <div><br>
          </div>
          <div>Regards</div>
          <div>Hannes</div>
          <div><br>
          </div>
          <div>----------------------------------------------</div>
          <div>File: PadWorkSpace.st</div>
          <div>
            <div>----------------------------------------------</div>
            <br>
          </div>
          <div><br>
            <br>
            labelMorph := LabelMorph new<br>
              borderWidth: 2;<br>
              borderColor: Color red;<br>
              color: Color cyan;<br>
              padding: 0.<br>
            <br>
            imageMorph := ImageMorph new<br>
               borderWidth: 6;<br>
               borderColor: Color green;<br>
               padding: 0.<br>
            <br>
            layoutMorph := LayoutMorph new<br>
                borderWidth: 2;<br>
                borderColor: Color yellow;<br>
                padding: 0;<br>
                separation: 0;<br>
                addMorph: labelMorph;<br>
                addMorph: imageMorph;<br>
                scaleBy: 3;<br>
                openInWorld.<br>
            <br>
            labelMorph := LabelMorph newColumn<br>
              borderWidth: 2;<br>
              borderColor: Color red;<br>
              color: Color cyan;<br>
              padding: 0.<br>
            <br>
            imageMorph := ImageMorph new<br>
               borderWidth: 6;<br>
               borderColor: Color green;<br>
               padding: 0.<br>
            <br>
            layoutMorph := LayoutMorph new<br>
                borderWidth: 2;<br>
                borderColor: Color yellow;<br>
                padding: 0;<br>
                separation: 0;<br>
                addMorph: labelMorph;<br>
                addMorph: imageMorph;<br>
                scaleBy: 3;<br>
                openInWorld.<br>
            <br>
            <br>
            labelMorph := LabelMorph new<br>
              borderWidth: 2;<br>
              borderColor: Color red;<br>
              color: Color cyan;<br>
              padding: 0.<br>
            <br>
            imageMorph := ImageMorph new<br>
               borderWidth: 6;<br>
               borderColor: Color green;<br>
               padding: 0.<br>
            <br>
            layoutMorph := LayoutMorph newColumn<br>
                borderWidth: 2;<br>
                borderColor: Color yellow;<br>
                padding: 0;<br>
                separation: 0;<br>
                addMorph: labelMorph;<br>
                addMorph: imageMorph;<br>
                scaleBy: 3;<br>
                openInWorld.<br>
            <br>
            labelMorph padding: 4.<br>
            <br>
            labelMorph padding: 6.<br>
            <br>
            labelMorph padding: 8.<br>
            <br>
            layoutMorph padding:0; morphExtent: layoutMorph
            minimumExtent.<br>
            <br>
            layoutMorph padding:0; morphExtent: layoutMorph
            minimumExtent.<br>
            <br>
            layoutMorph separation: 3.<br>
            <br>
            LayoutMorph exampleEdgesColumn.<br>
            LayoutMorph exampleEdgesRow.<br>
          </div>
          <div><br>
          </div>
        </div>
      </blockquote>
    </blockquote>
  </div>

</blockquote></div>