diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 62917b304c..33a9962bde 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -552,7 +552,6 @@ const float DEFAULT_HMD_TABLET_SCALE_PERCENT = 100.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; -const bool DEFAULT_TABLET_VISIBLE_TO_OTHERS = false; const bool DEFAULT_PREFER_AVATAR_FINGER_OVER_STYLUS = false; Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bool runServer, QString runServerPathOption) : @@ -575,7 +574,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo _desktopTabletScale("desktopTabletScale", DEFAULT_DESKTOP_TABLET_SCALE_PERCENT), _desktopTabletBecomesToolbarSetting("desktopTabletBecomesToolbar", DEFAULT_DESKTOP_TABLET_BECOMES_TOOLBAR), _hmdTabletBecomesToolbarSetting("hmdTabletBecomesToolbar", DEFAULT_HMD_TABLET_BECOMES_TOOLBAR), - _tabletVisibleToOthersSetting("tabletVisibleToOthers", DEFAULT_TABLET_VISIBLE_TO_OTHERS), _preferAvatarFingerOverStylusSetting("preferAvatarFingerOverStylus", DEFAULT_PREFER_AVATAR_FINGER_OVER_STYLUS), _constrainToolbarPosition("toolbar/constrainToolbarToCenterX", true), _scaleMirror(1.0f), @@ -2364,11 +2362,6 @@ void Application::setHmdTabletBecomesToolbarSetting(bool value) { updateSystemTabletMode(); } -void Application::setTabletVisibleToOthersSetting(bool value) { - _tabletVisibleToOthersSetting.set(value); - updateSystemTabletMode(); -} - void Application::setPreferAvatarFingerOverStylus(bool value) { _preferAvatarFingerOverStylusSetting.set(value); } @@ -3793,7 +3786,6 @@ void Application::loadSettings() { } getMyAvatar()->loadData(); - setTabletVisibleToOthersSetting(false); _settingsLoaded = true; } diff --git a/interface/src/Application.h b/interface/src/Application.h index 0a5fcd78f1..44c0f127c2 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -220,8 +220,6 @@ public: void setDesktopTabletBecomesToolbarSetting(bool value); bool getHmdTabletBecomesToolbarSetting() { return _hmdTabletBecomesToolbarSetting.get(); } void setHmdTabletBecomesToolbarSetting(bool value); - bool getTabletVisibleToOthersSetting() { return _tabletVisibleToOthersSetting.get(); } - void setTabletVisibleToOthersSetting(bool value); bool getPreferAvatarFingerOverStylus() { return _preferAvatarFingerOverStylusSetting.get(); } void setPreferAvatarFingerOverStylus(bool value); @@ -569,7 +567,6 @@ private: Setting::Handle _desktopTabletScale; Setting::Handle _desktopTabletBecomesToolbarSetting; Setting::Handle _hmdTabletBecomesToolbarSetting; - Setting::Handle _tabletVisibleToOthersSetting; Setting::Handle _preferAvatarFingerOverStylusSetting; Setting::Handle _constrainToolbarPosition; diff --git a/interface/src/ui/PreferencesDialog.cpp b/interface/src/ui/PreferencesDialog.cpp index 5983d7cc25..a12d9020ae 100644 --- a/interface/src/ui/PreferencesDialog.cpp +++ b/interface/src/ui/PreferencesDialog.cpp @@ -102,13 +102,6 @@ void setupPreferences() { auto setter = [](bool value) { qApp->setHmdTabletBecomesToolbarSetting(value); }; preferences->addPreference(new CheckPreference(UI_CATEGORY, "HMD Tablet Becomes Toolbar", getter, setter)); } - // TODO - // Note: If this code is added back, you must remove the line "setTabletVisibleToOthersSetting(false)" from Application::loadSettings() - /*{ - auto getter = []()->bool { return qApp->getTabletVisibleToOthersSetting(); }; - auto setter = [](bool value) { qApp->setTabletVisibleToOthersSetting(value); }; - preferences->addPreference(new CheckPreference(UI_CATEGORY, "Tablet Is Visible To Others", getter, setter)); - }*/ { auto getter = []()->bool { return qApp->getPreferAvatarFingerOverStylus(); }; auto setter = [](bool value) { qApp->setPreferAvatarFingerOverStylus(value); }; diff --git a/interface/src/ui/overlays/Web3DOverlay.cpp b/interface/src/ui/overlays/Web3DOverlay.cpp index 99558c8503..502006c862 100644 --- a/interface/src/ui/overlays/Web3DOverlay.cpp +++ b/interface/src/ui/overlays/Web3DOverlay.cpp @@ -274,6 +274,11 @@ void Web3DOverlay::render(RenderArgs* args) { } } + if (_mayNeedResize) { + _mayNeedResize = false; + _webSurface->resize(QSize(_resolution.x, _resolution.y)); + } + vec2 halfSize = getSize() / 2.0f; vec4 color(toGlm(getColor()), getAlpha()); @@ -532,6 +537,8 @@ void Web3DOverlay::setProperties(const QVariantMap& properties) { _inputMode = Touch; } } + + _mayNeedResize = true; } QVariant Web3DOverlay::getProperty(const QString& property) { diff --git a/interface/src/ui/overlays/Web3DOverlay.h b/interface/src/ui/overlays/Web3DOverlay.h index 6a35dec96d..1e3706ed25 100644 --- a/interface/src/ui/overlays/Web3DOverlay.h +++ b/interface/src/ui/overlays/Web3DOverlay.h @@ -87,6 +87,8 @@ private: uint8_t _desiredMaxFPS { 10 }; uint8_t _currentMaxFPS { 0 }; + bool _mayNeedResize { false }; + QMetaObject::Connection _mousePressConnection; QMetaObject::Connection _mouseReleaseConnection; QMetaObject::Connection _mouseMoveConnection; diff --git a/libraries/fbx/src/OBJReader.cpp b/libraries/fbx/src/OBJReader.cpp index c1bb72dff8..3b68af075e 100644 --- a/libraries/fbx/src/OBJReader.cpp +++ b/libraries/fbx/src/OBJReader.cpp @@ -294,7 +294,7 @@ QNetworkReply* OBJReader::request(QUrl& url, bool isTest) { QObject::connect(netReply, SIGNAL(finished()), &loop, SLOT(quit())); loop.exec(); // Nothing is going to happen on this whole run thread until we get this static const int WAIT_TIMEOUT_MS = 500; - while (qApp && !aboutToQuit && !netReply->isReadable()) { + while (!aboutToQuit && qApp && !netReply->isReadable()) { netReply->waitForReadyRead(WAIT_TIMEOUT_MS); // so we might as well block this thread waiting for the response, rather than } QObject::disconnect(connection); diff --git a/libraries/script-engine/src/TabletScriptingInterface.cpp b/libraries/script-engine/src/TabletScriptingInterface.cpp index a76ec116ac..91a1b1b767 100644 --- a/libraries/script-engine/src/TabletScriptingInterface.cpp +++ b/libraries/script-engine/src/TabletScriptingInterface.cpp @@ -662,7 +662,10 @@ const QString OBJECT_NAME_KEY = "objectName"; const QString STABLE_ORDER_KEY = "stableOrder"; static int s_stableOrder = 1; -TabletButtonProxy::TabletButtonProxy(const QVariantMap& properties) : _uuid(QUuid::createUuid()), _stableOrder(++s_stableOrder), _properties(properties) { +TabletButtonProxy::TabletButtonProxy(const QVariantMap& properties) : + _uuid(QUuid::createUuid()), + _stableOrder(++s_stableOrder), + _properties(properties) { // this is used to uniquely identify this button. _properties[UUID_KEY] = _uuid; _properties[OBJECT_NAME_KEY] = _uuid.toString(); diff --git a/libraries/script-engine/src/TabletScriptingInterface.h b/libraries/script-engine/src/TabletScriptingInterface.h index 2cb15a5087..ef9edfb296 100644 --- a/libraries/script-engine/src/TabletScriptingInterface.h +++ b/libraries/script-engine/src/TabletScriptingInterface.h @@ -63,7 +63,7 @@ signals: * @returns {Signal} */ void tabletNotification(); - + private: void processMenuEvents(QObject* object, const QKeyEvent* event); void processTabletEvents(QObject* object, const QKeyEvent* event); @@ -85,6 +85,7 @@ class TabletProxy : public QObject { Q_OBJECT Q_PROPERTY(QString name READ getName) Q_PROPERTY(bool toolbarMode READ getToolbarMode WRITE setToolbarMode) + Q_PROPERTY(bool landscape READ getLandscape WRITE setLandscape) Q_PROPERTY(bool tabletShown MEMBER _tabletShown NOTIFY tabletShownChanged) public: TabletProxy(QString name); @@ -174,6 +175,14 @@ public: */ Q_INVOKABLE bool onHomeScreen(); + /**jsdoc + * set tablet into our out of landscape mode + * @function TabletProxy#setLandscape + * @param landscape {bool} true for landscape, false for portrait + */ + Q_INVOKABLE void setLandscape(bool landscape) { _landscape = landscape; } + Q_INVOKABLE bool getLandscape() { return _landscape; } + QQuickItem* getTabletRoot() const { return _qmlTabletRoot; } QObject* getTabletSurface(); @@ -224,7 +233,7 @@ protected: void removeButtonsFromToolbar(); bool _initialScreen { false }; - QVariant _initialPath { "" }; + QVariant _initialPath { "" }; QString _name; std::mutex _mutex; std::vector> _tabletButtonProxies; @@ -236,6 +245,7 @@ protected: enum class State { Uninitialized, Home, Web, Menu, QML }; State _state { State::Uninitialized }; + bool _landscape { false }; }; /**jsdoc diff --git a/scripts/system/libraries/WebTablet.js b/scripts/system/libraries/WebTablet.js index e2d2791536..f9d37a0086 100644 --- a/scripts/system/libraries/WebTablet.js +++ b/scripts/system/libraries/WebTablet.js @@ -35,7 +35,7 @@ var TABLET_NATURAL_DIMENSIONS = {x: 33.797, y: 50.129, z: 2.269}; var HOME_BUTTON_TEXTURE = "http://hifi-content.s3.amazonaws.com/alan/dev/tablet-with-home-button.fbx/tablet-with-home-button.fbm/button-close.png"; // var HOME_BUTTON_TEXTURE = Script.resourcesPath() + "meshes/tablet-with-home-button.fbx/tablet-with-home-button.fbm/button-close.png"; -var TABLET_MODEL_PATH = "http://hifi-content.s3.amazonaws.com/alan/dev/tablet-with-home-button.fbx"; +// var TABLET_MODEL_PATH = "http://hifi-content.s3.amazonaws.com/alan/dev/tablet-with-home-button.fbx"; var LOCAL_TABLET_MODEL_PATH = Script.resourcesPath() + "meshes/tablet-with-home-button.fbx"; // returns object with two fields: @@ -105,6 +105,7 @@ WebTablet = function (url, width, dpi, hand, clientOnly, location) { var tabletScaleFactor = this.width / TABLET_NATURAL_DIMENSIONS.x; this.height = TABLET_NATURAL_DIMENSIONS.y * tabletScaleFactor; this.depth = TABLET_NATURAL_DIMENSIONS.z * tabletScaleFactor; + this.landscape = false; if (dpi) { this.dpi = dpi; @@ -112,13 +113,7 @@ WebTablet = function (url, width, dpi, hand, clientOnly, location) { this.dpi = DEFAULT_DPI * (DEFAULT_WIDTH / this.width); } - var modelURL; - if (Settings.getValue("tabletVisibleToOthers")) { - modelURL = TABLET_MODEL_PATH; - } else { - modelURL = LOCAL_TABLET_MODEL_PATH; - } - + var modelURL = LOCAL_TABLET_MODEL_PATH; var tabletProperties = { name: "WebTablet Tablet", type: "Model", @@ -128,7 +123,7 @@ WebTablet = function (url, width, dpi, hand, clientOnly, location) { userData: JSON.stringify({ "grabbableKey": {"grabbable": true} }), - dimensions: {x: this.width, y: this.height, z: this.depth}, + dimensions: this.getDimensions(), parentID: AVATAR_SELF_ID }; @@ -141,13 +136,7 @@ WebTablet = function (url, width, dpi, hand, clientOnly, location) { this.cleanUpOldTablets(); - if (Settings.getValue("tabletVisibleToOthers")) { - this.tabletEntityID = Entities.addEntity(tabletProperties, clientOnly); - this.tabletIsOverlay = false; - } else { - this.tabletEntityID = Overlays.addOverlay("model", tabletProperties); - this.tabletIsOverlay = true; - } + this.tabletEntityID = Overlays.addOverlay("model", tabletProperties); if (this.webOverlayID) { Overlays.deleteOverlay(this.webOverlayID); @@ -161,7 +150,7 @@ WebTablet = function (url, width, dpi, hand, clientOnly, location) { url: url, localPosition: { x: 0, y: WEB_ENTITY_Y_OFFSET, z: -WEB_ENTITY_Z_OFFSET }, localRotation: Quat.angleAxis(180, Y_AXIS), - resolution: TABLET_TEXTURE_RESOLUTION, + resolution: this.getTabletTextureResolution(), dpi: this.dpi, color: { red: 255, green: 255, blue: 255 }, alpha: 1.0, @@ -188,13 +177,14 @@ WebTablet = function (url, width, dpi, hand, clientOnly, location) { if (_this.homeButtonID == senderID) { var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); var onHomeScreen = tablet.onHomeScreen(); + var isMessageOpen; if (onHomeScreen) { - var isMessageOpen = tablet.isMessageDialogOpen(); + isMessageOpen = tablet.isMessageDialogOpen(); if (isMessageOpen === false) { HMD.closeTablet(); } } else { - var isMessageOpen = tablet.isMessageDialogOpen(); + isMessageOpen = tablet.isMessageDialogOpen(); if (isMessageOpen === false) { tablet.gotoHomeScreen(); _this.setHomeButtonTexture(); @@ -209,18 +199,6 @@ WebTablet = function (url, width, dpi, hand, clientOnly, location) { return Entities.getWebViewRoot(_this.tabletEntityID); }; - this.getLocation = function() { - if (this.tabletIsOverlay) { - var location = Overlays.getProperty(this.tabletEntityID, "localPosition"); - var orientation = Overlays.getProperty(this.tabletEntityID, "localOrientation"); - return { - localPosition: location, - localRotation: orientation - }; - } else { - return Entities.getEntityProperties(_this.tabletEntityID, ["localPosition", "localRotation"]); - } - }; this.clicked = false; this.myOnHmdChanged = function () { @@ -259,6 +237,42 @@ WebTablet = function (url, width, dpi, hand, clientOnly, location) { Camera.modeUpdated.connect(this.myCameraModeChanged); }; +WebTablet.prototype.getDimensions = function() { + if (this.landscape) { + return { x: this.width * 2, y: this.height, z: this.depth }; + } else { + return { x: this.width, y: this.height, z: this.depth }; + } +}; + +WebTablet.prototype.getTabletTextureResolution = function() { + if (this.landscape) { + return { x: TABLET_TEXTURE_RESOLUTION.x * 2, y: TABLET_TEXTURE_RESOLUTION.y }; + } else { + return TABLET_TEXTURE_RESOLUTION; + } +}; + +WebTablet.prototype.setLandscape = function(newLandscapeValue) { + if (this.landscape == newLandscapeValue) { + return; + } + this.landscape = newLandscapeValue; + Overlays.editOverlay(this.tabletEntityID, { dimensions: this.getDimensions() }); + Overlays.editOverlay(this.webOverlayID, { + resolution: this.getTabletTextureResolution() + }); +}; + +WebTablet.prototype.getLocation = function() { + var location = Overlays.getProperty(this.tabletEntityID, "localPosition"); + var orientation = Overlays.getProperty(this.tabletEntityID, "localOrientation"); + return { + localPosition: location, + localRotation: orientation + }; +}; + WebTablet.prototype.setHomeButtonTexture = function() { Entities.editEntity(this.tabletEntityID, {textures: JSON.stringify({"tex.close": HOME_BUTTON_TEXTURE})}); }; @@ -285,11 +299,7 @@ WebTablet.prototype.setWidth = function (width) { this.dpi = DEFAULT_DPI * (DEFAULT_WIDTH / this.width); // update tablet model dimensions - if (this.tabletIsOverlay) { - Overlays.editOverlay(this.tabletEntityID, {dimensions: {x: this.width, y: this.height, z: this.depth}}); - } else { - Entities.editEntity(this.tabletEntityID, {dimensions: {x: this.width, y: this.height, z: this.depth}}); - } + Overlays.editOverlay(this.tabletEntityID, { dimensions: this.getDimensions() }); // update webOverlay var WEB_ENTITY_Z_OFFSET = (this.depth / 2); @@ -309,11 +319,7 @@ WebTablet.prototype.setWidth = function (width) { WebTablet.prototype.destroy = function () { Overlays.deleteOverlay(this.webOverlayID); - if (this.tabletIsOverlay) { - Overlays.deleteOverlay(this.tabletEntityID); - } else { - Entities.deleteEntity(this.tabletEntityID); - } + Overlays.deleteOverlay(this.tabletEntityID); Overlays.deleteOverlay(this.homeButtonID); HMD.displayModeChanged.disconnect(this.myOnHmdChanged); @@ -356,15 +362,15 @@ WebTablet.prototype.calculateWorldAttitudeRelativeToCamera = function (windowPos // clamp window pos so 2d tablet is not off-screen. var TABLET_TEXEL_PADDING = {x: 60, y: 90}; - var X_CLAMP = (DESKTOP_TABLET_SCALE / 100) * ((TABLET_TEXTURE_RESOLUTION.x / 2) + TABLET_TEXEL_PADDING.x); - var Y_CLAMP = (DESKTOP_TABLET_SCALE / 100) * ((TABLET_TEXTURE_RESOLUTION.y / 2) + TABLET_TEXEL_PADDING.y); + var X_CLAMP = (DESKTOP_TABLET_SCALE / 100) * ((this.getTabletTextureResolution().x / 2) + TABLET_TEXEL_PADDING.x); + var Y_CLAMP = (DESKTOP_TABLET_SCALE / 100) * ((this.getTabletTextureResolution().y / 2) + TABLET_TEXEL_PADDING.y); windowPos.x = clamp(windowPos.x, X_CLAMP, Window.innerWidth - X_CLAMP); windowPos.y = clamp(windowPos.y, Y_CLAMP, Window.innerHeight - Y_CLAMP); var fov = (Settings.getValue('fieldOfView') || DEFAULT_VERTICAL_FIELD_OF_VIEW) * (Math.PI / 180); var MAX_PADDING_FACTOR = 2.2; - var PADDING_FACTOR = Math.min(Window.innerHeight / TABLET_TEXTURE_RESOLUTION.y, MAX_PADDING_FACTOR); - var TABLET_HEIGHT = (TABLET_TEXTURE_RESOLUTION.y / this.dpi) * INCHES_TO_METERS; + var PADDING_FACTOR = Math.min(Window.innerHeight / this.getTabletTextureResolution().y, MAX_PADDING_FACTOR); + var TABLET_HEIGHT = (this.getTabletTextureResolution().y / this.dpi) * INCHES_TO_METERS; var WEB_ENTITY_Z_OFFSET = (this.depth / 2); // calcualte distance from camera @@ -488,11 +494,7 @@ WebTablet.prototype.getPosition = function () { WebTablet.prototype.mousePressEvent = function (event) { var pickRay = Camera.computePickRay(event.x, event.y); var entityPickResults; - if (this.tabletIsOverlay) { - entityPickResults = Overlays.findRayIntersection(pickRay, true, [this.tabletEntityID]); - } else { - entityPickResults = Entities.findRayIntersection(pickRay, true, [this.tabletEntityID]); - } + entityPickResults = Overlays.findRayIntersection(pickRay, true, [this.tabletEntityID]); if (entityPickResults.intersects && (entityPickResults.entityID === this.tabletEntityID || entityPickResults.overlayID === this.tabletEntityID)) { var overlayPickResults = Overlays.findRayIntersection(pickRay, true, [this.webOverlayID, this.homeButtonID], []); @@ -509,16 +511,13 @@ WebTablet.prototype.mousePressEvent = function (event) { tablet.gotoHomeScreen(); this.setHomeButtonTexture(); } + Messages.sendLocalMessage("home", this.homeButtonID); } } else if (!HMD.active && (!overlayPickResults.intersects || overlayPickResults.overlayID !== this.webOverlayID)) { this.dragging = true; var invCameraXform = new Xform(Camera.orientation, Camera.position).inv(); this.initialLocalIntersectionPoint = invCameraXform.xformPoint(entityPickResults.intersection); - if (this.tabletIsOverlay) { - this.initialLocalPosition = Overlays.getProperty(this.tabletEntityID, "localPosition"); - } else { - this.initialLocalPosition = Entities.getEntityProperties(this.tabletEntityID, ["localPosition"]).localPosition; - } + this.initialLocalPosition = Overlays.getProperty(this.tabletEntityID, "localPosition"); } } }; @@ -564,15 +563,9 @@ WebTablet.prototype.mouseMoveEvent = function (event) { var localIntersectionPoint = Vec3.sum(localPickRay.origin, Vec3.multiply(localPickRay.direction, result.distance)); var localOffset = Vec3.subtract(localIntersectionPoint, this.initialLocalIntersectionPoint); var localPosition = Vec3.sum(this.initialLocalPosition, localOffset); - if (this.tabletIsOverlay) { - Overlays.editOverlay(this.tabletEntityID, { - localPosition: localPosition - }); - } else { - Entities.editEntity(this.tabletEntityID, { - localPosition: localPosition - }); - } + Overlays.editOverlay(this.tabletEntityID, { + localPosition: localPosition + }); } } }; diff --git a/scripts/system/tablet-ui/tabletUI.js b/scripts/system/tablet-ui/tabletUI.js index a653d193bd..174153cad3 100644 --- a/scripts/system/tablet-ui/tabletUI.js +++ b/scripts/system/tablet-ui/tabletUI.js @@ -32,7 +32,7 @@ if (!UIWebTablet) { return false; } - if (UIWebTablet.tabletIsOverlay && Overlays.getProperty(HMD.tabletID, "type") != "model") { + if (Overlays.getProperty(HMD.tabletID, "type") != "model") { if (debugTablet) { print("TABLET is invalid due to frame: " + JSON.stringify(Overlays.getProperty(HMD.tabletID, "type"))); } @@ -95,7 +95,7 @@ Tablet.getTablet("com.highfidelity.interface.tablet.system").tabletShown = true; if (!tabletRezzed || !tabletIsValid()) { - closeTabletUI() + closeTabletUI(); rezTablet(); } @@ -106,9 +106,7 @@ var tabletProperties = {}; UIWebTablet.calculateTabletAttachmentProperties(activeHand, true, tabletProperties); tabletProperties.visible = true; - if (UIWebTablet.tabletIsOverlay) { - Overlays.editOverlay(HMD.tabletID, tabletProperties); - } + Overlays.editOverlay(HMD.tabletID, tabletProperties); Overlays.editOverlay(HMD.homeButtonID, { visible: true }); Overlays.editOverlay(HMD.tabletScreenID, { visible: true }); Overlays.editOverlay(HMD.tabletScreenID, { maxFPS: 90 }); @@ -121,22 +119,14 @@ return; } - if (UIWebTablet.tabletIsOverlay) { - if (debugTablet) { - print("TABLET hide"); - } - if (Settings.getValue("tabletVisibleToOthers")) { - closeTabletUI(); - } else { - // Overlays.editOverlay(HMD.tabletID, { localPosition: { x: -1000, y: 0, z:0 } }); - Overlays.editOverlay(HMD.tabletID, { visible: false }); - Overlays.editOverlay(HMD.homeButtonID, { visible: false }); - Overlays.editOverlay(HMD.tabletScreenID, { visible: false }); - Overlays.editOverlay(HMD.tabletScreenID, { maxFPS: 1 }); - } - } else { - closeTabletUI(); + if (debugTablet) { + print("TABLET hide"); } + + Overlays.editOverlay(HMD.tabletID, { visible: false }); + Overlays.editOverlay(HMD.homeButtonID, { visible: false }); + Overlays.editOverlay(HMD.tabletScreenID, { visible: false }); + Overlays.editOverlay(HMD.tabletScreenID, { maxFPS: 1 }); } function closeTabletUI() { @@ -169,7 +159,7 @@ // close the WebTablet if it we go into toolbar mode. var tabletShown = Tablet.getTablet("com.highfidelity.interface.tablet.system").tabletShown; var toolbarMode = Tablet.getTablet("com.highfidelity.interface.tablet.system").toolbarMode; - var visibleToOthers = Settings.getValue("tabletVisibleToOthers"); + var landscape = Tablet.getTablet("com.highfidelity.interface.tablet.system").landscape; if (tabletShown && toolbarMode) { closeTabletUI(); @@ -187,6 +177,9 @@ } updateTabletWidthFromSettings(); + if (UIWebTablet) { + UIWebTablet.setLandscape(landscape); + } if (validCheckTime - now > MSECS_PER_SEC) { validCheckTime = now; @@ -205,20 +198,16 @@ // check for change in tablet scale. if (HMD.showTablet && !tabletShown && !toolbarMode) { - UserActivityLogger.openedTablet(visibleToOthers); + UserActivityLogger.openedTablet(false); showTabletUI(); } else if (!HMD.showTablet && tabletShown) { UserActivityLogger.closedTablet(); - if (visibleToOthers) { - closeTabletUI(); - } else { - hideTabletUI(); - } + hideTabletUI(); } // if the tablet is an overlay, attempt to pre-create it and then hide it so that when it's // summoned, it will appear quickly. - if (!toolbarMode && !visibleToOthers) { + if (!toolbarMode) { if (now - preMakeTime > MSECS_PER_SEC) { preMakeTime = now; if (!tabletIsValid()) { @@ -233,14 +222,20 @@ } - function toggleHand(channel, hand, senderUUID, localOnly) { + function handleMessage(channel, hand, senderUUID, localOnly) { if (channel === "toggleHand") { activeHand = JSON.parse(hand); } + if (channel === "home") { + if (UIWebTablet) { + Tablet.getTablet("com.highfidelity.interface.tablet.system").landscape = false; + } + } } Messages.subscribe("toggleHand"); - Messages.messageReceived.connect(toggleHand); + Messages.subscribe("home"); + Messages.messageReceived.connect(handleMessage); Script.setInterval(updateShowTablet, 100); @@ -273,7 +268,7 @@ Script.scriptEnding.connect(function () { var tabletID = HMD.tabletID; Entities.deleteEntity(tabletID); - Overlays.deleteOverlay(tabletID) + Overlays.deleteOverlay(tabletID); HMD.tabletID = null; HMD.homeButtonID = null; HMD.tabletScreenID = null;