overte-JulianGro/scripts/developer/tests/tabletTest.js
Anthony J. Thibault 10f9233c90 Fixed js interface after recent Tablet.qml changes
* TabletButton.inDebugMode defaults to false
* TabletButton now listens to onIsActiveChanged event to flip state of button.
* Fixed help.js and tabletTest.js to compensate for the removal of the TabletButton.color property
2016-12-19 12:20:56 -08:00

35 lines
923 B
JavaScript

//
// tabletTest.js
//
// Created by Anthony J. Thibault on 2016-12-15
// Copyright 2016 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
// Adds a BAM! button to the tablet ui.
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var button = tablet.addButton({
text: "BAM!!!"
});
// change the name and isActive state every second...
var names = ["BAM!", "BAM!!", "BAM!!!", "BAM!!!!"];
var nameIndex = 0;
Script.setInterval(function () {
nameIndex = (nameIndex + 1) % names.length;
button.editProperties({
isActive: (nameIndex & 0x1) == 0,
text: names[nameIndex]
});
}, 1000);
button.clicked.connect(function () {
print("AJT: BAM!!! CLICK from JS!");
});
Script.scriptEnding.connect(function () {
tablet.removeButton(button);
});