content/hifi-content/jazmin/dev/scripts/flamescripts/cleanup.js
2022-02-13 23:57:50 +01:00

52 lines
No EOL
1.5 KiB
JavaScript

//
// skype-test.js
//
// Created by Daniel Pearce on 15 July 2017
// Copyright 2017 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
//
(function() { // BEGIN LOCAL_SCOPE
const ROOT = "http://flamesoulis.com/hifi/scripts/release/";
const toolIconUrl = Script.resolvePath(ROOT+"trashcan.svg?"+Math.random());
var toolHeight = 50;
var toolWidth = 50;
var TOOLBAR_MARGIN_Y = 0;
// We persist clientOnly data in the .ini file, and reconsistitute it on restart.
// To keep things consistent, we pickle the tablet data in Settings, and kill any existing such on restart and domain change.
var persistenceKey = "io.highfidelity.lastDomainTablet";
function shouldShowWebTablet() {
var rightPose = Controller.getPoseValue(Controller.Standard.RightHand);
var leftPose = Controller.getPoseValue(Controller.Standard.LeftHand);
var hasHydra = !!Controller.Hardware.Hydra;
return HMD.active && (leftPose.valid || rightPose.valid || hasHydra);
}
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var cleanupButton = tablet.addButton({
icon: toolIconUrl,
//activeIcon: toolIconUrl,
text: "CLEAN UP"
});
function onClick() {
Messages.sendMessage('cleanUpAndSpawnBot', 'cleanUpAndSpawn');
}
cleanupButton.clicked.connect(onClick);
Script.scriptEnding.connect(function () {
cleanupButton.clicked.disconnect(onClick);
tablet.removeButton(cleanupButton);
});
}()); // END LOCAL_SCOPE