Skip to content

Commit

Permalink
Made labels massively more beautiful
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonia Heinen committed Jun 20, 2024
1 parent eebd169 commit 949555c
Show file tree
Hide file tree
Showing 13 changed files with 53 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
updating-local
calculateLabelPositionFor: aNumber

| label previousLabel |
| label previousLabel firstAttempt |
previousLabel := self labelModels at: aNumber - 1.
label := self labelModels at: aNumber.

firstAttempt := (previousLabel position x + previousLabel extent x + self labelBorderOffset) @ previousLabel position y.
firstAttempt x + label extent x <= (self extent x - self labelBorderOffset) ifTrue: [^ firstAttempt].

^ self labelBorderOffset @
(previousLabel position y + (previousLabel extent y + self inbetweenLabelOffset))
(previousLabel position y + (previousLabel extent y + self inbetweenLabelOffset)).
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
accessing
constants
labelBorderOffset

^ 4.
^ self padding.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
accessing
constants
labelTitleOffset

^ 10.
8 changes: 2 additions & 6 deletions Squello-Core.package/SPBCard.class/instance/setCardHeight.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@ updating-local
setCardHeight

| labelHeightsSum |
labelHeightsSum := 0.
self labelModels
do: [:label | labelHeightsSum := labelHeightsSum
+ label extent y
+ self inbetweenLabelOffset].
labelHeightsSum := self labelModels size = 0 ifTrue: [0] ifFalse: [self labelModels last position y + self labelModels last extent y - self labelModels first position y].
self extent:
self class defaultCardExtent x @
((self titleModel extent y + labelHeightsSum + self labelTitleOffset)
((self titleModel extent y + labelHeightsSum + self labelTitleOffset + self statusModel extent y)
max: self class defaultCardExtent y).
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ updateLabelIcons
self labels
do: [:label | newLabel := label asMorph.
self labelModels add: newLabel.
self addMorph: newLabel.
self alignLabels].
self addMorph: newLabel.].

self alignLabels.
self column ifNotNil: [self resizeCard. self column resizeToFitCards].
8 changes: 4 additions & 4 deletions Squello-Core.package/SPBCard.class/methodProperties.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"buildStatusText" : "AH 5/25/2024 16:59",
"buildTitle" : "AH 6/14/2024 12:14",
"buildUI" : "AH 6/16/2024 13:06",
"calculateLabelPositionFor:" : "mcr 8/4/2022 01:35",
"calculateLabelPositionFor:" : "AH 6/20/2024 23:55",
"cardIndicatorExtent" : "lo 8/1/2022 11:52",
"changeProvider" : "lo 7/8/2022 15:38",
"changeProvider:" : "jh 7/9/2022 10:18",
Expand Down Expand Up @@ -61,7 +61,7 @@
"isRealCard" : "lo 7/31/2022 16:55",
"issueId" : "LW 5/24/2022 21:51",
"issueId:" : "LW 7/14/2022 10:48",
"labelBorderOffset" : "lo 8/1/2022 11:18",
"labelBorderOffset" : "AH 6/20/2024 23:39",
"labelModels" : "tk 8/2/2022 23:28",
"labelModels:" : "tk 8/2/2022 23:28",
"labelTitleOffset" : "lo 8/1/2022 11:18",
Expand All @@ -79,7 +79,7 @@
"resizeIndicatorFields" : "tk 8/2/2022 23:23",
"setCardColumn:" : "jh 8/3/2022 00:34",
"setCardColumnAtTop:" : "jh 8/3/2022 00:33",
"setCardHeight" : "mcr 8/3/2022 23:39",
"setCardHeight" : "AH 6/20/2024 23:54",
"setupMouseEvents" : "jh 8/3/2022 00:20",
"startDragging" : "mcr 8/3/2022 12:29",
"statusModel" : "AH 5/25/2024 16:59",
Expand All @@ -95,7 +95,7 @@
"updateAssigneeCount" : "tk 8/2/2022 23:27",
"updateBalloonText" : "mcr 8/4/2022 01:50",
"updateDescription:" : "jh 7/29/2022 11:38",
"updateLabelIcons" : "mcr 8/4/2022 01:51",
"updateLabelIcons" : "AH 6/20/2024 23:31",
"updateStatus" : "AH 5/25/2024 17:02",
"updateTitle:" : "tk 8/2/2022 23:24",
"upperHalfIndicator" : "tk 8/2/2022 23:23",
Expand Down
3 changes: 2 additions & 1 deletion Squello-Core.package/SPBLabel.class/instance/asMorph.st
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
converting
asMorph

^ TextMorph new
^ SPBLabelMorph new
backgroundColor: self color;
color: self color makeForegroundColor;
contents: self title;
extent: 100@21;
lock;
Expand Down
2 changes: 1 addition & 1 deletion Squello-Core.package/SPBLabel.class/methodProperties.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"instance" : {
"=" : "jh 7/31/2022 13:05",
"asForm" : "tk 8/2/2022 23:37",
"asMorph" : "lo 8/1/2022 13:50",
"asMorph" : "AH 6/20/2024 23:45",
"asString" : "lo 6/5/2022 14:49",
"color" : "lo 5/16/2022 22:01",
"color:" : "lo 5/23/2022 16:52",
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
as yet unclassified
applyUserInterfaceTheme

super applyUserInterfaceTheme.
self font: (self userInterfaceTheme get: #font for: PluggableButtonMorph).
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
as yet unclassified
initialize

super initialize.
self cornerStyle: #rounded;
cornerRadius: 8;
margins: 4@2.
self applyUserInterfaceTheme.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"class" : {
},
"instance" : {
"applyUserInterfaceTheme" : "AH 6/20/2024 23:12",
"initialize" : "AH 6/20/2024 23:06" } }
14 changes: 14 additions & 0 deletions Squello-Core.package/SPBLabelMorph.class/properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"category" : "Squello-Core",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
],
"name" : "SPBLabelMorph",
"pools" : [
],
"super" : "TextMorph",
"type" : "normal" }

0 comments on commit 949555c

Please sign in to comment.