mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-29 02:52:27 +01:00
Add util.Math.constrain.
This commit is contained in:
@@ -402,7 +402,7 @@ function Player() // {{{
|
||||
if (/^[+-]/.test(arg))
|
||||
level = player.volume + level;
|
||||
|
||||
player.volume = Math.min(Math.max(level, 0), 1);
|
||||
player.volume = util.Math.constrain(level, 0, 1);
|
||||
},
|
||||
{ argCount: "1" });
|
||||
|
||||
@@ -528,7 +528,7 @@ function Player() // {{{
|
||||
let min = 0;
|
||||
let max = gMM.playbackControl.duration - 5000; // TODO: 5s buffer like cmus desirable?
|
||||
|
||||
gMM.playbackControl.position = Math.min(Math.max(position, min), max);
|
||||
gMM.playbackControl.position = util.Math.constrain(position, min, max);
|
||||
},
|
||||
|
||||
// FIXME: 10% ?
|
||||
|
||||
Reference in New Issue
Block a user