1- import { c as ctx } from "./Monopoly/Initialization" ;
1+ import { c as ctx , canvas } from "./Monopoly/Initialization" ;
22/*--------------------------------------Function-1------------------------------------------------------------------*/
33function backToIndex ( ) { /*collapse(1,313)*/
44 var currentURL = location . href ;
@@ -21,7 +21,7 @@ function getRandomColor() {
2121var windowRatio ;
2222var canvasRatio ;
2323const toolBarHeight : number = 27 ;
24- var canvasScale ;
24+ let canvasScale : number ;
2525function resizeCanvas ( ) {
2626 //Get Window Ratio
2727 windowRatio = window . innerWidth / ( window . innerHeight - toolBarHeight ) ;
@@ -42,16 +42,16 @@ function resizeCanvas(){
4242 }
4343}
4444/*--------------------------------------Function-5------------------------------------------------------------------*/
45- function toRadian ( deg ) {
45+ function toRadian ( deg : number ) {
4646 return deg * Math . PI / 180 ;
4747}
4848/*--------------------------------------Function-6------------------------------------------------------------------*/
49- function toDegree ( rad ) {
49+ function toDegree ( rad : number ) {
5050 return rad * 180 / Math . PI ;
5151}
5252/*--------------------------------------Function-7------------------------------------------------------------------*/
53- function random ( min , max , exp ) {
54- rand = Math . random ( ) ;
53+ function random ( min : number , max : number , exp : number ) {
54+ let rand = Math . random ( ) ;
5555 rand = rand * ( max - min ) + min ;
5656 if ( exp < 1 && exp > 0 ) {
5757 rand = rand * invertFraction ( exp , 1 ) ;
@@ -66,17 +66,17 @@ function random(min, max, exp) {
6666 }
6767}
6868/*--------------------------------------Function-8------------------------------------------------------------------*/
69- function invertFraction ( numerator , denominator ) {
69+ function invertFraction ( numerator : number , denominator : number ) {
7070 return denominator / numerator ;
7171}
7272/*--------------------------------------Function-8------------------------------------------------------------------*/
73- function distance ( x1 , y1 , x2 , y2 ) {
73+ function distance ( x1 : number , y1 : number , x2 : number , y2 : number ) {
7474 var difX = x1 - x2 ;
7575 var difY = y1 - y2 ;
7676 return Math . sqrt ( Math . abs ( difX * difX + difY * difY ) ) ;
7777}
7878/*--------------------------------------Function-9------------------------------------------------------------------*/
79- function download ( url ) {
79+ function download ( url : string ) {
8080 var downloadFrame = document . createElement ( "iframe" ) ;
8181 downloadFrame . height = "0px" ;
8282 downloadFrame . width = "0px" ;
@@ -85,11 +85,11 @@ function download(url){
8585 setTimeout ( function ( ) { removeElement ( downloadFrame ) } , 10000 ) ;
8686}
8787/*--------------------------------------Function-10-----------------------------------------------------------------*/
88- function removeElement ( elem ) {
89- elem . parentNode . removeChild ( elem ) ;
88+ function removeElement ( elem : HTMLElement ) {
89+ elem . parentNode ! . removeChild ( elem ) ;
9090}
9191/*--------------------------------------Function-11-----------------------------------------------------------------*/
92- function getCookie ( cname ) {
92+ function getCookie ( cname : string ) {
9393 var name = cname + "=" ;
9494 var decodedCookie = decodeURIComponent ( document . cookie ) ;
9595 var ca = decodedCookie . split ( ';' ) ;
@@ -120,30 +120,37 @@ Object.prototype.getAllProperties = function () {
120120 //getAllProperties (!IMPORTANT!)
121121 var arr = [ ] ;
122122 for ( let property in this ) {
123- if ( ! this [ property ] . toString ( ) . includes ( 'getAllInstances' ) && ! this [ property ] . toString ( ) . includes ( 'getAllProperties' ) ) {
124- arr . push ( this [ property ] ) ;
123+ if (
124+ ! ( this as { [ a : string ] : any } ) [ property ]
125+ . toString ( )
126+ . includes ( 'getAllInstances' ) &&
127+ ! ( this as { [ a : string ] : any } ) [ property ]
128+ . toString ( )
129+ . includes ( 'getAllProperties' )
130+ ) {
131+ arr . push ( ( this as { [ a : string ] : any } ) [ property ] ) ;
125132 }
126133 }
127134 return arr ;
128135}
129136/*--------------------------------------Function-14-----------------------------------------------------------------*/
130- Array . prototype . getControlByName = function ( name ) { //Ver se é mesmo necessário, não deve ser, então é pra apagar.
137+ Array . prototype . getControlByName = function ( name : string ) { //Ver se é mesmo necessário, não deve ser, então é pra apagar.
131138 return this . find ( function ( control ) { return control . name . toLowerCase ( ) == name . toLowerCase ( ) } )
132139}
133140/*--------------------------------------Function-15-----------------------------------------------------------------*/
134141//Function.prototype.callIndex = 0;
135142/*--------------------------------------Function-16-----------------------------------------------------------------*/
136143var functionSaved = false ;
137- var functionSave ;
138- function AnimationLOOP ( funct ) {
144+ var functionSave : ( ) => void ;
145+ function AnimationLOOP ( funct : ( ) => void ) {
139146 if ( ! functionSaved ) {
140147 functionSave = funct ;
141148 functionSaved = true ;
142149 }
143150 ctx . setTransform ( 1 , 0 , 0 , 1 , 0 , 0 ) ;
144151 ctx . clearRect ( 0 , 0 , canvas . width , canvas . height ) ;
145152 functionSave ( ) ;
146- requestAnimationFrame ( AnimationLOOP ) ;
153+ requestAnimationFrame ( AnimationLOOP as any ) ;
147154}
148155/*--------------------------CLASSES-----Function-17-----------------------------------------------------------------*/
149156var transparent = "rgba(0,0,0,0)" ;
@@ -250,7 +257,7 @@ Rectangle.prototype.drawParts_patterns = function () {
250257 } //
251258} ;
252259/*--------------------------------------Function-19-----------------------------------------------------------------*/
253- function Circle ( x , y , radius ) {
260+ function Circle ( x : number , y : number , radius : number ) {
254261 Control . call ( this , x , y ) ; //Inherit from Control
255262 this . radius = radius ;
256263}
@@ -267,12 +274,12 @@ Circle.prototype.draw = function () {
267274 ctx . stroke ( ) ;
268275 }
269276}
270- Circle . prototype . goTo = function ( newX , newY ) {
277+ Circle . prototype . goTo = function ( newX : number , newY : number ) {
271278 this . x = newX + this . radius ;
272279 this . y = newY + this . radius ;
273280} ;
274281/*--------------------------------------Function-20-----------------------------------------------------------------*/
275- function Label ( x , y , text , xAlign ) {
282+ function Label ( x : number , y : number , text : number , xAlign : number ) {
276283 Control . call ( this , x , y ) ; //Inherit from Control
277284 this . text = text ;
278285 this . color = "white" ;
@@ -312,7 +319,7 @@ Label.prototype.updateLanguage = function () {
312319 this . text = "<!ERROR!>" ;
313320} ;
314321/*--------------------------------------Function-20-----------------------------------------------------------------*/
315- function Button ( x , y , width , height , text ) {
322+ function Button ( x : number , y : number , width : number , height : number , text : string ) {
316323 Rectangle . call ( this , x , y , 50 , 81 ) ;
317324 this . label = new Label ( x , y , text , 'center' ) ;
318325 this . label . outlineWidth = 6 ;
0 commit comments