<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hi Weslleymberg, </p>
<div class="moz-cite-prefix">On 27/03/2025 3:21 am, Weslleymberg
Lisboa via Cuis-dev wrote:<br>
</div>
<blockquote type="cite"
cite="mid:c399d97d-6f4e-4425-9db3-d84d0bbac804@gmail.com">Hi,
Hannes
<br>
<br>
I'm no expert in image transformations, but as you are not the
first to report this same behavior [1], I'm somewhat confident
that there is a bug in ImageMorph>>#minimumExtent.
<br>
</blockquote>
<p>Thank you for the confirmation that you consider this as a bug
and the proposal of a solution.<br>
</p>
<blockquote type="cite"
cite="mid:c399d97d-6f4e-4425-9db3-d84d0bbac804@gmail.com">What
happens is that at the moment #minimumExtent does not take into
account the scaling factor we apply to the morph. So when we scale
an ImageMorph the minimum size allowed to it will be the original
extent of the image plus margin and padding.
<br>
<br>
Attached is a screenshot showing what happens when we change
ImageMorph>>#minimumExtent. Both of the ImagemMorphs were
created from your example 2. The only difference is that I changed
#minimumExtent before creating the second one.
<br>
<br>
1 -
<a class="moz-txt-link-freetext" href="https://lists.cuis.st/mailman/archives/cuis-dev/2025-March/010688.html">https://lists.cuis.st/mailman/archives/cuis-dev/2025-March/010688.html</a>
<br>
</blockquote>
<p>Yes, changing the ImageMorph>>minimumExtent implementation
is what you propose in the 'scaling an ImageMorph' thread.
</p>
<p><a class="moz-txt-link-freetext" href="https://lists.cuis.st/mailman/archives/cuis-dev/2025-March/010706.html">https://lists.cuis.st/mailman/archives/cuis-dev/2025-March/010706.html</a></p>
<p>--------------------------------------------------------------------<br>
</p>
<p>Current ImageMorph>>minimumExtent</p>
<p>````<br>
minimumExtent<br>
<br>
^ image extent + (2 * self interiorOrigin)<br>
````<br>
</p>
<p>-------------------------------------------------------------------------------------------<br>
</p>
<p><br>
Your proposal for ImageMorph>>minimumExtent<br>
<br>
````<br>
minimumExtent<br>
<br>
^ image extent + (2 * self interiorOrigin) * self scale<br>
<br>
</p>
<p>-------------------------------------------------------------------------------------------<br>
</p>
<p><br>
</p>
<blockquote type="cite"
cite="mid:c399d97d-6f4e-4425-9db3-d84d0bbac804@gmail.com">
</blockquote>
<p><br>
</p>
<p>My example 2 (unnecessary methods invocations removed so that
problem is minimal) from the first mail in this thread works fine
now! (Cuis 7.3 latest update #7092)<br>
</p>
<p>Example picture </p>
<pre>'20250326_coffee.jpg'</pre>
<p>here</p>
<p><a class="moz-txt-link-freetext" href="https://lists.cuis.st/mailman/archives/cuis-dev/attachments/20250326/bd015a5f/attachment-0001.jpg">https://lists.cuis.st/mailman/archives/cuis-dev/attachments/20250326/bd015a5f/attachment-0001.jpg</a>
<br>
</p>
<pre>
"[2] Adding a LabelMorph and an ImageMorph object to a LayoutMorph object."
labelMorph := LabelMorph new
contents: 'coffee';
color: Color red;
padding: 0.
aForm := Form fromFileEntry: '20250326_coffee.jpg' asFileEntry.
imageMorph := ImageMorph newWith: aForm.
imageMorph
borderWidth: 20;
borderColor: Color black;
scaleBy: 0.2;
padding: 0.
layoutMorph := LayoutMorph newColumn
borderWidth: 2;
borderColor: Color yellow;
padding: 0;
separation: 0;
addMorph: labelMorph;
addMorph: imageMorph;
openInWorld</pre>
<p></p>
<p>So I suggest that this method change should be made. <br>
</p>
<p>Kind regards<br>
</p>
<p>Hannes<br>
</p>
<blockquote type="cite"
cite="mid:c399d97d-6f4e-4425-9db3-d84d0bbac804@gmail.com">
<br>
Em 26/03/2025 19:59, H. Hirzel via Cuis-dev escreveu:
<br>
<blockquote type="cite">Hi
<br>
<br>
I have a question related to the 'scaling morphs' discussion.
<br>
<br>
Scaling a form and then opening it as an image morph works fine,
see [1a],[1b] and attachment '2025-03-25_scaling_a_form.gif'
with example image '20250326_coffee.jpg'.
<br>
<br>
However if I add an image morph to a layout morph the layout
morph does not "shrink" to the necessary size given by the
submorphs and I did also not find which message I need to send
to the layout morph or which LayoutSpec to add to the submorphs.
[2] and attachment
'2025-03-25_Adding_an_image_morph_to_a_layout'.
<br>
<br>
What am I missing here, maybe it is something obvious?
<br>
<br>
Additional question: what is the first argument of the
#shrink:by: message for?
<br>
<br>
Kind regards
<br>
<br>
Hannes
<br>
<br>
-----------------------------
<br>
<br>
"[1a] no scaling of Form object"
<br>
<br>
aForm := Form fromFileEntry: '20250326_coffee.jpg'
asFileEntry.
<br>
<br>
<br>
imageMorph := ImageMorph newWith: aForm.
<br>
imageMorph
<br>
borderWidth: 20;
<br>
borderColor: Color white;
<br>
scaleBy: 0.2;
<br>
padding: 0.
<br>
<br>
imageMorph openInWorld
<br>
<br>
<br>
"[1b] scaling of Form object"
<br>
<br>
aForm := Form fromFileEntry: '20250326_coffee.jpg'
asFileEntry.
<br>
<br>
<br>
aForm := aForm shrink: aForm boundingBox by: 1.5.
<br>
<br>
imageMorph := ImageMorph newWith: aForm.
<br>
imageMorph
<br>
borderWidth: 20;
<br>
borderColor: Color black;
<br>
scaleBy: 0.2;
<br>
padding: 0.
<br>
<br>
imageMorph openInWorld
<br>
<br>
<br>
[2] Adding a LabelMorph and an ImageMorph object to a
LayoutMorph object.
<br>
<br>
labelMorph := LabelMorph new
<br>
contents: 'coffee';
<br>
color: Color red;
<br>
padding: 0.
<br>
<br>
<br>
aForm := Form fromFileEntry: '20250326_coffee.jpg'
asFileEntry.
<br>
<br>
aForm := aForm shrink: aForm boundingBox by: 1.5.
<br>
<br>
imageMorph := ImageMorph newWith: aForm.
<br>
imageMorph
<br>
borderWidth: 20;
<br>
borderColor: Color black;
<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>
"morphExtent: 300@300;"
<br>
openInWorld
<br>
<br>
"changing the morph extent seems to have any effect on the
morphExtent of the layoutMorph."
<br>
<br>
</blockquote>
<br>
<br>
<fieldset class="moz-mime-attachment-header"></fieldset>
</blockquote>
</body>
</html>