(str: string, x: number, y: number, otherClass: string = "", comment: string = "", commentBelow: boolean = false, underlinedLetter: number = -1, color: Color = null, commentCentered: boolean = true, commentRightAligned: boolean = false)
| 24 | } |
| 25 | |
| 26 | public addAsciiRealButton(str: string, x: number, y: number, otherClass: string = "", comment: string = "", commentBelow: boolean = false, underlinedLetter: number = -1, color: Color = null, commentCentered: boolean = true, commentRightAligned: boolean = false): boolean{ |
| 27 | // Add the button |
| 28 | if(this.addTag(new RenderTag(x, "<span class=\"aroundRealButton\"><span class=\"asciiRealButton " + otherClass + "\"" + (color == null? "" : " style=\"background-color:" + color.getColorString() + ";\"") + ">" + Algo.makeUnderlinedLetter(str, underlinedLetter) + "</span></span>"), y) == false) |
| 29 | return false; |
| 30 | |
| 31 | // Add the comment |
| 32 | if(comment != ""){ |
| 33 | var commentX: number; |
| 34 | var commentY: number; |
| 35 | |
| 36 | // If the comment should be on the right |
| 37 | if(commentBelow == false){ |
| 38 | commentX = x+str.length+2; |
| 39 | commentY = y; |
| 40 | } |
| 41 | else{ |
| 42 | if(commentCentered) commentX = Algo.correctIfUnderZero(x + str.length/2 - comment.length/2); |
| 43 | else if(commentRightAligned == false) commentX = x; |
| 44 | else commentX = x + (str.length - comment.length); |
| 45 | commentY = y+1; |
| 46 | } |
| 47 | |
| 48 | if(this.drawString(comment, commentX, commentY) == false) |
| 49 | return false; |
| 50 | if(this.addTwoTags(commentX, commentX+comment.length, commentY, "<span class=\"translated\">", "</span>") == false) |
| 51 | return false; |
| 52 | } |
| 53 | |
| 54 | return true; |
| 55 | } |
| 56 | |
| 57 | public addBackgroundColor(x1: number, x2: number, y: number, color: Color): boolean{ |
| 58 | return this.addTwoTags(x1, x2, y, "<span style=\"background-color:" + color.getColorString() + "\">", "</span>"); |
no test coverage detected