@@ -57,7 +57,8 @@ class Mapper{
5757 invert : this . invert ,
5858 base : this . base ,
5959 max_deflection : this . max_deflection ,
60- finished : this . finished
60+ finished : this . finished ,
61+ expo : 0
6162 } ;
6263 if ( this . finished ) {
6364 this . completion_handler ( ) ;
@@ -154,7 +155,10 @@ export class Gamepad{
154155 let gamepad_config = localStorage . getItem ( 'gamepad_config' ) ;
155156 gamepad_config = gamepad_config !== null ? JSON . parse ( gamepad_config ) : { } ;
156157 gamepad_config = id in gamepad_config ? gamepad_config [ id ] : null ;
157- return gamepad_config
158+ if ( gamepad_config !== null ) {
159+ this . control_map = gamepad_config ;
160+ this . render_live_view ( )
161+ }
158162 }
159163 reset_config ( id ) {
160164 let gamepad_config = localStorage . getItem ( 'gamepad_config' ) ;
@@ -173,7 +177,6 @@ export class Gamepad{
173177 get_gamepad ( ) {
174178 if ( this . gamepad_index === null ) {
175179 const gamepads = navigator . getGamepads ? navigator . getGamepads ( ) : [ ] ;
176- let new_gamepad = null
177180 for ( let i = 0 ; i < gamepads . length ; i ++ ) {
178181 const gp = gamepads [ i ] ;
179182 if ( gp ) {
@@ -182,11 +185,7 @@ export class Gamepad{
182185 status_element . textContent = 'Gamepad connected: ' + gp . id ;
183186 status_element . className = 'gamepad-connected' ;
184187 document . querySelectorAll ( '.gamepad-mapping-button' ) . forEach ( ( btn ) => { btn . disabled = false ; } ) ;
185- const gamepad_config = this . load_config ( gp . id ) ;
186- if ( gamepad_config !== null ) {
187- this . control_map = gamepad_config ;
188- this . render_live_view ( )
189- }
188+ this . load_config ( gp . id ) ;
190189 break ;
191190 }
192191 }
@@ -211,8 +210,10 @@ export class Gamepad{
211210 const expo_canvas = element . querySelector ( '.gamepad-expo-canvas' ) ;
212211 const expo_slider = element . querySelector ( '.gamepad-slider-expo' )
213212 this . expo_sliders [ control ] = expo_slider ;
213+ expo_slider . value = this . control_map [ control ] . expo
214214 expo_slider . addEventListener ( 'input' , ( event ) => {
215-
215+ this . control_map [ control ] . expo = event . target . value ;
216+ this . save_config ( this . get_gamepad ( ) . id ) ;
216217 } )
217218 expo_plot = new ExpoPlot ( expo_canvas , this . expo_curve ) ;
218219 }
0 commit comments