@@ -271,17 +271,14 @@ class FlxSlider extends #if (flixel < version("5.7.0")) FlxSpriteGroup #else Flx
271271 override public function update (elapsed : Float ): Void
272272 {
273273 // Clicking and sound logic
274- #if (flixel >= version("5.7.0"))
275- final camera = getCameras ()[0 ];// else use this.camera
276- #end
277- #if (flixel >= version("5.9.0"))
278- final viewX = FlxG .mouse .viewX ;
279- final viewY = FlxG .mouse .viewY ;
274+ #if (flixel >= "5.7.0")
275+ final cam = getDefaultCamera ();
280276 #else
281- final viewX = FlxG .mouse .screenX ;
282- final viewY = FlxG .mouse .screenY ;
277+ final cam = this .camera ;
283278 #end
284- if (FlxMath .pointInFlxRect (viewX , viewY , _bounds ))
279+ final mousePosition = FlxG .mouse .getViewPosition (cam );
280+
281+ if (FlxMath .pointInFlxRect (mousePosition .x , mousePosition .y , _bounds ))
285282 {
286283 if (hoverAlpha != 1 )
287284 {
@@ -299,7 +296,7 @@ class FlxSlider extends #if (flixel < version("5.7.0")) FlxSpriteGroup #else Flx
299296
300297 if (FlxG .mouse .pressed )
301298 {
302- handle .x = viewX ;
299+ handle .x = mousePosition . x ;
303300 updateValue ();
304301
305302 #if FLX_SOUND_SYSTEM
@@ -326,7 +323,7 @@ class FlxSlider extends #if (flixel < version("5.7.0")) FlxSpriteGroup #else Flx
326323 }
327324
328325 // Update the target value whenever the slider is being used
329- if ((FlxG .mouse .pressed ) && (FlxMath .mouseInFlxRect ( false , _bounds )))
326+ if ((FlxG .mouse .pressed ) && (FlxMath .pointInFlxRect ( mousePosition . x , mousePosition . y , _bounds )))
330327 {
331328 updateValue ();
332329 }
@@ -346,6 +343,9 @@ class FlxSlider extends #if (flixel < version("5.7.0")) FlxSpriteGroup #else Flx
346343 // Finally, update the valueLabel
347344 valueLabel .text = Std .string (FlxMath .roundDecimal (value , decimals ));
348345
346+ mousePosition .put ();
347+
348+
349349 super .update (elapsed );
350350 }
351351
0 commit comments