@@ -38,7 +38,6 @@ namespace user_interface_base {
3838 ariaPos : Vec2
3939 ariaId : string
4040 size : Bounds
41- borderThickness : number
4241 visible = true
4342
4443 resetOutlineColourOnMove = false
@@ -48,15 +47,16 @@ namespace user_interface_base {
4847 this . xfrm = new Affine ( )
4948 this . cancelHandlerStack = [ ]
5049 this . moveDest = new Vec2 ( )
51- this . borderThickness = 3
5250 this . setSize ( )
5351
5452 this . cursorOutlineColour = DEFAULT_CURSOR_OUTLINE_COLOUR
5553 }
5654
57- public moveTo ( pos : Vec2 , ariaId : string , sizeHint : Bounds ) {
55+ public moveTo ( pos : Vec2 , ariaId : string , sizeHint : Bounds , newBoundaryColour ?: number ) {
5856 if ( this . resetOutlineColourOnMove )
5957 this . setOutlineColour ( DEFAULT_CURSOR_OUTLINE_COLOUR )
58+ if ( newBoundaryColour )
59+ this . setOutlineColour ( newBoundaryColour )
6060
6161 this . setSize ( sizeHint )
6262 this . moveDest . copyFrom ( pos )
@@ -72,7 +72,7 @@ namespace user_interface_base {
7272 public snapTo ( x : number , y : number , ariaId : string , sizeHint : Bounds ) {
7373 this . setSize (
7474 sizeHint ||
75- new Bounds ( { left : 0 , top : 0 , width : 16 , height : 16 } ) ,
75+ new Bounds ( { left : 0 , top : 0 , width : 16 , height : 16 } )
7676 )
7777 this . moveDest . x = this . xfrm . localPos . x = x
7878 this . moveDest . y = this . xfrm . localPos . y = y
@@ -86,8 +86,7 @@ namespace user_interface_base {
8686 else this . size = size . clone ( )
8787 }
8888
89- public setOutlineColour ( colour : number = 9 ) {
90- // 9 is the DEFAULT_CURSOR_OUTLINE_COLOUR
89+ public setOutlineColour ( colour : number = 9 ) { // 9 is the DEFAULT_CURSOR_OUTLINE_COLOUR
9190 this . cursorOutlineColour = colour
9291 }
9392
@@ -131,23 +130,19 @@ namespace user_interface_base {
131130 return false
132131 }
133132
134- public setBorderThickness ( thickness : number ) {
135- this . borderThickness = thickness
136- }
137-
138133 update ( ) {
139134 this . xfrm . localPos . copyFrom ( this . moveDest )
140135 }
141136
142137 draw ( ) {
143138 if ( ! this . visible ) return
144139
145- for ( let dist = 1 ; dist <= this . borderThickness ; dist ++ ) {
140+ for ( let dist = 1 ; dist <= 3 ; dist ++ ) {
146141 Screen . outlineBoundsXfrm (
147142 this . xfrm ,
148143 this . size ,
149144 dist ,
150- this . cursorOutlineColour ,
145+ this . cursorOutlineColour
151146 )
152147 }
153148
@@ -159,11 +154,11 @@ namespace user_interface_base {
159154 const h = font . charHeight
160155 const x = Math . max (
161156 Screen . LEFT_EDGE + 1 ,
162- Math . min ( Screen . RIGHT_EDGE - 1 - w , pos . x - ( w >> 1 ) ) ,
157+ Math . min ( Screen . RIGHT_EDGE - 1 - w , pos . x - ( w >> 1 ) )
163158 )
164159 const y = Math . min (
165160 pos . y + ( this . size . width >> 1 ) + ( font . charHeight >> 1 ) + 1 ,
166- Screen . BOTTOM_EDGE - 1 - font . charHeight ,
161+ Screen . BOTTOM_EDGE - 1 - font . charHeight
167162 )
168163 Screen . fillRect ( x - 1 , y - 1 , w + 1 , h + 2 , 15 )
169164 Screen . print ( text , x , y , 1 , font )
0 commit comments