Merge branch 'master' of https://github.com/highfidelity/hifi into MAC

This commit is contained in:
NissimHadar 2018-11-13 10:12:52 -08:00
commit 2011e7b94c
16 changed files with 107 additions and 23 deletions

View file

@ -18,6 +18,11 @@
window.isKeyboardRaised = false;
window.isNumericKeyboard = false;
window.isPasswordField = false;
window.lastActiveElement = null;
function getActiveElement() {
return document.activeElement;
}
function shouldSetPasswordField() {
var nodeType = document.activeElement.type;
@ -65,10 +70,11 @@
var keyboardRaised = shouldRaiseKeyboard();
var numericKeyboard = shouldSetNumeric();
var passwordField = shouldSetPasswordField();
var activeElement = getActiveElement();
if (isWindowFocused &&
(keyboardRaised !== window.isKeyboardRaised || numericKeyboard !== window.isNumericKeyboard
|| passwordField !== window.isPasswordField)) {
|| passwordField !== window.isPasswordField || activeElement !== window.lastActiveElement)) {
if (typeof EventBridge !== "undefined" && EventBridge !== null) {
EventBridge.emitWebEvent(
@ -90,6 +96,7 @@
window.isKeyboardRaised = keyboardRaised;
window.isNumericKeyboard = numericKeyboard;
window.isPasswordField = passwordField;
window.lastActiveElement = activeElement;
}
}, POLL_FREQUENCY);

View file

@ -34,10 +34,34 @@ Item {
webViewCore.stop();
}
Timer {
id: delayedUnfocuser
repeat: false
interval: 200
onTriggered: {
// The idea behind this is to delay unfocusing, so that fast lower/raise will not result actual unfocusing.
// Fast lower/raise happens every time keyboard is being re-raised (see the code below in OffscreenQmlSurface::setKeyboardRaised)
//
// if (raised) {
// item->setProperty("keyboardRaised", QVariant(!raised));
// }
//
// item->setProperty("keyboardRaised", QVariant(raised));
//
webViewCore.runJavaScript("if (document.activeElement) document.activeElement.blur();", function(result) {
console.log('unfocus completed: ', result);
});
}
}
function unfocus() {
webViewCore.runJavaScript("if (document.activeElement) document.activeElement.blur();", function(result) {
console.log('unfocus completed: ', result);
});
delayedUnfocuser.start();
}
function stopUnfocus() {
delayedUnfocuser.stop();
}
function onLoadingChanged(loadRequest) {

View file

@ -13,6 +13,8 @@ Item {
onKeyboardRaisedChanged: {
if(!keyboardRaised) {
webroot.unfocus();
} else {
webroot.stopUnfocus();
}
}
property bool punctuationMode: false

View file

@ -17,6 +17,8 @@ Item {
onKeyboardRaisedChanged: {
if(!keyboardRaised) {
webroot.unfocus();
} else {
webroot.stopUnfocus();
}
}
property bool punctuationMode: false

View file

@ -15,6 +15,8 @@ Item {
onKeyboardRaisedChanged: {
if(!keyboardRaised) {
webroot.unfocus();
} else {
webroot.stopUnfocus();
}
}
property bool punctuationMode: false

View file

@ -49,6 +49,7 @@ Item {
property string defaultThumbnail: Qt.resolvedUrl("../../images/default-domain.gif");
property int shadowHeight: 10;
property bool hovered: false
property bool scrolling: false
HifiConstants { id: hifi }
@ -236,11 +237,12 @@ Item {
property var hoverThunk: function () { };
property var unhoverThunk: function () { };
Rectangle {
anchors.fill: parent;
visible: root.hovered
color: "transparent";
border.width: 4; border.color: hifiStyleConstants.colors.primaryHighlight;
z: 1;
anchors.fill: parent
visible: root.hovered && !root.scrolling
color: "transparent"
border.width: 4
border.color: hifiStyleConstants.colors.primaryHighlight
z: 1
}
MouseArea {
anchors.fill: parent;
@ -255,6 +257,12 @@ Item {
hoverThunk();
}
onExited: unhoverThunk();
onCanceled: unhoverThunk();
}
MouseArea {
// This second mouse area causes onEntered to fire on the first if you scroll just a little and the cursor stays on
// the original card. I.e., the original card is re-highlighted if the cursor is on it after scrolling finishes.
anchors.fill: parent
}
StateImage {
id: actionIcon;

View file

@ -141,6 +141,8 @@ Column {
textSizeSmall: root.textSizeSmall;
stackShadowNarrowing: root.stackShadowNarrowing;
shadowHeight: root.stackedCardShadowHeight;
scrolling: scroll.moving
hoverThunk: function () {
hovered = true;
if(root.autoScrollTimerEnabled) {

View file

@ -251,17 +251,29 @@ Item {
height: 15
Rectangle {
property bool isHovered: false
anchors.centerIn: parent
opacity: index === pageIndicator.currentIndex ? 0.95 : 0.45
implicitWidth: index === pageIndicator.currentIndex ? 15 : 10
opacity: index === pageIndicator.currentIndex || isHovered ? 0.95 : 0.45
implicitWidth: index === pageIndicator.currentIndex || isHovered ? 15 : 10
implicitHeight: implicitWidth
radius: width/2
color: "white"
color: isHovered && index !== pageIndicator.currentIndex ? "#1fc6a6" : "white"
Behavior on opacity {
OpacityAnimator {
duration: 100
}
}
MouseArea {
anchors.centerIn: parent
width: 20
height: 30 // Make it easier to target with laser.
hoverEnabled: true
enabled: true
onEntered: parent.isHovered = true;
onExited: parent.isHovered = false;
onClicked: swipeView.currentIndex = index;
}
}
}

View file

@ -3537,7 +3537,17 @@ void Application::handleSandboxStatus(QNetworkReply* reply) {
} else {
#if !defined(Q_OS_ANDROID)
qCDebug(interfaceapp) << "Not first run... going to" << qPrintable(addressLookupString.isEmpty() ? QString("previous location") : addressLookupString);
QString goingTo = "";
if (addressLookupString.isEmpty()) {
if (Menu::getInstance()->isOptionChecked(MenuOption::HomeLocation)) {
auto locationBookmarks = DependencyManager::get<LocationBookmarks>();
addressLookupString = locationBookmarks->addressForBookmark(LocationBookmarks::HOME_BOOKMARK);
goingTo = "home location";
} else {
goingTo = "previous location";
}
}
qCDebug(interfaceapp) << "Not first run... going to" << qPrintable(!goingTo.isEmpty() ? goingTo : addressLookupString);
DependencyManager::get<AddressManager>()->loadSettings(addressLookupString);
sentTo = SENT_TO_PREVIOUS_LOCATION;
#endif

View file

@ -226,6 +226,14 @@ Menu::Menu() {
addActionToQMenuAndActionHash(navigateMenu, MenuOption::CopyPath, 0,
addressManager.data(), SLOT(copyPath()));
// Navigate > Start-up Location
MenuWrapper* startupLocationMenu = navigateMenu->addMenu(MenuOption::StartUpLocation);
QActionGroup* startupLocatiopnGroup = new QActionGroup(startupLocationMenu);
startupLocatiopnGroup->setExclusive(true);
startupLocatiopnGroup->addAction(addCheckableActionToQMenuAndActionHash(startupLocationMenu, MenuOption::HomeLocation, 0,
false));
startupLocatiopnGroup->addAction(addCheckableActionToQMenuAndActionHash(startupLocationMenu, MenuOption::LastLocation, 0,
true));
// Settings menu ----------------------------------
MenuWrapper* settingsMenu = addMenu("Settings");

View file

@ -117,9 +117,11 @@ namespace MenuOption {
const QString FrameTimer = "Show Timer";
const QString FullscreenMirror = "Mirror";
const QString Help = "Help...";
const QString HomeLocation = "Home";
const QString IncreaseAvatarSize = "Increase Avatar Size";
const QString IndependentMode = "Independent Mode";
const QString ActionMotorControl = "Enable Default Motor Control";
const QString LastLocation = "Last Location";
const QString LoadScript = "Open and Run Script File...";
const QString LoadScriptURL = "Open and Run Script from URL...";
const QString LodTools = "LOD Tools";
@ -197,6 +199,7 @@ namespace MenuOption {
const QString SimulateEyeTracking = "Simulate";
const QString SMIEyeTracking = "SMI Eye Tracking";
const QString SparseTextureManagement = "Enable Sparse Texture Management";
const QString StartUpLocation = "Start-Up Location";
const QString Stats = "Show Statistics";
const QString AnimStats = "Show Animation Stats";
const QString StopAllScripts = "Stop All Scripts";

View file

@ -1972,6 +1972,7 @@ AnimPose Rig::getJointPose(int jointIndex) const {
void Rig::copyJointsIntoJointData(QVector<JointData>& jointDataVec) const {
const AnimPose geometryToRigPose(_geometryToRigTransform);
const glm::vec3 geometryToRigScale(geometryToRigPose.scale());
jointDataVec.resize((int)getJointStateCount());
for (auto i = 0; i < jointDataVec.size(); i++) {
@ -1984,9 +1985,10 @@ void Rig::copyJointsIntoJointData(QVector<JointData>& jointDataVec) const {
// translations are in relative frame but scaled so that they are in meters,
// instead of model units.
glm::vec3 defaultRelTrans = _geometryOffset.scale() * _animSkeleton->getRelativeDefaultPose(i).trans();
data.translation = _geometryOffset.scale() * (!_sendNetworkNode ? _internalPoseSet._relativePoses[i].trans() : _networkPoseSet._relativePoses[i].trans());
data.translationIsDefaultPose = isEqual(data.translation, defaultRelTrans);
glm::vec3 defaultRelTrans = _animSkeleton->getRelativeDefaultPose(i).trans();
glm::vec3 currentRelTrans = _sendNetworkNode ? _networkPoseSet._relativePoses[i].trans() : _internalPoseSet._relativePoses[i].trans();
data.translation = geometryToRigScale * currentRelTrans;
data.translationIsDefaultPose = isEqual(currentRelTrans, defaultRelTrans);
} else {
data.translationIsDefaultPose = true;
data.rotationIsDefaultPose = true;
@ -2012,6 +2014,8 @@ void Rig::copyJointsFromJointData(const QVector<JointData>& jointDataVec) {
std::vector<glm::quat> rotations;
rotations.reserve(numJoints);
const glm::quat rigToGeometryRot(glmExtractRotation(_rigToGeometryTransform));
const glm::vec3 rigToGeometryScale(extractScale(_rigToGeometryTransform));
for (int i = 0; i < numJoints; i++) {
const JointData& data = jointDataVec.at(i);
if (data.rotationIsDefaultPose) {
@ -2037,7 +2041,7 @@ void Rig::copyJointsFromJointData(const QVector<JointData>& jointDataVec) {
_internalPoseSet._relativePoses[i].trans() = relativeDefaultPoses[i].trans();
} else {
// JointData translations are in scaled relative-frame so we scale back to regular relative-frame
_internalPoseSet._relativePoses[i].trans() = _invGeometryOffset.scale() * data.translation;
_internalPoseSet._relativePoses[i].trans() = rigToGeometryScale * data.translation;
}
}
}

View file

@ -40,7 +40,7 @@ PacketVersion versionForPacketType(PacketType packetType) {
case PacketType::AvatarData:
case PacketType::BulkAvatarData:
case PacketType::KillAvatar:
return static_cast<PacketVersion>(AvatarMixerPacketVersion::FarGrabJointsRedux);
return static_cast<PacketVersion>(AvatarMixerPacketVersion::JointTransScaled);
case PacketType::MessagesData:
return static_cast<PacketVersion>(MessageDataVersion::TextOrBinaryData);
// ICE packets

View file

@ -296,7 +296,8 @@ enum class AvatarMixerPacketVersion : PacketVersion {
FarGrabJoints,
MigrateSkeletonURLToTraits,
MigrateAvatarEntitiesToTraits,
FarGrabJointsRedux
FarGrabJointsRedux,
JointTransScaled
};
enum class DomainConnectRequestVersion : PacketVersion {

View file

@ -448,7 +448,7 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
this.leftPointer = this.pointerManager.createPointer(false, PickType.Ray, {
joint: "_CAMERA_RELATIVE_CONTROLLER_LEFTHAND",
filter: Picks.PICK_OVERLAYS | Picks.PICK_ENTITIES,
filter: Picks.PICK_OVERLAYS | Picks.PICK_ENTITIES | Picks.PICK_INCLUDE_NONCOLLIDABLE,
triggers: [{action: Controller.Standard.LTClick, button: "Focus"}, {action: Controller.Standard.LTClick, button: "Primary"}],
posOffset: getGrabPointSphereOffset(Controller.Standard.LeftHand, true),
hover: true,
@ -458,7 +458,7 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
});
this.rightPointer = this.pointerManager.createPointer(false, PickType.Ray, {
joint: "_CAMERA_RELATIVE_CONTROLLER_RIGHTHAND",
filter: Picks.PICK_OVERLAYS | Picks.PICK_ENTITIES,
filter: Picks.PICK_OVERLAYS | Picks.PICK_ENTITIES | Picks.PICK_INCLUDE_NONCOLLIDABLE,
triggers: [{action: Controller.Standard.RTClick, button: "Focus"}, {action: Controller.Standard.RTClick, button: "Primary"}],
posOffset: getGrabPointSphereOffset(Controller.Standard.RightHand, true),
hover: true,
@ -490,7 +490,7 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
});
this.mouseRayPick = Pointers.createPointer(PickType.Ray, {
joint: "Mouse",
filter: Picks.PICK_ENTITIES | Picks.PICK_OVERLAYS,
filter: Picks.PICK_OVERLAYS | Picks.PICK_ENTITIES | Picks.PICK_INCLUDE_NONCOLLIDABLE,
enabled: true
});
this.handleHandMessage = function(channel, data, sender) {

View file

@ -83,7 +83,6 @@ Script.include("/~/system/libraries/controllers.js");
this.potentialEntityWithContextOverlay = false;
this.entityWithContextOverlay = false;
this.contextOverlayTimer = false;
this.previousCollisionStatus = false;
this.locked = false;
this.highlightedEntity = null;
this.reticleMinX = MARGIN;