Merge pull request #13965 from ctrlaltdavid/M17428-f

Mini tablet in palm
This commit is contained in:
John Conklin II 2018-10-01 16:56:36 -07:00 committed by GitHub
commit 9cbd819a39
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 1511 additions and 32 deletions

View file

@ -963,7 +963,7 @@ Q_GUI_EXPORT void qt_gl_set_global_share_context(QOpenGLContext *context);
Setting::Handle<int> sessionRunTime{ "sessionRunTime", 0 };
const float DEFAULT_HMD_TABLET_SCALE_PERCENT = 70.0f;
const float DEFAULT_HMD_TABLET_SCALE_PERCENT = 60.0f;
const float DEFAULT_DESKTOP_TABLET_SCALE_PERCENT = 75.0f;
const bool DEFAULT_DESKTOP_TABLET_BECOMES_TOOLBAR = true;
const bool DEFAULT_HMD_TABLET_BECOMES_TOOLBAR = false;

View file

@ -57,6 +57,10 @@ class QScriptEngine;
* @property {Uuid} tabletScreenID - The UUID of the tablet's screen overlay.
* @property {Uuid} homeButtonID - The UUID of the tablet's "home" button overlay.
* @property {Uuid} homeButtonHighlightID - The UUID of the tablet's "home" button highlight overlay.
* @property {Uuid} miniTabletID - The UUID of the mini tablet's body model overlay. <code>null</code> if not in HMD mode.
* @property {Uuid} miniTabletScreenID - The UUID of the mini tablet's screen overlay. <code>null</code> if not in HMD mode.
* @property {number} miniTabletHand - The hand that the mini tablet is displayed on: <code>0</code> for left hand,
* <code>1</code> for right hand, <code>-1</code> if not in HMD mode.
*/
class HMDScriptingInterface : public AbstractHMDScriptingInterface, public Dependency {
Q_OBJECT
@ -68,6 +72,9 @@ class HMDScriptingInterface : public AbstractHMDScriptingInterface, public Depen
Q_PROPERTY(QUuid homeButtonID READ getCurrentHomeButtonID WRITE setCurrentHomeButtonID)
Q_PROPERTY(QUuid tabletScreenID READ getCurrentTabletScreenID WRITE setCurrentTabletScreenID)
Q_PROPERTY(QUuid homeButtonHighlightID READ getCurrentHomeButtonHighlightID WRITE setCurrentHomeButtonHighlightID)
Q_PROPERTY(QUuid miniTabletID READ getCurrentMiniTabletID WRITE setCurrentMiniTabletID)
Q_PROPERTY(QUuid miniTabletScreenID READ getCurrentMiniTabletScreenID WRITE setCurrentMiniTabletScreenID)
Q_PROPERTY(int miniTabletHand READ getCurrentMiniTabletHand WRITE setCurrentMiniTabletHand)
public:
@ -368,6 +375,15 @@ public:
void setCurrentTabletScreenID(QUuid tabletID) { _tabletScreenID = tabletID; }
QUuid getCurrentTabletScreenID() const { return _tabletScreenID; }
void setCurrentMiniTabletID(QUuid miniTabletID) { _miniTabletID = miniTabletID; }
QUuid getCurrentMiniTabletID() const { return _miniTabletID; }
void setCurrentMiniTabletScreenID(QUuid miniTabletScreenID) { _miniTabletScreenID = miniTabletScreenID; }
QUuid getCurrentMiniTabletScreenID() const { return _miniTabletScreenID; }
void setCurrentMiniTabletHand(int miniTabletHand) { _miniTabletHand = miniTabletHand; }
int getCurrentMiniTabletHand() const { return _miniTabletHand; }
private:
bool _showTablet { false };
bool _tabletContextualMode { false };
@ -376,6 +392,9 @@ private:
QUuid _homeButtonID;
QUuid _tabletEntityID;
QUuid _homeButtonHighlightID;
QUuid _miniTabletID;
QUuid _miniTabletScreenID;
int _miniTabletHand { -1 };
// Get the position of the HMD
glm::vec3 getPosition() const;

View file

@ -116,32 +116,33 @@ void MessagesClient::handleMessagesPacket(QSharedPointer<ReceivedMessage> receiv
void MessagesClient::sendMessage(QString channel, QString message, bool localOnly) {
auto nodeList = DependencyManager::get<NodeList>();
QUuid senderID = nodeList->getSessionUUID();
if (localOnly) {
QUuid senderID = nodeList->getSessionUUID();
emit messageReceived(channel, message, senderID, true);
} else {
SharedNodePointer messagesMixer = nodeList->soloNodeOfType(NodeType::MessagesMixer);
if (messagesMixer) {
QUuid senderID = nodeList->getSessionUUID();
auto packetList = encodeMessagesPacket(channel, message, senderID);
nodeList->sendPacketList(std::move(packetList), *messagesMixer);
} else {
emit messageReceived(channel, message, senderID, true);
}
}
}
void MessagesClient::sendData(QString channel, QByteArray data, bool localOnly) {
auto nodeList = DependencyManager::get<NodeList>();
QUuid senderID = nodeList->getSessionUUID();
if (localOnly) {
QUuid senderID = nodeList->getSessionUUID();
emit dataReceived(channel, data, senderID, true);
} else {
SharedNodePointer messagesMixer = nodeList->soloNodeOfType(NodeType::MessagesMixer);
if (messagesMixer) {
QUuid senderID = nodeList->getSessionUUID();
auto packetList = encodeMessagesDataPacket(channel, data, senderID);
nodeList->sendPacketList(std::move(packetList), *messagesMixer);
} else {
emit dataReceived(channel, data, senderID, true);
}
}
}

View file

@ -31,7 +31,8 @@ var DEFAULT_SCRIPTS_COMBINED = [
"system/dialTone.js",
"system/firstPersonHMD.js",
"system/tablet-ui/tabletUI.js",
"system/emote.js"
"system/emote.js",
"system/miniTablet.js"
];
var DEFAULT_SCRIPTS_SEPARATE = [
"system/controllers/controllerScripts.js",

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -25,7 +25,9 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
(function() {
Script.include("/~/system/libraries/pointersUtils.js");
var NEAR_MAX_RADIUS = 0.1;
var NEAR_TABLET_MAX_RADIUS = 0.05;
var TARGET_UPDATE_HZ = 60; // 50hz good enough, but we're using update
var BASIC_TIMER_INTERVAL_MS = 1000 / TARGET_UPDATE_HZ;
@ -211,6 +213,24 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
if (controllerLocations[h].valid) {
var nearbyOverlays =
Overlays.findOverlays(controllerLocations[h].position, NEAR_MAX_RADIUS * sensorScaleFactor);
// Tablet and mini-tablet must be within NEAR_TABLET_MAX_RADIUS in order to be grabbed.
// Mini tablet can only be grabbed the hand it's displayed on.
var tabletIndex = nearbyOverlays.indexOf(HMD.tabletID);
var miniTabletIndex = nearbyOverlays.indexOf(HMD.miniTabletID);
if (tabletIndex !== -1 || miniTabletIndex !== -1) {
var closebyOverlays =
Overlays.findOverlays(controllerLocations[h].position, NEAR_TABLET_MAX_RADIUS * sensorScaleFactor);
// Assumes that the tablet and mini-tablet are not displayed at the same time.
if (tabletIndex !== -1 && closebyOverlays.indexOf(HMD.tabletID) === -1) {
nearbyOverlays.splice(tabletIndex, 1);
}
if (miniTabletIndex !== -1
&& ((closebyOverlays.indexOf(HMD.miniTabletID) === -1) || h !== HMD.miniTabletHand)) {
nearbyOverlays.splice(miniTabletIndex, 1);
}
}
nearbyOverlays.sort(function (a, b) {
var aPosition = Overlays.getProperty(a, "position");
var aDistance = Vec3.distance(aPosition, controllerLocations[h].position);
@ -218,6 +238,7 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
var bDistance = Vec3.distance(bPosition, controllerLocations[h].position);
return aDistance - bDistance;
});
nearbyOverlayIDs.push(nearbyOverlays);
} else {
nearbyOverlayIDs.push([]);
@ -449,14 +470,14 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
filter: Picks.PICK_ENTITIES | Picks.PICK_OVERLAYS,
enabled: true
});
this.handleHandMessage = function(channel, message, sender) {
var data;
this.handleHandMessage = function(channel, data, sender) {
var message;
if (sender === MyAvatar.sessionUUID) {
try {
if (channel === 'Hifi-Hand-RayPick-Blacklist') {
data = JSON.parse(message);
var action = data.action;
var id = data.id;
message = JSON.parse(data);
var action = message.action;
var id = message.id;
var index = _this.blacklist.indexOf(id);
if (action === 'add' && index === -1) {
@ -471,9 +492,8 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
}
}
}
} catch (e) {
print("WARNING: handControllerGrab.js -- error parsing Hifi-Hand-RayPick-Blacklist message: " + message);
print("WARNING: handControllerGrab.js -- error parsing message: " + data);
}
}
};

View file

@ -163,7 +163,10 @@ Script.include("/~/system/libraries/utils.js");
var handPosition = controllerData.controllerLocations[this.hand].position;
var distance = Vec3.distance(overlayPosition, handPosition);
if (distance <= NEAR_GRAB_RADIUS * sensorScaleFactor) {
return overlays[i];
if (overlays[i] !== HMD.miniTabletID || controllerData.secondaryValues[this.hand] === 0) {
// Don't grab mini tablet with grip.
return overlays[i];
}
}
}
return null;

View file

@ -35,13 +35,6 @@ Script.include("/~/system/libraries/controllers.js");
};
}
function getEntityDistance(controllerPosition, entityProps) {
return {
id: entityProps.id,
distance: Vec3.distance(entityProps.position, controllerPosition)
};
}
function StylusInput(hand) {
this.hand = hand;
@ -123,6 +116,14 @@ Script.include("/~/system/libraries/controllers.js");
}
}
// Add the mini tablet.
if (HMD.miniTabletScreenID && Overlays.getProperty(HMD.miniTabletScreenID, "visible")) {
stylusTarget = getOverlayDistance(controllerPosition, HMD.miniTabletScreenID);
if (stylusTarget) {
stylusTargets.push(stylusTarget);
}
}
var WEB_DISPLAY_STYLUS_DISTANCE = 0.5;
var nearStylusTarget = isNearStylusTarget(stylusTargets, WEB_DISPLAY_STYLUS_DISTANCE * sensorScaleFactor);

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" baseProfile="full" width="50" height="50" viewBox="0 0 50.00 50.00" enable-background="new 0 0 50.00 50.00" xml:space="preserve">
<ellipse fill="#303030" fill-opacity="1" stroke-width="2" stroke-linejoin="round" stroke="#1FC6A6" stroke-opacity="1" cx="25" cy="25" rx="24" ry="24"/>
</svg>

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" baseProfile="full" width="50" height="50" viewBox="0 0 50.00 50.00" enable-background="new 0 0 50.00 50.00" xml:space="preserve">
<ellipse fill="#303030" fill-opacity="1" stroke-width="2" stroke-linejoin="round" stroke="#606060" stroke-opacity="1" cx="25" cy="25" rx="24" ry="24"/>
</svg>

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" baseProfile="full" width="115.966" height="84.0209" viewBox="0 0 115.97 84.02" enable-background="new 0 0 115.97 84.02" xml:space="preserve">
<path fill="#303030" fill-opacity="1" stroke-width="2" stroke-linejoin="round" stroke="#1FC6A6" stroke-opacity="1" d="M 8.72651,1L 107.239,1C 111.507,1 114.966,4.33753 114.966,8.45455L 114.928,47.1459C 114.928,47.6244 109.928,44.6459 100.928,46.3959C 95.7749,47.3979 90.1783,50.1459 87.6783,52.3959C 85.9019,53.9946 81.0533,57.5209 78.1783,66.3959C 75.1445,75.7609 78.2986,83.0209 77.8032,83.0209L 8.72651,83C 4.45927,83 1,79.6625 1,75.5454L 1,8.45455C 1,4.33753 4.45927,1 8.72651,1 Z "/>
</svg>

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" baseProfile="full" width="115.966" height="84.0209" viewBox="0 0 115.97 84.02" enable-background="new 0 0 115.97 84.02" xml:space="preserve">
<path fill="#303030" fill-opacity="1" stroke-width="2" stroke-linejoin="round" stroke="#606060" stroke-opacity="1" d="M 8.72651,1L 107.239,1C 111.507,1 114.966,4.33753 114.966,8.45455L 114.928,47.1459C 114.928,47.6244 109.928,44.6459 100.928,46.3959C 95.7749,47.3979 90.1783,50.1459 87.6783,52.3959C 85.9019,53.9946 81.0533,57.5209 78.1783,66.3959C 75.1445,75.7609 78.2986,83.0209 77.8032,83.0209L 8.72651,83C 4.45927,83 1,79.6625 1,75.5454L 1,8.45455C 1,4.33753 4.45927,1 8.72651,1 Z "/>
</svg>

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" baseProfile="full" width="116" height="84" viewBox="0 0 116.00 84.00" enable-background="new 0 0 116.00 84.00" xml:space="preserve">
<path fill="#303030" fill-opacity="1" stroke-width="2" stroke-linejoin="round" stroke="#1FC6A6" stroke-opacity="1" d="M 9,1L 107,1C 111.418,1 115,4.58173 115,9L 115,75C 115,79.4183 111.418,83 107,83L 9,83C 4.58172,83 1,79.4183 1,75L 1,9C 1,4.58173 4.58172,1 9,1 Z "/>
</svg>

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" baseProfile="full" width="116" height="84" viewBox="0 0 116.00 84.00" enable-background="new 0 0 116.00 84.00" xml:space="preserve">
<path fill="#303030" fill-opacity="1" stroke-width="2" stroke-linejoin="round" stroke="#606060" stroke-opacity="1" d="M 9.00003,1L 107,1C 111.419,1 115,4.58173 115,9L 115,75C 115,79.4183 111.419,83 107,83L 9.00003,83C 4.58173,83 0.999996,79.4183 0.999996,75L 0.999996,9C 0.999996,4.58173 4.58173,1 9.00003,1 Z "/>
</svg>

View file

@ -0,0 +1,92 @@
/*
miniTablet.css
Created by David Rowe on 20 Aug 2018.
Copyright 2018 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
*/
* {
box-sizing: border-box;
padding: 0;
margin: 0;
user-select: none;
}
html {
background-color: #404040;
}
body {
height: 100%;
}
section {
background-color: #404040;
position: relative;
padding: 16px 16px;
}
.button {
width: 116px;
height: 84px;
margin-top: 16px;
text-align: center;
}
.button:first-child {
margin-top: 0;
}
img {
width: 40px;
}
#mute {
padding-top: 19px;
background-size: 100% 100%;
background-image: url("./img/mt-mute-normal.svg");
}
#mute:hover {
background-image: url("./img/mt-mute-hover.svg");
}
#goto {
padding-top: 19px;
background-size: 100% 100%;
background-image: url("./img/mt-goto-normal.svg");
}
#goto:hover {
background-image: url("./img/mt-goto-hover.svg");
}
#goto:hover.unhover {
background-image: url("./img/mt-goto-normal.svg");
}
#expand {
position: absolute;
right: 1px;
bottom: -1px;
width: 50px;
height: 50px;
background-size: 100% 100%;
background-image: url("./img/mt-expand-normal.svg");
}
#expand:hover {
background-image: url("./img/mt-expand-hover.svg");
}
#expand:hover.unhover {
background-image: url("./img/mt-expand-normal.svg");
}
#expand img {
width:34px;
margin-top: 7px;
}

View file

@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Adobe Illustrator 22.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
id="Layer_1"
x="0px"
y="0px"
viewBox="0 0 50 49.999999"
xml:space="preserve"
sodipodi:docname="expandIcon.svg"
inkscape:version="0.92.3 (2405546, 2018-03-11)"
width="50"
height="50"><metadata
id="metadata21"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs19" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="980"
inkscape:window-height="792"
id="namedview17"
showgrid="false"
inkscape:zoom="2"
inkscape:cx="12.25"
inkscape:cy="62.4"
inkscape:window-x="249"
inkscape:window-y="99"
inkscape:window-maximized="0"
inkscape:current-layer="Layer_1"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
showguides="false" />
<style
type="text/css"
id="style2">
.st0{opacity:0.7;fill:#1B1B1B;stroke:#FFFFFF;stroke-width:4.6505;stroke-miterlimit:10;}
.st1{fill:#FFFFFF;}
</style>
<g
id="g14"
transform="matrix(0.25,0,0,0.25,-214.575,-109.6)">
<path
class="st1"
d="m 919.2,490.4 h 8.5 c 3.9,0 7.1,-3.2 7.1,-7.1 0,-3.9 -3.2,-7.1 -7.1,-7.1 H 902 c 0,0 0,0 -0.1,0 -0.4,0 -0.9,0 -1.3,0.1 -0.2,0 -0.4,0.1 -0.6,0.2 -0.2,0.1 -0.5,0.1 -0.7,0.2 -0.2,0.1 -0.5,0.2 -0.7,0.4 -0.2,0.1 -0.4,0.2 -0.5,0.3 -0.4,0.3 -0.7,0.5 -1.1,0.9 0,0 0,0 0,0 0,0 0,0 0,0 -0.1,0.1 -0.1,0.2 -0.2,0.3 -1.5,1.3 -2.4,3.2 -2.4,5.3 v 25.7 c 0,3.9 3.2,7.1 7.1,7.1 3.9,0 7.1,-3.2 7.1,-7.1 v -9.7 l 24.1,24.1 c 1.4,1.4 3.2,2.1 5,2.1 1.8,0 3.7,-0.7 5,-2.1 2.8,-2.8 2.8,-7.3 0,-10.1 z"
id="path6"
inkscape:connector-curvature="0"
style="fill:#ffffff" />
<path
class="st1"
d="m 932.6,554.6 -24.1,24.1 V 569 c 0,-3.9 -3.2,-7.1 -7.1,-7.1 -3.9,0 -7.1,3.2 -7.1,7.1 v 25.7 c 0,2.1 0.9,4 2.4,5.3 0.4,0.5 0.8,0.9 1.3,1.2 0.2,0.1 0.4,0.2 0.5,0.3 0.2,0.1 0.5,0.3 0.7,0.4 0.2,0.1 0.5,0.1 0.7,0.2 0.2,0.1 0.4,0.1 0.6,0.2 0.5,0.1 0.9,0.1 1.4,0.1 h 25.7 c 3.9,0 7.1,-3.2 7.1,-7.1 0,-3.9 -3.2,-7.1 -7.1,-7.1 h -8.5 l 23.5,-23.5 c 2.8,-2.8 2.8,-7.3 0,-10.1 -2.7,-2.8 -7.2,-2.8 -10,0 z"
id="path8"
inkscape:connector-curvature="0"
style="fill:#ffffff" />
<path
class="st1"
d="m 1018.7,561.9 c -3.9,0 -7.1,3.2 -7.1,7.1 v 9.7 l -24.1,-24.1 c -2.8,-2.8 -7.3,-2.8 -10.1,0 -2.8,2.8 -2.8,7.3 0,10.1 l 23.5,23.5 h -8.5 c -3.9,0 -7.1,3.2 -7.1,7.1 0,3.9 3.2,7.1 7.1,7.1 h 25.7 c 0.5,0 0.9,0 1.4,-0.1 0.2,0 0.4,-0.1 0.6,-0.2 0.2,-0.1 0.5,-0.1 0.7,-0.2 0.3,-0.1 0.5,-0.2 0.7,-0.4 0.2,-0.1 0.3,-0.2 0.5,-0.3 0.5,-0.3 0.9,-0.8 1.4,-1.2 1.5,-1.3 2.4,-3.2 2.4,-5.3 V 569 c 0,-3.9 -3.1,-7.1 -7.1,-7.1 z"
id="path10"
inkscape:connector-curvature="0"
style="fill:#ffffff" />
<path
class="st1"
d="m 982.2,526 c 1.8,0 3.6,-0.7 5,-2.1 l 24.1,-24.1 v 9.7 c 0,3.9 3.2,7.1 7.1,7.1 3.9,0 7.1,-3.2 7.1,-7.1 v -25.7 c 0,-2.1 -0.9,-4 -2.4,-5.3 -0.4,-0.5 -0.8,-0.9 -1.3,-1.2 -0.2,-0.1 -0.3,-0.2 -0.5,-0.3 -0.2,-0.1 -0.5,-0.3 -0.7,-0.4 -0.2,-0.1 -0.5,-0.1 -0.7,-0.2 -0.2,-0.1 -0.4,-0.1 -0.6,-0.2 -0.5,-0.1 -0.9,-0.1 -1.4,-0.1 h -25.7 c -3.9,0 -7.1,3.2 -7.1,7.1 0,3.9 3.2,7.1 7.1,7.1 h 8.5 l -23.5,23.5 c -2.8,2.8 -2.8,7.3 0,10.1 1.4,1.4 3.2,2.1 5,2.1 z"
id="path12"
inkscape:connector-curvature="0"
style="fill:#ffffff" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.9 KiB

View file

@ -0,0 +1,157 @@
//
// miniTablet.js
//
// Created by David Rowe on 20 Aug 2018.
// Copyright 2018 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
//
/* global EventBridge */
/* eslint-env browser */
(function () {
"use strict";
var // EventBridge
READY_MESSAGE = "ready", // Engine <== Dialog
HOVER_MESSAGE = "hover", // Engine <== Dialog
UNHOVER_MESSAGE = "unhover", // Engine <== Dialog
MUTE_MESSAGE = "mute", // Engine <=> Dialog
GOTO_MESSAGE = "goto", // Engine <=> Dialog
EXPAND_MESSAGE = "expand", // Engine <== Dialog
muteButton,
muteImage,
gotoButton,
gotoImage,
expandButton,
// Work around buttons staying hovered when mini tablet is replaced by tablet proper then subsequently redisplayed.
isUnhover = true;
function setUnhover() {
if (!isUnhover) {
gotoButton.classList.add("unhover");
expandButton.classList.add("unhover");
isUnhover = true;
}
}
function clearUnhover() {
if (isUnhover) {
gotoButton.classList.remove("unhover");
expandButton.classList.remove("unhover");
isUnhover = false;
}
}
function onScriptEventReceived(data) {
var message;
try {
message = JSON.parse(data);
} catch (e) {
console.error("EventBridge message error");
return;
}
switch (message.type) {
case MUTE_MESSAGE:
muteImage.src = message.icon;
break;
case GOTO_MESSAGE:
gotoImage.src = message.icon;
break;
}
}
function onBodyHover() {
EventBridge.emitWebEvent(JSON.stringify({
type: HOVER_MESSAGE,
target: "body"
}));
}
function onBodyUnhover() {
EventBridge.emitWebEvent(JSON.stringify({
type: UNHOVER_MESSAGE,
target: "body"
}));
}
function onButtonHover() {
EventBridge.emitWebEvent(JSON.stringify({
type: HOVER_MESSAGE,
target: "button"
}));
clearUnhover();
}
function onMuteButtonClick() {
EventBridge.emitWebEvent(JSON.stringify({
type: MUTE_MESSAGE
}));
}
function onGotoButtonClick() {
setUnhover();
EventBridge.emitWebEvent(JSON.stringify({
type: GOTO_MESSAGE
}));
}
function onExpandButtonClick() {
setUnhover();
EventBridge.emitWebEvent(JSON.stringify({
type: EXPAND_MESSAGE
}));
}
function connectEventBridge() {
EventBridge.scriptEventReceived.connect(onScriptEventReceived);
EventBridge.emitWebEvent(JSON.stringify({
type: READY_MESSAGE
}));
}
function disconnectEventBridge() {
EventBridge.scriptEventReceived.disconnect(onScriptEventReceived);
}
function onUnload() {
disconnectEventBridge();
}
function onLoad() {
muteButton = document.getElementById("mute");
muteImage = document.getElementById("mute-img");
gotoButton = document.getElementById("goto");
gotoImage = document.getElementById("goto-img");
expandButton = document.getElementById("expand");
connectEventBridge();
document.body.addEventListener("mouseenter", onBodyHover, false);
document.body.addEventListener("mouseleave", onBodyUnhover, false);
muteButton.addEventListener("mouseenter", onButtonHover, false);
gotoButton.addEventListener("mouseenter", onButtonHover, false);
expandButton.addEventListener("mouseenter", onButtonHover, false);
muteButton.addEventListener("click", onMuteButtonClick, true);
gotoButton.addEventListener("click", onGotoButtonClick, true);
expandButton.addEventListener("click", onExpandButtonClick, true);
document.body.onunload = function () {
onUnload();
};
}
onLoad();
}());

View file

@ -0,0 +1,32 @@
<!--
miniTablet.html
Created by David Rowe on 20 Aug 2018.
Copyright 2018 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
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<link rel="stylesheet" type="text/css" href="css/miniTablet.css" />
</head>
<body>
<section>
<div id="mute" class="button">
<img id="mute-img" />
</div>
<div id="goto" class="button">
<img id="goto-img" />
</div>
<div id="expand" class="button">
<img src="./img/expand.svg" />
</div>
</section>
<script src="js/miniTablet.js"></script>
</body>
</html>

View file

@ -356,13 +356,14 @@ getTabletWidthFromSettings = function () {
var DEFAULT_TABLET_WIDTH = 0.4375;
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var toolbarMode = tablet.toolbarMode;
var DEFAULT_TABLET_SCALE = 70;
var tabletScalePercentage = DEFAULT_TABLET_SCALE;
var DEFAULT_DESKTOP_TABLET_SCALE = 75;
var DEFAULT_HMD_TABLET_SCALE = 60;
var tabletScalePercentage = DEFAULT_HMD_TABLET_SCALE;
if (!toolbarMode) {
if (HMD.active) {
tabletScalePercentage = Settings.getValue("hmdTabletScale") || DEFAULT_TABLET_SCALE;
tabletScalePercentage = Settings.getValue("hmdTabletScale") || DEFAULT_HMD_TABLET_SCALE;
} else {
tabletScalePercentage = Settings.getValue("desktopTabletScale") || DEFAULT_TABLET_SCALE;
tabletScalePercentage = Settings.getValue("desktopTabletScale") || DEFAULT_DESKTOP_TABLET_SCALE;
}
}
return DEFAULT_TABLET_WIDTH * (tabletScalePercentage / 100);

1036
scripts/system/miniTablet.js Normal file

File diff suppressed because it is too large Load diff

View file

@ -19,11 +19,12 @@
var tabletRezzed = false;
var activeHand = null;
var DEFAULT_WIDTH = 0.4375;
var DEFAULT_TABLET_SCALE = 70;
var DEFAULT_DESKTOP_TABLET_SCALE = 75;
var DEFAULT_HMD_TABLET_SCALE = 60;
var preMakeTime = Date.now();
var validCheckTime = Date.now();
var debugTablet = false;
var tabletScalePercentage = 70.0;
var tabletScalePercentage = DEFAULT_HMD_TABLET_SCALE;
var UIWebTablet = null;
var MSECS_PER_SEC = 1000.0;
var MUTE_MICROPHONE_MENU_ITEM = "Mute Microphone";
@ -66,14 +67,14 @@
}
function getTabletScalePercentageFromSettings() {
checkTablet()
checkTablet();
var toolbarMode = gTablet.toolbarMode;
var tabletScalePercentage = DEFAULT_TABLET_SCALE;
var tabletScalePercentage = DEFAULT_HMD_TABLET_SCALE;
if (!toolbarMode) {
if (HMD.active) {
tabletScalePercentage = Settings.getValue("hmdTabletScale") || DEFAULT_TABLET_SCALE;
tabletScalePercentage = Settings.getValue("hmdTabletScale") || DEFAULT_HMD_TABLET_SCALE;
} else {
tabletScalePercentage = Settings.getValue("desktopTabletScale") || DEFAULT_TABLET_SCALE;
tabletScalePercentage = Settings.getValue("desktopTabletScale") || DEFAULT_DESKTOP_TABLET_SCALE;
}
}
return tabletScalePercentage;