mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-25 07:22:33 -05:00
Fix incorrect clamping
This commit is contained in:
parent
0cd50fbb2c
commit
bf2879ee0b
1 changed files with 3 additions and 3 deletions
|
@ -648,7 +648,7 @@ class RenderedTarget extends Target {
|
||||||
*/
|
*/
|
||||||
reorderCostume (costumeIndex, newIndex) {
|
reorderCostume (costumeIndex, newIndex) {
|
||||||
newIndex = MathUtil.clamp(newIndex, 0, this.sprite.costumes.length - 1);
|
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;
|
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)
|
* @returns {boolean} If a change occurred (i.e. if the indices do not match)
|
||||||
*/
|
*/
|
||||||
reorderSound (soundIndex, newIndex) {
|
reorderSound (soundIndex, newIndex) {
|
||||||
newIndex = MathUtil.clamp(newIndex, 0, this.sprite.costumes.length - 1);
|
newIndex = MathUtil.clamp(newIndex, 0, this.sprite.sounds.length - 1);
|
||||||
soundIndex = MathUtil.clamp(soundIndex, this.sprite.sounds.length - 1, soundIndex);
|
soundIndex = MathUtil.clamp(soundIndex, 0, this.sprite.sounds.length - 1);
|
||||||
|
|
||||||
if (newIndex === soundIndex) return false;
|
if (newIndex === soundIndex) return false;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue