fix icon. button lights up when run in enabled

This commit is contained in:
Seth Alves 2018-01-12 15:28:42 -08:00
parent 914e84a346
commit 508a3b37cd
2 changed files with 18 additions and 5 deletions

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" x="0px" y="0px" viewBox="0 0 100 100" enable-background="new 0 0 100 100" xml:space="preserve"><path d="M56.3,18.2c-2.6,0-28.1,0-32.5,0s-5.3,7.1,0,7.1h23.7c0.9,0,1.2,0.6,0.8,1.3c0,0-6,10.8-8.3,14.3c-2.3,3.5-1.1,9,1.7,11 C49.1,57.4,60.5,66,60.5,66c0.7,0.5,1.2,1.6,1.2,2.4c0,0,0,15.2,0,21.7c0,6.5,9.6,6.2,9.6,0c0-4.9,0-27.1,0-27.1 c0-0.8-0.5-1.9-1.2-2.5L53.8,48.5C53.2,48,53,47,53.4,46.3l10.2-17.9C63.5,28.4,58.9,18.2,56.3,18.2z M38.1,53.8l-8.6,12.1 c0,0-4.4-3.1-9.5-7.2c-5-4.1-10.9,2.8-5.8,6.8c2.6,2,6.8,5.2,10.3,8c3.6,2.8,9,3.2,12.6-2.1c5.2-7.8,8.2-12,8.2-12L38.1,53.8z M61.2,39.8c0,0,4.8,7,6.8,10.1c2.1,3,6.7,2.3,9.8,0c3.1-2.3,6.1-4.3,8.3-6c3.6-2.7-0.1-8.6-3.9-6c-4.7,3.3-7.7,5.7-7.7,5.7 c-0.6,0.5-1.5,0.4-2-0.4L65.9,32L61.2,39.8z M61.8,7.5c-3.7,6.2,0.9,12.7,3.8,14.4c2.1,1.3,5.1,2.6,8.3-2.7s3.3-8.8-3-12.6 C68.8,5.4,64.3,3.3,61.8,7.5z"></path></svg>

After

Width:  |  Height:  |  Size: 955 B

View file

@ -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});
}
}());