From bf2879ee0b8f527148b80848c49075c37732ce56 Mon Sep 17 00:00:00 2001 From: Paul Kaplan Date: Wed, 6 Jun 2018 15:01:02 -0400 Subject: [PATCH] Fix incorrect clamping --- src/sprites/rendered-target.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sprites/rendered-target.js b/src/sprites/rendered-target.js index c104e2469..f9607b8bc 100644 --- a/src/sprites/rendered-target.js +++ b/src/sprites/rendered-target.js @@ -648,7 +648,7 @@ class RenderedTarget extends Target { */ reorderCostume (costumeIndex, newIndex) { newIndex = MathUtil.clamp(newIndex, 0, this.sprite.costumes.length - 1); - costumeIndex = MathUtil.clamp(costumeIndex, this.sprite.costumes.length - 1, costumeIndex); + costumeIndex = MathUtil.clamp(costumeIndex, 0, this.sprite.costumes.length - 1); if (newIndex === costumeIndex) return false; @@ -670,8 +670,8 @@ class RenderedTarget extends Target { * @returns {boolean} If a change occurred (i.e. if the indices do not match) */ reorderSound (soundIndex, newIndex) { - newIndex = MathUtil.clamp(newIndex, 0, this.sprite.costumes.length - 1); - soundIndex = MathUtil.clamp(soundIndex, this.sprite.sounds.length - 1, soundIndex); + newIndex = MathUtil.clamp(newIndex, 0, this.sprite.sounds.length - 1); + soundIndex = MathUtil.clamp(soundIndex, 0, this.sprite.sounds.length - 1); if (newIndex === soundIndex) return false;