1
0
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:
Doug Kearns
2009-05-30 20:29:23 +10:00
parent 3e984c776d
commit 95dffaf95a
5 changed files with 27 additions and 14 deletions

View File

@@ -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% ?