3
0
Fork 0
mirror of https://github.com/lubosz/overte.git synced 2025-04-18 00:26:14 +02:00

Merge remote-tracking branch 'upstream/master' into android_signup

This commit is contained in:
Gabriel Calero 2018-10-02 09:24:09 -03:00
commit 13e2b99dfa
49 changed files with 1817 additions and 264 deletions

View file

@ -157,7 +157,7 @@ JNIEXPORT void Java_io_highfidelity_hifiinterface_InterfaceActivity_nativeOnCrea
JavaVM* jvm;
env->GetJavaVM(&jvm);
QObject::connect(&AndroidHelper::instance(), &AndroidHelper::androidActivityRequested, [jvm](const QString& a, const bool backToScene, QList<QString> args) {
QObject::connect(&AndroidHelper::instance(), &AndroidHelper::androidActivityRequested, [jvm](const QString& a, const bool backToScene, QMap<QString, QString> args) {
JNIEnv* myNewEnv;
JavaVMAttachArgs jvmArgs;
jvmArgs.version = JNI_VERSION_1_6; // choose your JNI version
@ -183,9 +183,11 @@ JNIEXPORT void Java_io_highfidelity_hifiinterface_InterfaceActivity_nativeOnCrea
jmethodID mapClassConstructor = myNewEnv->GetMethodID(hashMapClass, "<init>", "()V");
jobject hashmap = myNewEnv->NewObject(hashMapClass, mapClassConstructor);
jmethodID mapClassPut = myNewEnv->GetMethodID(hashMapClass, "put", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
for (const QString& arg: args) {
QAndroidJniObject jArg = QAndroidJniObject::fromString(arg);
myNewEnv->CallObjectMethod(hashmap, mapClassPut, QAndroidJniObject::fromString("url").object<jstring>(), jArg.object<jstring>());
QMap<QString, QString>::iterator i;
for (i = args.begin(); i != args.end(); ++i) {
QAndroidJniObject jKey = QAndroidJniObject::fromString(i.key());
QAndroidJniObject jValue = QAndroidJniObject::fromString(i.value());
myNewEnv->CallObjectMethod(hashmap, mapClassPut, jKey.object<jstring>(), jValue.object<jstring>());
}
__interfaceActivity.callMethod<void>("openAndroidActivity", "(Ljava/lang/String;ZLjava/util/HashMap;)V", string.object<jstring>(), jBackToScene, hashmap);
if (attachedHere) {

View file

@ -39,6 +39,7 @@ import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import io.highfidelity.hifiinterface.fragment.WebViewFragment;
import io.highfidelity.hifiinterface.receiver.HeadsetStateReceiver;
@ -304,14 +305,22 @@ public class InterfaceActivity extends QtActivity implements WebViewFragment.OnW
switch (activityName) {
case "Home":
case "Privacy Policy":
case "Login": {
nativeBeforeEnterBackground();
Intent intent = new Intent(this, MainActivity.class);
intent.putExtra(MainActivity.EXTRA_FRAGMENT, activityName);
intent.putExtra(MainActivity.EXTRA_BACK_TO_SCENE, backToScene);
startActivity(intent);
break;
}
case "Login":
nativeBeforeEnterBackground();
Intent loginIntent = new Intent(this, MainActivity.class);
loginIntent.putExtra(MainActivity.EXTRA_FRAGMENT, activityName);
loginIntent.putExtra(MainActivity.EXTRA_BACK_TO_SCENE, backToScene);
if (args != null && args.containsKey(DOMAIN_URL)) {
loginIntent.putExtra(DOMAIN_URL, (String) args.get(DOMAIN_URL));
}
startActivity(loginIntent);
break;
case "WebView":
runOnUiThread(() -> {
webSlidingDrawer.setVisibility(View.VISIBLE);

View file

@ -29,6 +29,9 @@ import android.widget.TextView;
import com.squareup.picasso.Callback;
import com.squareup.picasso.Picasso;
import java.util.HashMap;
import java.util.Map;
import io.highfidelity.hifiinterface.fragment.FriendsFragment;
import io.highfidelity.hifiinterface.fragment.HomeFragment;
import io.highfidelity.hifiinterface.fragment.LoginFragment;
@ -48,6 +51,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
public static final String DEFAULT_FRAGMENT = "Home";
public static final String EXTRA_FRAGMENT = "fragment";
public static final String EXTRA_BACK_TO_SCENE = "backToScene";
public static final String EXTRA_BACK_TO_URL = "url";
private String TAG = "HighFidelity";
@ -65,6 +69,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
private MenuItem mPeopleMenuItem;
private boolean backToScene;
private String backToUrl;
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -108,9 +113,8 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
loadFragment(DEFAULT_FRAGMENT);
}
if (getIntent().hasExtra(EXTRA_BACK_TO_SCENE)) {
backToScene = getIntent().getBooleanExtra(EXTRA_BACK_TO_SCENE, false);
}
backToScene = getIntent().getBooleanExtra(EXTRA_BACK_TO_SCENE, false);
backToUrl = getIntent().getStringExtra(EXTRA_BACK_TO_URL);
}
}
@ -315,7 +319,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
}
private void goToLastLocation() {
goToDomain("");
goToDomain(backToUrl != null? backToUrl : "");
}
private void goToDomain(String domainUrl) {

View file

@ -1110,7 +1110,36 @@ function moveTableRow(row, move_up) {
}
// we need to fire a change event on one of the remaining inputs so that the sidebar badge is updated
badgeForDifferences($(table))
badgeForDifferences($(table));
// figure out which group this row is in
var panelParentID = row.closest('.panel').attr('id');
// get the short name for the setting from the table
var tableShortName = row.closest('table').data('short-name');
var changed = tableHasChanged(panelParentID, tableShortName);
$(table).find('.' + Settings.DATA_ROW_CLASS).each(function(){
var hiddenInput = $(this).find('td.' + Settings.DATA_COL_CLASS + ' input');
if (changed) {
hiddenInput.attr('data-changed', true);
} else {
hiddenInput.removeAttr('data-changed');
}
});
}
function tableHasChanged(panelParentID, tableShortName) {
// get a JSON representation of that section
var panelSettingJSON = form2js(panelParentID, ".", false, cleanupFormValues, true)[panelParentID][tableShortName]
if (Settings.initialValues[panelParentID]) {
var initialPanelSettingJSON = Settings.initialValues[panelParentID][tableShortName]
} else {
var initialPanelSettingJSON = {};
}
return !_.isEqual(panelSettingJSON, initialPanelSettingJSON);
}
function updateDataChangedForSiblingRows(row, forceTrue) {
@ -1123,16 +1152,8 @@ function updateDataChangedForSiblingRows(row, forceTrue) {
// get the short name for the setting from the table
var tableShortName = row.closest('table').data('short-name')
// get a JSON representation of that section
var panelSettingJSON = form2js(panelParentID, ".", false, cleanupFormValues, true)[panelParentID][tableShortName]
if (Settings.initialValues[panelParentID]) {
var initialPanelSettingJSON = Settings.initialValues[panelParentID][tableShortName]
} else {
var initialPanelSettingJSON = {};
}
// if they are equal, we don't need data-changed
isTrue = !_.isEqual(panelSettingJSON, initialPanelSettingJSON)
isTrue = tableHasChanged(panelParentID, tableShortName);
} else {
isTrue = true
}
@ -1140,9 +1161,9 @@ function updateDataChangedForSiblingRows(row, forceTrue) {
row.siblings('.' + Settings.DATA_ROW_CLASS).each(function(){
var hiddenInput = $(this).find('td.' + Settings.DATA_COL_CLASS + ' input')
if (isTrue) {
hiddenInput.attr('data-changed', isTrue)
hiddenInput.attr('data-changed', isTrue);
} else {
hiddenInput.removeAttr('data-changed')
hiddenInput.removeAttr('data-changed');
}
})
}

View file

@ -24,6 +24,7 @@ Item {
fragmentShader: {
"
#version 150 core
varying highp vec2 qt_TexCoord0;
uniform lowp sampler2D source;
uniform lowp sampler2D mask;

View file

@ -552,6 +552,10 @@ Rectangle {
// Alignment
horizontalAlignment: Text.AlignLeft;
verticalAlignment: Text.AlignVCenter;
onLinkActivated: {
// Only case is to go to the bank.
sendToScript({method: 'gotoBank'});
}
}
}
@ -1107,25 +1111,32 @@ Rectangle {
}
function handleBuyAgainLogic() {
// If you can buy this item again...
if (canBuyAgain()) {
// If you can't afford another copy of the item...
if (root.balanceAfterPurchase < 0) {
// If you already own the item...
if (root.alreadyOwned) {
buyText.text = "<b>Your Wallet does not have sufficient funds to purchase this item again.</b>";
// Else if you don't already own the item...
} else {
buyText.text = "<b>Your Wallet does not have sufficient funds to purchase this item.</b>";
}
buyTextContainer.color = "#FFC3CD";
buyTextContainer.border.color = "#F3808F";
buyGlyph.text = hifi.glyphs.alert;
buyGlyph.size = 54;
// If you CAN afford another copy of the item...
// General rules, implemented in various scattered places in this file:
// 1. If you already own the item, a viewInMyPurchasesButton is visible,
// and the buyButton is visible (and says "Buy it again") ONLY if it is a type you canBuyAgain.
// 2. Separately,
// a. If you don't have enough money to buy, the buyText becomes visible and tells you, and the buyButton is disabled.
// b. Otherwise, if the item is a content set and you don't have rez permission, the buyText becomes visible and tells you so.
// If you can't afford another copy of the item...
if (root.balanceAfterPurchase < 0) {
// If you already own the item...
if (!root.alreadyOwned) {
buyText.text = "<b>Your Wallet does not have sufficient funds to purchase this item.</b>";
// Else if you don't already own the item...
} else if (canBuyAgain()) {
buyText.text = "<b>Your Wallet does not have sufficient funds to purchase this item again.</b>";
} else {
handleContentSets();
buyText.text = "<b>While you do not have sufficient funds to buy this, you already have this item.</b>"
}
buyText.text += " Visit <a href='#'>Bank of High Fidelity</a> to get more HFC."
buyTextContainer.color = "#FFC3CD";
buyTextContainer.border.color = "#F3808F";
buyGlyph.text = hifi.glyphs.alert;
buyGlyph.size = 54;
// If you CAN afford another copy of the item...
} else {
handleContentSets();
}
}

View file

@ -829,6 +829,7 @@ Rectangle {
Commerce.getWalletAuthenticatedStatus(); // before writing security image, ensures that salt/account password is set.
Commerce.chooseSecurityImage(securityImagePath);
Commerce.generateKeyPair();
followReferrer({ referrer: walletSetup.referrer });
}
function addLeadingZero(n) {
@ -836,7 +837,7 @@ Rectangle {
}
function followReferrer(msg) {
if (msg.referrer === '' || msg.referrer === 'marketplace cta') {
if (msg.referrer === '') {
root.activeView = "initialize";
Commerce.getWalletStatus();
} else if (msg.referrer === 'purchases') {

View file

@ -28,7 +28,7 @@ Item {
property string activeView: "step_1";
property string lastPage;
property bool hasShownSecurityImageTip: false;
property string referrer;
property string referrer: '';
property string keyFilePath;
property date startingTimestamp;
property string setupAttemptID;

View file

@ -28,7 +28,7 @@ AndroidHelper::AndroidHelper() {
AndroidHelper::~AndroidHelper() {
}
void AndroidHelper::requestActivity(const QString &activityName, const bool backToScene, QList<QString> args) {
void AndroidHelper::requestActivity(const QString &activityName, const bool backToScene, QMap<QString, QString> args) {
emit androidActivityRequested(activityName, backToScene, args);
}
@ -52,8 +52,10 @@ void AndroidHelper::performHapticFeedback(int duration) {
emit hapticFeedbackRequested(duration);
}
void AndroidHelper::showLoginDialog() {
emit androidActivityRequested("Login", true);
void AndroidHelper::showLoginDialog(QUrl url) {
QMap<QString, QString> args;
args["url"] = url.toString();
emit androidActivityRequested("Login", true, args);
}
void AndroidHelper::processURL(const QString &url) {

View file

@ -13,6 +13,9 @@
#define hifi_Android_Helper_h
#include <QObject>
#include <QMap>
#include <QUrl>
#include <QNetworkReply>
#include <QtCore/QEventLoop>
@ -23,7 +26,7 @@ public:
static AndroidHelper instance;
return instance;
}
void requestActivity(const QString &activityName, const bool backToScene, QList<QString> args = QList<QString>());
void requestActivity(const QString &activityName, const bool backToScene, QMap<QString, QString> args = QMap<QString, QString>());
void notifyLoadComplete();
void notifyEnterForeground();
void notifyBeforeEnterBackground();
@ -39,12 +42,11 @@ public:
void signup(QString email, QString username, QString password);
public slots:
void showLoginDialog();
void showLoginDialog(QUrl url);
void signupCompleted(QNetworkReply* reply);
void signupFailed(QNetworkReply* reply);
signals:
void androidActivityRequested(const QString &activityName, const bool backToScene, QList<QString> args = QList<QString>());
void androidActivityRequested(const QString &activityName, const bool backToScene, QMap<QString, QString> args = QMap<QString, QString>());
void qtAppLoadComplete();
void enterForeground();
void beforeEnterBackground();

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;
@ -976,7 +976,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
_window(new MainWindow(desktop())),
_sessionRunTimer(startupTimer),
_previousSessionCrashed(setupEssentials(argc, argv, runningMarkerExisted)),
_undoStackScriptingInterface(&_undoStack),
_entitySimulation(new PhysicalEntitySimulation()),
_physicsEngine(new PhysicsEngine(Vectors::ZERO)),
_entityClipboard(new EntityTree()),
@ -996,7 +995,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
_enableProcessOctreeThread(true),
_lastNackTime(usecTimestampNow()),
_lastSendDownstreamAudioStats(usecTimestampNow()),
_aboutToQuit(false),
_notifiedPacketVersionMismatchThisDomain(false),
_maxOctreePPS(maxOctreePacketsPerSecond.get()),
_lastFaceTrackerUpdate(0),
@ -1236,7 +1234,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
auto dialogsManager = DependencyManager::get<DialogsManager>();
#if defined(Q_OS_ANDROID)
connect(accountManager.data(), &AccountManager::authRequired, this, []() {
AndroidHelper::instance().showLoginDialog();
auto addressManager = DependencyManager::get<AddressManager>();
AndroidHelper::instance().showLoginDialog(addressManager->currentAddress());
});
#else
connect(accountManager.data(), &AccountManager::authRequired, dialogsManager.data(), &DialogsManager::showLoginDialog);
@ -3095,7 +3094,6 @@ void Application::onDesktopRootContextCreated(QQmlContext* surfaceContext) {
surfaceContext->setContextProperty("DialogsManager", _dialogsManagerScriptingInterface);
surfaceContext->setContextProperty("FaceTracker", DependencyManager::get<DdeFaceTracker>().data());
surfaceContext->setContextProperty("AvatarManager", DependencyManager::get<AvatarManager>().data());
surfaceContext->setContextProperty("UndoStack", &_undoStackScriptingInterface);
surfaceContext->setContextProperty("LODManager", DependencyManager::get<LODManager>().data());
surfaceContext->setContextProperty("HMD", DependencyManager::get<HMDScriptingInterface>().data());
surfaceContext->setContextProperty("Scene", DependencyManager::get<SceneScriptingInterface>().data());
@ -6767,8 +6765,6 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEnginePointe
scriptEngine->registerGlobalObject("AvatarManager", DependencyManager::get<AvatarManager>().data());
scriptEngine->registerGlobalObject("UndoStack", &_undoStackScriptingInterface);
scriptEngine->registerGlobalObject("LODManager", DependencyManager::get<LODManager>().data());
scriptEngine->registerGlobalObject("Paths", DependencyManager::get<PathUtils>().data());

View file

@ -23,7 +23,6 @@
#include <QtGui/QImage>
#include <QtWidgets/QApplication>
#include <QtWidgets/QUndoStack>
#include <ThreadHelpers.h>
#include <AbstractScriptingServicesInterface.h>
@ -70,7 +69,6 @@
#include "ui/OctreeStatsDialog.h"
#include "ui/OverlayConductor.h"
#include "ui/overlays/Overlays.h"
#include "UndoStackScriptingInterface.h"
#include "workload/GameWorkload.h"
@ -189,7 +187,6 @@ public:
const OctreePacketProcessor& getOctreePacketProcessor() const { return _octreeProcessor; }
QSharedPointer<EntityTreeRenderer> getEntities() const { return DependencyManager::get<EntityTreeRenderer>(); }
QUndoStack* getUndoStack() { return &_undoStack; }
MainWindow* getWindow() const { return _window; }
EntityTreePointer getEntityClipboard() const { return _entityClipboard; }
EntityEditPacketSender* getEntityEditPacketSender() { return &_entityEditSender; }
@ -560,6 +557,8 @@ private:
MainWindow* _window;
QElapsedTimer& _sessionRunTimer;
bool _aboutToQuit { false };
bool _previousSessionCrashed;
DisplayPluginPointer _displayPlugin;
@ -569,9 +568,6 @@ private:
bool _activatingDisplayPlugin { false };
QUndoStack _undoStack;
UndoStackScriptingInterface _undoStackScriptingInterface;
uint32_t _renderFrameCount { 0 };
// Frame Rate Measurement
@ -651,8 +647,6 @@ private:
quint64 _lastNackTime;
quint64 _lastSendDownstreamAudioStats;
bool _aboutToQuit;
bool _notifiedPacketVersionMismatchThisDomain;
ConditionalGuard _settingsGuard;

View file

@ -90,19 +90,6 @@ Menu::Menu() {
// Edit menu ----------------------------------
MenuWrapper* editMenu = addMenu("Edit");
// Edit > Undo
QUndoStack* undoStack = qApp->getUndoStack();
QAction* undoAction = undoStack->createUndoAction(editMenu);
undoAction->setShortcut(Qt::CTRL | Qt::Key_Z);
addActionToQMenuAndActionHash(editMenu, undoAction);
// Edit > Redo
QAction* redoAction = undoStack->createRedoAction(editMenu);
redoAction->setShortcut(Qt::CTRL | Qt::SHIFT | Qt::Key_Z);
addActionToQMenuAndActionHash(editMenu, redoAction);
editMenu->addSeparator();
// Edit > Cut
auto cutAction = addActionToQMenuAndActionHash(editMenu, "Cut", QKeySequence::Cut);
connect(cutAction, &QAction::triggered, [] {

View file

@ -529,7 +529,8 @@ void MyAvatar::update(float deltaTime) {
}
if (_goToFeetAjustment && _skeletonModelLoaded) {
auto feetAjustment = getWorldPosition() - getWorldFeetPosition();
goToLocation(getWorldPosition() + feetAjustment);
_goToPosition = getWorldPosition() + feetAjustment;
setWorldPosition(_goToPosition);
_goToFeetAjustment = false;
}
if (_physicsSafetyPending && qApp->isPhysicsEnabled() && _characterController.isEnabledAndReady()) {

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

@ -134,7 +134,8 @@ void WindowScriptingInterface::openUrl(const QUrl& url) {
DependencyManager::get<AddressManager>()->handleLookupString(url.toString());
} else {
#if defined(Q_OS_ANDROID)
QList<QString> args = { url.toString() };
QMap<QString, QString> args;
args["url"] = url.toString();
AndroidHelper::instance().requestActivity("WebView", true, args);
#else
// address manager did not handle - ask QDesktopServices to handle

View file

@ -305,7 +305,7 @@ void EntityRenderer::updateInScene(const ScenePointer& scene, Transaction& trans
}
doRenderUpdateSynchronous(scene, transaction, _entity);
transaction.updateItem<EntityRenderer>(_renderItemID, [this](EntityRenderer& self) {
transaction.updateItem<PayloadProxyInterface>(_renderItemID, [this](PayloadProxyInterface& self) {
if (!isValidRenderItem()) {
return;
}

View file

@ -145,7 +145,7 @@ EntityItemID EntityTreeElement::findRayIntersection(const glm::vec3& origin, con
bool visibleOnly, bool collidableOnly, QVariantMap& extraInfo, bool precisionPicking) {
EntityItemID result;
BoxFace localFace;
BoxFace localFace { UNKNOWN_FACE };
glm::vec3 localSurfaceNormal;
if (!canPickIntersect()) {
@ -213,7 +213,7 @@ EntityItemID EntityTreeElement::findDetailedRayIntersection(const glm::vec3& ori
// we can use the AABox's ray intersection by mapping our origin and direction into the entity frame
// and testing intersection there.
float localDistance;
BoxFace localFace;
BoxFace localFace { UNKNOWN_FACE };
glm::vec3 localSurfaceNormal;
if (entityFrameBox.findRayIntersection(entityFrameOrigin, entityFrameDirection, 1.0f / entityFrameDirection, localDistance,
localFace, localSurfaceNormal)) {

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

@ -19,6 +19,7 @@
#include <NumericalConstants.h>
#include <shared/NsightHelpers.h>
#include <gl/QOpenGLContextWrapper.h>
#include <gl/GLHelpers.h>
#include "../OffscreenSurface.h"
#include "../Logging.h"
@ -67,6 +68,7 @@ SharedObject::SharedObject() {
// so we wait until after its ctor to move object/context to this thread.
QQuickWindow::setDefaultAlphaBuffer(true);
_quickWindow = new QQuickWindow(_renderControl);
_quickWindow->setFormat(getDefaultOpenGLSurfaceFormat());
_quickWindow->setColor(QColor(255, 255, 255, 0));
_quickWindow->setClearBeforeRendering(true);

View file

@ -226,8 +226,9 @@ void CauterizedModel::updateRenderItems() {
bool invalidatePayloadShapeKey = self->shouldInvalidatePayloadShapeKey(meshIndex);
bool useDualQuaternionSkinning = self->getUseDualQuaternionSkinning();
transaction.updateItem<CauterizedMeshPartPayload>(itemID, [modelTransform, meshState, useDualQuaternionSkinning, cauterizedMeshState, invalidatePayloadShapeKey,
isWireframe, renderItemKeyGlobalFlags, enableCauterization](CauterizedMeshPartPayload& data) {
transaction.updateItem<ModelMeshPartPayload>(itemID, [modelTransform, meshState, useDualQuaternionSkinning, cauterizedMeshState, invalidatePayloadShapeKey,
isWireframe, renderItemKeyGlobalFlags, enableCauterization](ModelMeshPartPayload& mmppData) {
CauterizedMeshPartPayload& data = static_cast<CauterizedMeshPartPayload&>(mmppData);
if (useDualQuaternionSkinning) {
data.updateClusterBuffer(meshState.clusterDualQuaternions,
cauterizedMeshState.clusterDualQuaternions);

View file

@ -243,7 +243,8 @@ bool RecordingScriptingInterface::saveRecordingToAsset(QScriptValue getClipAtpUr
}
if (auto upload = DependencyManager::get<AssetClient>()->createUpload(recording::Clip::toBuffer(_lastClip))) {
QObject::connect(upload, &AssetUpload::finished, this, [=](AssetUpload* upload, const QString& hash) mutable {
QObject::connect(upload, &AssetUpload::finished,
getClipAtpUrl.engine(), [=](AssetUpload* upload, const QString& hash) mutable {
QString clip_atp_url = "";
if (upload->getError() == AssetUpload::NoError) {

View file

@ -1,66 +0,0 @@
//
// UndoStackScriptingInterface.cpp
// libraries/script-engine/src
//
// Created by Ryan Huffman on 10/22/14.
// Copyright 2014 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
//
#include "UndoStackScriptingInterface.h"
#include <QDebug>
#include <QScriptValue>
#include <QScriptValueList>
#include <QScriptEngine>
UndoStackScriptingInterface::UndoStackScriptingInterface(QUndoStack* undoStack) : _undoStack(undoStack) {
}
void UndoStackScriptingInterface::pushCommand(QScriptValue undoFunction, QScriptValue undoData,
QScriptValue redoFunction, QScriptValue redoData) {
if (undoFunction.engine()) {
ScriptUndoCommand* undoCommand = new ScriptUndoCommand(undoFunction, undoData, redoFunction, redoData);
undoCommand->moveToThread(undoFunction.engine()->thread());
_undoStack->push(undoCommand);
}
}
ScriptUndoCommand::ScriptUndoCommand(QScriptValue undoFunction, QScriptValue undoData,
QScriptValue redoFunction, QScriptValue redoData) :
_hasRedone(false),
_undoFunction(undoFunction),
_undoData(undoData),
_redoFunction(redoFunction),
_redoData(redoData) {
}
void ScriptUndoCommand::undo() {
QMetaObject::invokeMethod(this, "doUndo");
}
void ScriptUndoCommand::redo() {
// QUndoStack will call `redo()` when adding a command to the stack. This
// makes it difficult to work with commands that span a period of time - for instance,
// the entity duplicate + move command that duplicates an entity and then moves it.
// A better implementation might be to properly implement `mergeWith()` and `id()`
// so that the two actions in the example would be merged.
if (_hasRedone) {
QMetaObject::invokeMethod(this, "doRedo");
}
_hasRedone = true;
}
void ScriptUndoCommand::doUndo() {
QScriptValueList args;
args << _undoData;
_undoFunction.call(QScriptValue(), args);
}
void ScriptUndoCommand::doRedo() {
QScriptValueList args;
args << _redoData;
_redoFunction.call(QScriptValue(), args);
}

View file

@ -1,53 +0,0 @@
//
// UndoStackScriptingInterface.h
// libraries/script-engine/src
//
// Created by Ryan Huffman on 10/22/14.
// Copyright 2014 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
//
#ifndef hifi_UndoStackScriptingInterface_h
#define hifi_UndoStackScriptingInterface_h
#include <QUndoCommand>
#include <QUndoStack>
#include <QScriptValue>
class UndoStackScriptingInterface : public QObject {
Q_OBJECT
public:
UndoStackScriptingInterface(QUndoStack* undoStack);
public slots:
void pushCommand(QScriptValue undoFunction, QScriptValue undoData, QScriptValue redoFunction, QScriptValue redoData);
private:
QUndoStack* _undoStack;
};
class ScriptUndoCommand : public QObject, public QUndoCommand {
Q_OBJECT
public:
ScriptUndoCommand(QScriptValue undoFunction, QScriptValue undoData, QScriptValue redoFunction, QScriptValue redoData);
virtual void undo() override;
virtual void redo() override;
virtual bool mergeWith(const QUndoCommand* command) override { return false; }
virtual int id() const override { return -1; }
public slots:
void doUndo();
void doRedo();
private:
bool _hasRedone;
QScriptValue _undoFunction;
QScriptValue _undoData;
QScriptValue _redoFunction;
QScriptValue _redoData;
};
#endif // hifi_UndoStackScriptingInterface_h

View file

@ -248,7 +248,7 @@ bool TriangleSet::TriangleTreeCell::findRayIntersection(const glm::vec3& origin,
// The distance passed in here is the distance to our bounding box. If !precision, that distance is used
{
float internalDistance = distance;
BoxFace internalFace;
BoxFace internalFace { UNKNOWN_FACE };
Triangle internalTriangle;
if (findRayIntersectionInternal(origin, direction, internalDistance, internalFace, internalTriangle, precision, trianglesTouched, allowBackface)) {
bestLocalDistance = internalDistance;
@ -472,4 +472,4 @@ bool TriangleSet::TriangleTreeCell::findParabolaIntersection(const glm::vec3& or
triangle = bestLocalTriangle;
}
return intersects;
}
}

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",

View file

@ -42,8 +42,7 @@ function AppUi(properties) {
that.additionalAppScreens = [];
that.checkIsOpen = function checkIsOpen(type, tabletUrl) { // Are we active? Value used to set isOpen.
// Actual url may have prefix or suffix.
return (type === that.currentVisibleScreenType) &&
that.currentVisibleUrl &&
return that.currentVisibleUrl &&
((that.home.indexOf(that.currentVisibleUrl) > -1) ||
(that.additionalAppScreens.indexOf(that.currentVisibleUrl) > -1));
};

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

@ -850,6 +850,7 @@ var toolBar = (function () {
}));
isActive = active;
activeButton.editProperties({isActive: isActive});
undoHistory.setEnabled(isActive);
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
@ -1237,6 +1238,19 @@ var originalLightsArePickable = Entities.getLightsArePickable();
function setupModelMenus() {
// adj our menuitems
Menu.addMenuItem({
menuName: "Edit",
menuItemName: "Undo",
shortcutKey: 'Ctrl+Z',
position: 0,
});
Menu.addMenuItem({
menuName: "Edit",
menuItemName: "Redo",
shortcutKey: 'Ctrl+Shift+Z',
position: 1,
});
Menu.addMenuItem({
menuName: "Edit",
menuItemName: "Entities",
@ -1356,6 +1370,9 @@ function setupModelMenus() {
setupModelMenus(); // do this when first running our script.
function cleanupModelMenus() {
Menu.removeMenuItem("Edit", "Undo");
Menu.removeMenuItem("Edit", "Redo");
Menu.removeSeparator("Edit", "Entities");
if (modelMenuAddedDelete) {
// delete our menuitems
@ -1698,6 +1715,10 @@ function handeMenuEvent(menuItem) {
Entities.setLightsArePickable(Menu.isOptionChecked("Allow Selecting of Lights"));
} else if (menuItem === "Delete") {
deleteSelectedEntities();
} else if (menuItem === "Undo") {
undoHistory.undo();
} else if (menuItem === "Redo") {
undoHistory.redo();
} else if (menuItem === "Parent Entity to Last") {
parentSelectedEntities();
} else if (menuItem === "Unparent Entity") {
@ -1924,6 +1945,86 @@ function recursiveAdd(newParentID, parentData) {
}
}
var UndoHistory = function(onUpdate) {
this.history = [];
// The current position is the index of the last executed action in the history array.
//
// -1 0 1 2 3 <- position
// A B C D <- actions in history
//
// If our lastExecutedIndex is 1, the last executed action is B.
// If we undo, we undo B (index 1). If we redo, we redo C (index 2).
this.lastExecutedIndex = -1;
this.enabled = true;
this.onUpdate = onUpdate;
};
UndoHistory.prototype.pushCommand = function(undoFn, undoArgs, redoFn, redoArgs) {
if (!this.enabled) {
return;
}
// Delete any history following the last executed action.
this.history.splice(this.lastExecutedIndex + 1);
this.history.push({
undoFn: undoFn,
undoArgs: undoArgs,
redoFn: redoFn,
redoArgs: redoArgs
});
this.lastExecutedIndex++;
if (this.onUpdate) {
this.onUpdate();
}
};
UndoHistory.prototype.setEnabled = function(enabled) {
this.enabled = enabled;
if (this.onUpdate) {
this.onUpdate();
}
};
UndoHistory.prototype.canUndo = function() {
return this.enabled && this.lastExecutedIndex >= 0;
};
UndoHistory.prototype.canRedo = function() {
return this.enabled && this.lastExecutedIndex < this.history.length - 1;
};
UndoHistory.prototype.undo = function() {
if (!this.canUndo()) {
console.warn("Cannot undo action");
return;
}
var command = this.history[this.lastExecutedIndex];
command.undoFn(command.undoArgs);
this.lastExecutedIndex--;
if (this.onUpdate) {
this.onUpdate();
}
};
UndoHistory.prototype.redo = function() {
if (!this.canRedo()) {
console.warn("Cannot redo action");
return;
}
var command = this.history[this.lastExecutedIndex + 1];
command.redoFn(command.redoArgs);
this.lastExecutedIndex++;
if (this.onUpdate) {
this.onUpdate();
}
};
function updateUndoRedoMenuItems() {
Menu.setMenuEnabled("Edit > Undo", undoHistory.canUndo());
Menu.setMenuEnabled("Edit > Redo", undoHistory.canRedo());
}
var undoHistory = new UndoHistory(updateUndoRedoMenuItems);
updateUndoRedoMenuItems();
// When an entity has been deleted we need a way to "undo" this deletion. Because it's not currently
// possible to create an entity with a specific id, earlier undo commands to the deleted entity
// will fail if there isn't a way to find the new entity id.
@ -2011,7 +2112,7 @@ function pushCommandForSelections(createdEntityData, deletedEntityData, doNotSav
properties: currentProperties
});
}
UndoStack.pushCommand(applyEntityProperties, undoData, applyEntityProperties, redoData);
undoHistory.pushCommand(applyEntityProperties, undoData, applyEntityProperties, redoData);
}
var ServerScriptStatusMonitor = function(entityID, statusCallback) {

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

(image error) Size: 3.9 KiB

View file

@ -96,7 +96,7 @@
});
}
var emitWalletSetupEvent = function () {
emitWalletSetupEvent = function () {
EventBridge.emitWebEvent(JSON.stringify({
type: "WALLET_SETUP"
}));
@ -316,12 +316,16 @@
if ($this.text() === buyString || $this.text() === getString) {
return;
}
if ($this.text() === 'invalidated') {
return;
}
$this.data('initialHtml', $this.html());
var cost = $(this).parent().siblings().text();
if (parseInt(cost) > 0) {
$this.text(buyString);
} else {
}
if (parseInt(cost) == 0) {
$this.text(getString);
}
});
@ -333,6 +337,9 @@
$('.grid-item').find('#price-or-edit').find('a').on('click', function () {
if ($(this).closest('.grid-item').find('.price').text() === 'invalidated') {
return false;
}
buyButtonClicked($(this).closest('.grid-item').attr('data-item-id'),
$(this).closest('.grid-item').find('.item-title').text(),
$(this).closest('.grid-item').find('.creator').find('.value').text(),

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);

View file

@ -88,6 +88,49 @@ function setTabletVisibleInSecondaryCamera(visibleInSecondaryCam) {
function openWallet() {
ui.open(MARKETPLACE_WALLET_QML_PATH);
}
function setupWallet(referrer) {
// Needs to be done within the QML page in order to get access to QmlCommerce
openWallet();
var ALLOWANCE_FOR_EVENT_BRIDGE_SETUP = 0;
Script.setTimeout(function () {
ui.tablet.sendToQml({
method: 'updateWalletReferrer',
referrer: referrer
});
}, ALLOWANCE_FOR_EVENT_BRIDGE_SETUP);
}
function onMarketplaceOpen(referrer) {
var cta = referrer, match;
if (Account.loggedIn && walletNeedsSetup()) {
if (referrer === MARKETPLACE_URL_INITIAL) {
setupWallet('marketplace cta');
} else {
match = referrer.match(/\/item\/(\w+)$/);
if (match && match[1]) {
setupWallet(match[1]);
} else if (referrer.indexOf(METAVERSE_SERVER_URL) === -1) { // not a url
setupWallet(referrer);
} else {
print("WARNING: opening marketplace to", referrer, "without wallet setup.");
}
}
}
}
function openMarketplace(optionalItemOrUrl) {
// This is a bit of a kluge, but so is the whole file.
// If given a whole path, use it with no cta.
// If given an id, build the appropriate url and use the id as the cta.
// Otherwise, use home and 'marketplace cta'.
// AND... if call onMarketplaceOpen to setupWallet if we need to.
var url = optionalItemOrUrl || MARKETPLACE_URL_INITIAL;
// If optionalItemOrUrl contains the metaverse base, then it's a url, not an item id.
if (optionalItemOrUrl && optionalItemOrUrl.indexOf(METAVERSE_SERVER_URL) === -1) {
url = MARKETPLACE_URL + '/items/' + optionalItemOrUrl;
}
ui.open(url, MARKETPLACES_INJECT_SCRIPT_URL);
}
// Function Name: wireQmlEventBridge()
//
@ -134,10 +177,14 @@ function setCertificateInfo(currentEntityWithContextOverlay, itemCertificateId)
function onUsernameChanged() {
if (onMarketplaceScreen) {
ui.open(MARKETPLACE_URL_INITIAL, MARKETPLACES_INJECT_SCRIPT_URL);
openMarketplace();
}
}
function walletNeedsSetup() {
return Wallet.walletStatus === 1;
}
function sendCommerceSettings() {
ui.sendToHtml({
type: "marketplaces",
@ -145,7 +192,7 @@ function sendCommerceSettings() {
data: {
commerceMode: Settings.getValue("commerce", true),
userIsLoggedIn: Account.loggedIn,
walletNeedsSetup: Wallet.walletStatus === 1,
walletNeedsSetup: walletNeedsSetup(),
metaverseServerURL: Account.metaverseServerURL,
messagesWaiting: shouldShowDot
}
@ -626,6 +673,8 @@ var filterText; // Used for updating Purchases QML
function onWebEventReceived(message) {
message = JSON.parse(message);
if (message.type === GOTO_DIRECTORY) {
// This is the chooser between marketplaces. Only OUR markteplace
// requires/makes-use-of wallet, so doesn't go through openMarketplace bottleneck.
ui.open(MARKETPLACES_URL, MARKETPLACES_INJECT_SCRIPT_URL);
} else if (message.type === QUERY_CAN_WRITE_ASSETS) {
ui.sendToHtml(CAN_WRITE_ASSETS + " " + Entities.canWriteAssets());
@ -667,12 +716,7 @@ function onWebEventReceived(message) {
} else if (message.type === "LOGIN") {
openLoginWindow();
} else if (message.type === "WALLET_SETUP") {
wireQmlEventBridge(true);
ui.tablet.sendToQml({
method: 'updateWalletReferrer',
referrer: "marketplace cta"
});
openWallet();
setupWallet('marketplace cta');
} else if (message.type === "MY_ITEMS") {
referrerURL = MARKETPLACE_URL_INITIAL;
filterText = "";
@ -780,6 +824,14 @@ var onQmlMessageReceived = function onQmlMessageReceived(message) {
return;
}
switch (message.method) {
case 'gotoBank':
ui.close();
if (Account.metaverseServerURL.indexOf("staging") >= 0) {
Window.location = "hifi://hifiqa-master-metaverse-staging"; // So that we can test in staging.
} else {
Window.location = "hifi://BankOfHighFidelity";
}
break;
case 'purchases_openWallet':
case 'checkout_openWallet':
case 'checkout_setUpClicked':
@ -802,7 +854,7 @@ var onQmlMessageReceived = function onQmlMessageReceived(message) {
openWallet();
break;
case 'checkout_cancelClicked':
ui.open(MARKETPLACE_URL + '/items/' + message.params, MARKETPLACES_INJECT_SCRIPT_URL);
openMarketplace(message.params);
break;
case 'header_goToPurchases':
case 'checkout_goToPurchases':
@ -811,15 +863,15 @@ var onQmlMessageReceived = function onQmlMessageReceived(message) {
ui.open(MARKETPLACE_PURCHASES_QML_PATH);
break;
case 'checkout_itemLinkClicked':
ui.open(MARKETPLACE_URL + '/items/' + message.itemId, MARKETPLACES_INJECT_SCRIPT_URL);
openMarketplace(message.itemId);
break;
case 'checkout_continueShopping':
ui.open(MARKETPLACE_URL_INITIAL, MARKETPLACES_INJECT_SCRIPT_URL);
openMarketplace();
break;
case 'purchases_itemInfoClicked':
var itemId = message.itemId;
if (itemId && itemId !== "") {
ui.open(MARKETPLACE_URL + '/items/' + itemId, MARKETPLACES_INJECT_SCRIPT_URL);
openMarketplace(itemId);
}
break;
case 'checkout_rezClicked':
@ -840,20 +892,20 @@ var onQmlMessageReceived = function onQmlMessageReceived(message) {
break;
case 'header_marketplaceImageClicked':
case 'purchases_backClicked':
ui.open(message.referrerURL, MARKETPLACES_INJECT_SCRIPT_URL);
openMarketplace(message.referrerURL);
break;
case 'purchases_goToMarketplaceClicked':
ui.open(MARKETPLACE_URL_INITIAL, MARKETPLACES_INJECT_SCRIPT_URL);
openMarketplace();
break;
case 'updateItemClicked':
ui.open(message.upgradeUrl + "?edition=" + message.itemEdition,
MARKETPLACES_INJECT_SCRIPT_URL);
openMarketplace(message.upgradeUrl + "?edition=" + message.itemEdition);
break;
case 'giftAsset':
break;
case 'passphrasePopup_cancelClicked':
case 'needsLogIn_cancelClicked':
// Should/must NOT check for wallet setup.
ui.open(MARKETPLACE_URL_INITIAL, MARKETPLACES_INJECT_SCRIPT_URL);
break;
case 'needsLogIn_loginClicked':
@ -883,7 +935,7 @@ var onQmlMessageReceived = function onQmlMessageReceived(message) {
ContextOverlay.requestOwnershipVerification(message.entity);
break;
case 'inspectionCertificate_showInMarketplaceClicked':
ui.open(message.marketplaceUrl, MARKETPLACES_INJECT_SCRIPT_URL);
openMarketplace(message.marketplaceUrl);
break;
case 'header_myItemsClicked':
referrerURL = MARKETPLACE_URL_INITIAL;
@ -1024,12 +1076,7 @@ var onTabletScreenChanged = function onTabletScreenChanged(type, url) {
onCommerceScreen = onCommerceScreenNow;
onWalletScreen = onWalletScreenNow;
onMarketplaceItemTesterScreen = onMarketplaceItemTesterScreenNow;
wireQmlEventBridge(
onMarketplaceScreen ||
onCommerceScreen ||
onWalletScreen ||
onMarketplaceItemTesterScreen);
wireQmlEventBridge(onCommerceScreen || onWalletScreen || onMarketplaceItemTesterScreen);
if (url === MARKETPLACE_PURCHASES_QML_PATH) {
// FIXME? Is there a race condition here in which the event
@ -1066,6 +1113,9 @@ var onTabletScreenChanged = function onTabletScreenChanged(type, url) {
isWired = true;
Wallet.refreshWalletStatus();
} else {
if (onMarketplaceScreen) {
onMarketplaceOpen('marketplace cta');
}
ui.tablet.sendToQml({
method: 'inspectionCertificate_resetCert'
});

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;