@@ -30,8 +30,11 @@ class MouseToJoy extends _Plugin {
3030 ; ~ Gui, Add, Button, % "x+5 yp hwndhwnd", Calibrate
3131 ; ~ fn := this.Calibrate.Bind(this, "X")
3232 ; ~ GuiControl +g, % hwnd, % fn
33- Gui , Add , Text , % " x120 w40 center y" title_row, Timeout
34- this.AddControl(" AbsoluteTimeout" , this.TimeoutChanged.Bind(this, " X" ), " Edit" , " x120 w40 y" x_row + 10 , 50 )
33+ Gui , Add , Text , % " x120 w40 center y" title_row- 5 , Timeout
34+ this.AddControl(" AbsoluteTimeout" , this.TimeoutChanged.Bind(this, " X" ), " Edit" , " x120 w40 y" x_row - 10 , 50 )
35+
36+ Gui , Add , Text , % " x120 w40 center y" y_row - 10 , Threshold
37+ this.AddControl(" AbsoluteThreshold" , this.TimeoutChanged.Bind(this, " X" ), " Edit" , " x120 w40 y" y_row + 5 , 2 )
3538
3639 this.AddControl(" AbsoluteScaleY" , this.AbsoluteScaleChanged.Bind(this, " Y" ), " Edit" , " x70 w30 y" y_row, 10 )
3740 ; ~ Gui, Add, Button, % "x+5 yp hwndhwnd", Calibrate
@@ -118,7 +121,7 @@ class MouseToJoy extends _Plugin {
118121 MouseEvent (value ){
119122 ; The "Range" for a given axis is -50 to +50
120123 try {
121- x := value.axes.x, y := value.axes.y, MouseID := value.MouseID, dox := (x ! = "" ), doy := (y ! = "" )
124+ x := value.axes.x, y := value.axes.y, ax := Abs (x), ay := Abs (y), MouseID := value.MouseID, dox := (x ! = "" ), doy := (y ! = "" )
122125 } catch {
123126 ; M2J sometimes seems to crash eg when switching from a profile with M2J to a profile without
124127 ; This seems to fix it, but this should probably be properly investigated.
@@ -129,11 +132,20 @@ class MouseToJoy extends _Plugin {
129132 return
130133
131134 if (this.Mode = 1 ){
132- if (dox)
135+ ; Absolute
136+ threshold := this.GuiControls.AbsoluteThreshold.value
137+ if (dox && ax && ax <= threshold)
138+ dox := 0
139+ if (doy && ay && ay <= threshold)
140+ doy := 0
141+ if (dox){
133142 this.CurrX := x * this.AbsoluteScaleFactor.X
134- if (doy)
143+ }
144+ if (doy){
135145 this.CurrY := y * this.AbsoluteScaleFactor.Y
146+ }
136147 } else {
148+ ; Relative
137149 if (dox){
138150 if (this.GuiControls.InvertX.value)
139151 x * = - 1
0 commit comments