Skip to content

Commit 0ca2a80

Browse files
authored
Merge pull request #4 from moosetechnology/lazily-compute-labels
Lazily compute labels
2 parents 270d8be + 52c1797 commit 0ca2a80

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

src/Hierarchical-Roassal/HStyle.class.st

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,12 @@ Class {
1212
{ #category : #accessing }
1313
HStyle >> baseLabel [
1414

15-
^ baseLabel
16-
]
17-
18-
{ #category : #accessing }
19-
HStyle >> baseLabel: anObject [
20-
21-
baseLabel := anObject
15+
^ baseLabel ifNil: [
16+
baseLabel := RSLabel new
17+
fontSize: 12;
18+
color: Smalltalk ui theme textColor;
19+
fontName: 'Source Sans Pro';
20+
yourself ]
2221
]
2322

2423
{ #category : #hooks }
@@ -78,21 +77,18 @@ HStyle >> colorFor: node [
7877

7978
{ #category : #initialization }
8079
HStyle >> initialize [
80+
8181
super initialize.
82-
self boxChildrenColorPalette: (NSScale ordinal range:
83-
Smalltalk ui theme roassalHNodeBackgroundColors).
84-
self titleLocation: (RSLocation new insideCornerLeft; offset: 10@0 ).
85-
baseLabel := RSLabel new
86-
fontSize: 12;
87-
color: Smalltalk ui theme textColor;
88-
fontName: 'Source Sans Pro';
89-
yourself
82+
self boxChildrenColorPalette: (NSScale ordinal range: Smalltalk ui theme roassalHNodeBackgroundColors).
83+
self titleLocation: (RSLocation new
84+
insideCornerLeft;
85+
offset: 10 @ 0)
9086
]
9187

9288
{ #category : #hooks }
9389
HStyle >> labelFor: anHNode [
9490

95-
^ baseLabel copy
91+
^ self baseLabel copy
9692
text: (self textFor: anHNode);
9793
yourself
9894
]

0 commit comments

Comments
 (0)