1-
21// @ts -ignore
32export class Mobile5eSheet extends dnd5e . applications . actor . ActorSheet5eCharacter {
43
5- actor :Actor ;
4+ actor : Actor ;
65 canvas ;
7- touchStart ?:Touch
8- touchNow ?:Touch
9- interval ?:number
10- tokenMovement :any
6+ touchStart ?: Touch
7+ touchNow ?: Touch
8+ interval ?: number
9+ tokenMovement : any
1110
1211
1312 static get defaultOptions ( ) {
1413 return mergeObject ( super . defaultOptions , {
15- classes : [ "beavers-mobile" , "dnd5e" , "sheet" , "actor" , "character" ] ,
14+ classes : [ "beavers-mobile" , "dnd5e" , "sheet" , "actor" , "character" ] ,
1615 width : 500 ,
1716 height : 1040
1817 } ) ;
@@ -25,33 +24,33 @@ export class Mobile5eSheet extends dnd5e.applications.actor.ActorSheet5eCharacte
2524 return context ;
2625 }
2726
28- activateListeners ( html ) {
27+ activateListeners ( html ) {
2928 super . activateListeners ( html ) ;
3029 this . _rerender ( html ) ;
3130 this . _addMovementListener ( html ) ;
3231 }
3332
34- _rerender ( html ) {
33+ _rerender ( html ) {
3534 this . _moveRest ( html ) ;
3635 this . _moveCurrency ( html ) ;
3736 this . _addMovement ( html ) ;
3837 }
3938
40- _moveRest ( html ) {
39+ _moveRest ( html ) {
4140 const rest = $ ( html ) . find ( ".hit-dice .attribute-footer" ) ;
4241 $ ( html ) . find ( ".attributes .movement .attribute-footer" ) . remove ( ) ;
4342 $ ( html ) . find ( ".attributes .movement " ) . append ( rest ) ;
4443 }
4544
46- _moveCurrency ( html ) {
45+ _moveCurrency ( html ) {
4746 $ ( html ) . find ( ".currency .pp" ) . text ( "pp" ) ;
4847 $ ( html ) . find ( ".currency .gp" ) . text ( "gp" ) ;
4948 $ ( html ) . find ( ".currency .ep" ) . text ( "ep" ) ;
5049 $ ( html ) . find ( ".currency .sp" ) . text ( "sp" ) ;
5150 $ ( html ) . find ( ".currency .cp" ) . text ( "cp" ) ;
5251 }
5352
54- _addMovement ( html ) {
53+ _addMovement ( html ) {
5554 const upLeft = "<a class='moving up left'><i class='fa-light fa-up-left'></i></a>" ;
5655 const up = "<a class='moving up'><i class='fa-light fa-up'></i></a>" ;
5756 const upRight = "<a class='moving up right'><i class='fa-light fa-up-right'></i></a>" ;
@@ -74,71 +73,68 @@ export class Mobile5eSheet extends dnd5e.applications.actor.ActorSheet5eCharacte
7473 image . append ( upLeft ) ;
7574 }
7675
77- _addMovementListener ( html ) {
78- $ ( html ) . find ( ".sheet-header .image" ) . on ( "touchstart" , ( e : Event ) => {
76+ _addMovementListener ( html ) {
77+ $ ( html ) . find ( ".sheet-header .image" ) . on ( "touchstart" , ( e : Event ) => {
7978 this . touchStart = this . _getTouchFrom ( e ) ;
80- this . interval = window . setInterval ( ( ) => {
81- if ( this . touchNow && this . touchStart ) {
79+ this . interval = window . setInterval ( ( ) => {
80+ if ( this . touchNow && this . touchStart ) {
8281
83- const diffX = this . touchNow . clientX - this . touchStart . clientX ;
84- const diffY = this . touchNow . clientY - this . touchStart . clientY ;
82+ const diffX = this . touchNow . clientX - this . touchStart . clientX ;
83+ const diffY = this . touchNow . clientY - this . touchStart . clientY ;
8584 let x = 0 ;
8685 let y = 0 ;
87- if ( Math . abs ( diffX ) > 30 ) {
86+ if ( Math . abs ( diffX ) > 30 ) {
8887 x = Math . sign ( diffX ) ;
8988 }
90- if ( Math . abs ( diffY ) > 30 ) {
89+ if ( Math . abs ( diffY ) > 30 ) {
9190 y = Math . sign ( diffY ) ;
9291 }
93- this . tokenMovement . move ( x , y ) ;
92+ this . tokenMovement . move ( x , y ) ;
9493 }
95- } , 500 )
94+ } , 500 )
9695 } ) ;
9796
98- $ ( html ) . find ( ".sheet-header .image" ) . on ( "touchmove" , ( e :Event ) => {
97+ $ ( html ) . find ( ".sheet-header .image" ) . on ( "touchmove" , ( e : Event ) => {
9998 this . touchNow = this . _getTouchFrom ( e ) ;
10099
101100 } ) ;
102101
103- $ ( html ) . find ( ".sheet-header .image" ) . on ( "touchend" , ( e :Event ) => {
102+ $ ( html ) . find ( ".sheet-header .image" ) . on ( "touchend" , ( e : Event ) => {
104103 window . clearInterval ( this . interval ) ;
105104 this . touchStart = undefined ;
106105 this . touchNow = undefined ;
107106 } ) ;
108107
109- $ ( html ) . find ( ".sheet-header .image .fa-up-left" ) . on ( "click" , ( e ) => {
108+ $ ( html ) . find ( ".sheet-header .image .fa-up-left" ) . on ( "click" , ( e ) => {
110109 this . tokenMovement . move ( - 1 , - 1 )
111110 } ) ;
112- $ ( html ) . find ( ".sheet-header .image .fa-up" ) . on ( "click" , ( e ) => {
111+ $ ( html ) . find ( ".sheet-header .image .fa-up" ) . on ( "click" , ( e ) => {
113112 this . tokenMovement . move ( 0 , - 1 )
114113 } ) ;
115- $ ( html ) . find ( ".sheet-header .image .fa-up-right" ) . on ( "click" , ( e ) => {
114+ $ ( html ) . find ( ".sheet-header .image .fa-up-right" ) . on ( "click" , ( e ) => {
116115 this . tokenMovement . move ( 1 , - 1 )
117116 } ) ;
118- $ ( html ) . find ( ".sheet-header .image .fa-left" ) . on ( "click" , ( e ) => {
117+ $ ( html ) . find ( ".sheet-header .image .fa-left" ) . on ( "click" , ( e ) => {
119118 this . tokenMovement . move ( - 1 , 0 )
120119 } ) ;
121- $ ( html ) . find ( ".sheet-header .image .fa-right" ) . on ( "click" , ( e ) => {
120+ $ ( html ) . find ( ".sheet-header .image .fa-right" ) . on ( "click" , ( e ) => {
122121 this . tokenMovement . move ( 1 , 0 )
123122 } ) ;
124- $ ( html ) . find ( ".sheet-header .image .fa-down-left" ) . on ( "click" , ( e ) => {
123+ $ ( html ) . find ( ".sheet-header .image .fa-down-left" ) . on ( "click" , ( e ) => {
125124 this . tokenMovement . move ( - 1 , 1 )
126125 } ) ;
127- $ ( html ) . find ( ".sheet-header .image .fa-down" ) . on ( "click" , ( e ) => {
126+ $ ( html ) . find ( ".sheet-header .image .fa-down" ) . on ( "click" , ( e ) => {
128127 this . tokenMovement . move ( 0 , 1 )
129128 } ) ;
130- $ ( html ) . find ( ".sheet-header .image .fa-down-right" ) . on ( "click" , ( e ) => {
129+ $ ( html ) . find ( ".sheet-header .image .fa-down-right" ) . on ( "click" , ( e ) => {
131130 this . tokenMovement . move ( 1 , 1 )
132131 } ) ;
133132 }
134133
135- _getTouchFrom ( e : Event ) :Touch {
134+ _getTouchFrom ( e : Event ) : Touch {
136135 // @ts -ignore
137136 const te : TouchEvent = e . originalEvent ;
138137 return te . touches [ 0 ] ;
139138 }
140-
141-
142139}
143140
144-
0 commit comments