@@ -38,6 +38,7 @@ namespace user_interface_base {
38
38
ariaPos : Vec2
39
39
ariaId : string
40
40
size : Bounds
41
+ borderThickness : number
41
42
visible = true
42
43
43
44
resetOutlineColourOnMove = false
@@ -47,6 +48,7 @@ namespace user_interface_base {
47
48
this . xfrm = new Affine ( )
48
49
this . cancelHandlerStack = [ ]
49
50
this . moveDest = new Vec2 ( )
51
+ this . borderThickness = 3
50
52
this . setSize ( )
51
53
52
54
this . cursorOutlineColour = DEFAULT_CURSOR_OUTLINE_COLOUR
@@ -70,7 +72,7 @@ namespace user_interface_base {
70
72
public snapTo ( x : number , y : number , ariaId : string , sizeHint : Bounds ) {
71
73
this . setSize (
72
74
sizeHint ||
73
- new Bounds ( { left : 0 , top : 0 , width : 16 , height : 16 } )
75
+ new Bounds ( { left : 0 , top : 0 , width : 16 , height : 16 } ) ,
74
76
)
75
77
this . moveDest . x = this . xfrm . localPos . x = x
76
78
this . moveDest . y = this . xfrm . localPos . y = y
@@ -84,7 +86,8 @@ namespace user_interface_base {
84
86
else this . size = size . clone ( )
85
87
}
86
88
87
- public setOutlineColour ( colour : number = 9 ) { // 9 is the DEFAULT_CURSOR_OUTLINE_COLOUR
89
+ public setOutlineColour ( colour : number = 9 ) {
90
+ // 9 is the DEFAULT_CURSOR_OUTLINE_COLOUR
88
91
this . cursorOutlineColour = colour
89
92
}
90
93
@@ -128,19 +131,23 @@ namespace user_interface_base {
128
131
return false
129
132
}
130
133
134
+ public setBorderThickness ( thickness : number ) {
135
+ this . borderThickness = thickness
136
+ }
137
+
131
138
update ( ) {
132
139
this . xfrm . localPos . copyFrom ( this . moveDest )
133
140
}
134
141
135
142
draw ( ) {
136
143
if ( ! this . visible ) return
137
144
138
- for ( let dist = 1 ; dist <= 3 ; dist ++ ) {
145
+ for ( let dist = 1 ; dist <= this . borderThickness ; dist ++ ) {
139
146
Screen . outlineBoundsXfrm (
140
147
this . xfrm ,
141
148
this . size ,
142
149
dist ,
143
- this . cursorOutlineColour
150
+ this . cursorOutlineColour ,
144
151
)
145
152
}
146
153
@@ -152,11 +159,11 @@ namespace user_interface_base {
152
159
const h = font . charHeight
153
160
const x = Math . max (
154
161
Screen . LEFT_EDGE + 1 ,
155
- Math . min ( Screen . RIGHT_EDGE - 1 - w , pos . x - ( w >> 1 ) )
162
+ Math . min ( Screen . RIGHT_EDGE - 1 - w , pos . x - ( w >> 1 ) ) ,
156
163
)
157
164
const y = Math . min (
158
165
pos . y + ( this . size . width >> 1 ) + ( font . charHeight >> 1 ) + 1 ,
159
- Screen . BOTTOM_EDGE - 1 - font . charHeight
166
+ Screen . BOTTOM_EDGE - 1 - font . charHeight ,
160
167
)
161
168
Screen . fillRect ( x - 1 , y - 1 , w + 1 , h + 2 , 15 )
162
169
Screen . print ( text , x , y , 1 , font )
0 commit comments