[Cuis-dev] BoxedMorph padding
ken.dickey at whidbey.com
ken.dickey at whidbey.com
Thu Sep 5 18:28:37 PDT 2024
On 2024-09-05 12:51, Bernhard Pieber wrote:
Ah! Many apologies. It appears the I had not actually filed out the
final changeset.
Please apply the attached _after_ filing in
'6672-CuisCore-Padding-2024Sep03-15h04m-KenD.002.cs.st'.
This should look better!
Thank you for looking carefully at this!
Juan: note that I had to adjust the ImageMorph>>drawOn: form location by
1 from what I expected. I believe this differs from the text offset
usage (e.g. check ImageMorph>>drawOn: vs LabelMorph>>drawOn: Thanks!)
Am I wrong here?
Thanks again to all,
-KenD
-------------- next part --------------
'From Cuis7.1 [latest update: #6676] on 5 September 2024 at 6:16:24 pm'!
!BoxedMorph methodsFor: 'geometry interior' stamp: 'KenD 9/5/2024 17:49:05'!
interiorOffset
"Answer point inset from borderWidth and Padding"
| x y |
x := self borderWidth + self padding x.
y := (self borderWidth + self padding y) negated.
^x @ y! !
!BoxedMorph methodsFor: 'geometry interior' stamp: 'KenD 9/5/2024 17:49:26'!
interiorOrigin
"Answer point inset from borderWidth and Padding"
| x y |
x := self borderWidth + self padding x.
y := self borderWidth + self padding y.
^x @ y! !
!LayoutMorph methodsFor: 'geometry' stamp: 'KenD 9/5/2024 18:07:03'!
minimumExtent: cachedValues
"Answer size sufficient to frame my submorphs."
| width height mle subs |
width := 0.
height := 0.
subs := self submorphsToLayout.
(self direction = #vertical)
ifTrue: [ "Column"
subs do: [ :sm |
mle := sm minimumLayoutExtent: cachedValues.
"use maximum width across submorphs"
width := width max: mle x.
"sum up submorph heights, excluding separation"
height := height + mle y.
].
width := width + (2 * self padding x).
height := height + (2 * self padding y) + (subs size - 1 * self ySeparation)
]
ifFalse: [ "Row"
subs do: [ :sm |
mle := sm minimumLayoutExtent: cachedValues.
"sum up submorphs width"
width := width + mle x.
"use maximum height across submorph"
height := height max: mle y.
].
width := width + (2 * self padding x) + (subs size - 1 * self xSeparation).
height := height + (2 * self padding y).
].
^ (width @ height) + self extentBorder! !
!ImageMorph methodsFor: 'drawing' stamp: 'KenD 9/5/2024 18:15:49'!
drawOn: aCanvas
self flag: 'Why Origin offset by 1 ??'.
aCanvas image: image at: self interiorOrigin + 1.
(borderWidth > 0) ifTrue: [
aCanvas
frameRectangle: (`0 at 0` extent: extent)
color: borderColor
borderWidth: borderWidth
borderStyleSymbol: #simple ]! !
More information about the Cuis-dev
mailing list