diff --git a/scripts/system/assets/images/run.svg b/scripts/system/assets/images/run.svg new file mode 100644 index 0000000000..0957166346 --- /dev/null +++ b/scripts/system/assets/images/run.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/scripts/system/run.js b/scripts/system/run.js index edd6e20021..054cca6d9c 100644 --- a/scripts/system/run.js +++ b/scripts/system/run.js @@ -3,18 +3,24 @@ /* global Script, Tablet, MyAvatar */ (function() { // BEGIN LOCAL_SCOPE + var WALK_SPEED = 2.6; + var RUN_SPEED = 4.5; + var MIDDLE_SPEED = (WALK_SPEED + RUN_SPEED) / 2.0; + var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); var button = tablet.addButton({ - icon: Script.resolvePath("assets/images/icon-particles.svg"), - text: "Run", + icon: Script.resolvePath("assets/images/run.svg"), + text: "RUN", sortOrder: 15 }); function onClicked() { - if (MyAvatar.walkSpeed < 4) { - MyAvatar.walkSpeed = 4.5; + if (MyAvatar.walkSpeed < MIDDLE_SPEED) { + button.editProperties({isActive: true}); + MyAvatar.walkSpeed = RUN_SPEED; } else { - MyAvatar.walkSpeed = 2.6; + button.editProperties({isActive: false}); + MyAvatar.walkSpeed = WALK_SPEED; } } @@ -24,4 +30,10 @@ } button.clicked.connect(onClicked); + if (MyAvatar.walkSpeed < MIDDLE_SPEED) { + button.editProperties({isActive: false}); + } else { + button.editProperties({isActive: true}); + } + }());