From 585691f71ca974b17ce455b62e6a3908aea58289 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Fri, 17 Feb 2017 19:29:11 +1300 Subject: [PATCH] Add finger painting button to tablet --- .../icons/tablet-icons/finger-paint-a.svg | 96 +++++++++++++++++++ .../icons/tablet-icons/finger-paint-i.svg | 46 +++++++++ scripts/system/fingerPaint.js | 44 +++++++++ 3 files changed, 186 insertions(+) create mode 100644 interface/resources/icons/tablet-icons/finger-paint-a.svg create mode 100644 interface/resources/icons/tablet-icons/finger-paint-i.svg create mode 100644 scripts/system/fingerPaint.js diff --git a/interface/resources/icons/tablet-icons/finger-paint-a.svg b/interface/resources/icons/tablet-icons/finger-paint-a.svg new file mode 100644 index 0000000000..553636bfbb --- /dev/null +++ b/interface/resources/icons/tablet-icons/finger-paint-a.svg @@ -0,0 +1,96 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/interface/resources/icons/tablet-icons/finger-paint-i.svg b/interface/resources/icons/tablet-icons/finger-paint-i.svg new file mode 100644 index 0000000000..d7c8948e01 --- /dev/null +++ b/interface/resources/icons/tablet-icons/finger-paint-i.svg @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/scripts/system/fingerPaint.js b/scripts/system/fingerPaint.js new file mode 100644 index 0000000000..c154f2d81d --- /dev/null +++ b/scripts/system/fingerPaint.js @@ -0,0 +1,44 @@ +// +// fingerPaint.js +// +// Created by David Rowe on 15 Feb 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 () { + var tablet, + button, + BUTTON_NAME = "PAINT", + isFingerPainting = false; + + function onButtonClicked() { + isFingerPainting = !isFingerPainting; + button.editProperties({ isActive: isFingerPainting }); + } + + function setUp() { + tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); + if (tablet) { + button = tablet.addButton({ + icon: "icons/tablet-icons/bubble-i.svg", + activeIcon: "icons/tablet-icons/bubble-a.svg", + text: BUTTON_NAME, + isActive: isFingerPainting + }); + button.clicked.connect(onButtonClicked); + } + } + + function tearDown() { + if (tablet) { + button.clicked.disconnect(onButtonClicked); + tablet.removeButton(button); + } + } + + setUp(); + Script.scriptEnding.connect(tearDown); +}()); \ No newline at end of file