11namespace user_interface_base {
2-
32 export class Borders {
43 constructor (
54 public top : number ,
65 public bottom : number ,
76 public left : number ,
87 public right : number
9- ) { }
8+ ) { }
109 }
1110
1211 export class ButtonStyle {
1312 constructor (
1413 public fill : number ,
1514 public borders : Borders ,
1615 public shadow : boolean
17- ) { }
16+ ) { }
1817 }
1918
2019 export namespace ButtonStyles {
@@ -148,8 +147,8 @@ namespace user_interface_base {
148147 return ! this . icon . invisible
149148 }
150149
151- public hover ( hov : boolean ) { }
152- public update ( ) { }
150+ public hover ( hov : boolean ) { }
151+ public update ( ) { }
153152
154153 isOffScreenX ( ) : boolean {
155154 return this . icon . isOffScreenX ( )
@@ -202,13 +201,11 @@ namespace user_interface_base {
202201 public selected : boolean
203202 private dynamicBoundaryColorsOn : boolean
204203 private boundaryColor : number
204+ public state : number [ ]
205205 public pressable : boolean
206206
207207 public get ariaId ( ) : string {
208- return (
209- this . _ariaId ||
210- ( typeof this . iconId === "string" ? < string > this . iconId : "" )
211- )
208+ return this . _ariaId
212209 }
213210
214211 public set ariaId ( value : string ) {
@@ -221,29 +218,30 @@ namespace user_interface_base {
221218 value : this . ariaId ,
222219 force,
223220 }
224- accessibility . setLiveContent ( msg )
221+ accessibility . setLiveContent ( msg )
225222 }
226223
227224 constructor ( opts : {
228225 parent ?: IPlaceable
229226 style ?: ButtonStyle
230- icon : string | Bitmap
227+ icon ? : string | Bitmap
231228 ariaId ?: string
232- x : number
233- y : number
229+ x ? : number
230+ y ? : number
234231 onClick ?: ( button : Button ) => void ,
235232 dynamicBoundaryColorsOn ?: boolean
236233 boundaryColor ?: number ,
237- flipIcon ?: boolean
234+ flipIcon ?: boolean ,
235+ state ?: number [ ]
238236 } ) {
239237 super (
240- opts . x ,
241- opts . y ,
238+ ( opts . x != null ) ? opts . x : 0 ,
239+ ( opts . y != null ) ? opts . y : 0 ,
242240 opts . style || ButtonStyles . Transparent ,
243241 opts . parent && opts . parent . xfrm
244242 )
245243 this . iconId = opts . icon
246- this . _ariaId = opts . ariaId
244+ this . _ariaId = ( opts . ariaId != null ) ? opts . ariaId : ""
247245 this . onClick = opts . onClick
248246 this . buildSprite ( this . image_ ( ) )
249247
@@ -267,6 +265,8 @@ namespace user_interface_base {
267265 this . dynamicBoundaryColorsOn = true
268266 this . boundaryColor = opts . boundaryColor
269267 }
268+
269+ this . state = opts . state
270270 }
271271
272272 public getIcon ( ) {
@@ -283,10 +283,10 @@ namespace user_interface_base {
283283
284284 private image_ ( ) {
285285 return typeof this . iconId == "string"
286- ? getIcon ( this . iconId , false )
286+ ? getIcon ( this . iconId , false )
287287 : this . iconId
288288 }
289-
289+
290290 public setIcon ( iconId : string , img ?: Bitmap ) {
291291 this . iconId = iconId
292292 if ( img ) this . icon . setImage ( img )
@@ -310,7 +310,7 @@ namespace user_interface_base {
310310 super . draw ( )
311311
312312 if ( this . dynamicBoundaryColorsOn ) {
313- const boundaryColour = ( this . selected && this . pressable ) ? 7 : this . boundaryColor
313+ const boundaryColour = ( this . selected && this . pressable ) ? 7 : this . boundaryColor
314314
315315 for ( let dist = 1 ; dist <= 3 ; dist ++ ) {
316316 Screen . outlineBoundsXfrm (
0 commit comments