Merge branch 'master' of https://github.com/highfidelity/hifi into fixGrabWebSurface-case-16192

This commit is contained in:
Wayne Chen 2018-07-23 11:51:39 -07:00
commit 89f9cd089f
18 changed files with 285 additions and 29 deletions

View File

@ -22,7 +22,8 @@
android:icon="@drawable/ic_launcher" android:icon="@drawable/ic_launcher"
android:launchMode="singleTop" android:launchMode="singleTop"
android:roundIcon="@drawable/ic_launcher"> android:roundIcon="@drawable/ic_launcher">
<activity android:name="io.highfidelity.hifiinterface.PermissionChecker"> <activity android:name="io.highfidelity.hifiinterface.PermissionChecker"
android:theme="@style/Theme.AppCompat.Translucent.NoActionBar.Launcher">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />

View File

@ -8,6 +8,7 @@ import android.content.Intent;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.util.Log;
import android.view.View;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
@ -135,4 +136,13 @@ public class PermissionChecker extends Activity {
launchActivityWithPermissions(); launchActivityWithPermissions();
} }
} }
@Override
protected void onResume() {
super.onResume();
View decorView = getWindow().getDecorView();
// Hide the status bar.
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
}
} }

View File

@ -66,6 +66,7 @@ public class HomeFragment extends Fragment {
GridLayoutManager gridLayoutMgr = new GridLayoutManager(getContext(), numberOfColumns); GridLayoutManager gridLayoutMgr = new GridLayoutManager(getContext(), numberOfColumns);
mDomainsView.setLayoutManager(gridLayoutMgr); mDomainsView.setLayoutManager(gridLayoutMgr);
mDomainAdapter = new DomainAdapter(getContext(), HifiUtils.getInstance().protocolVersionSignature(), nativeGetLastLocation()); mDomainAdapter = new DomainAdapter(getContext(), HifiUtils.getInstance().protocolVersionSignature(), nativeGetLastLocation());
mSwipeRefreshLayout.setRefreshing(true);
mDomainAdapter.setClickListener((view, position, domain) -> { mDomainAdapter.setClickListener((view, position, domain) -> {
new Handler(getActivity().getMainLooper()).postDelayed(() -> { new Handler(getActivity().getMainLooper()).postDelayed(() -> {
if (mListener != null) { if (mListener != null) {

View File

@ -60,6 +60,8 @@ import android.view.View;
import android.view.WindowManager.LayoutParams; import android.view.WindowManager.LayoutParams;
import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityEvent;
import org.qtproject.qt5.android.QtNative;
@SuppressWarnings("unused") @SuppressWarnings("unused")
public class QtActivity extends Activity { public class QtActivity extends Activity {
public String APPLICATION_PARAMETERS = null; public String APPLICATION_PARAMETERS = null;
@ -103,7 +105,7 @@ public class QtActivity extends Activity {
} }
public boolean super_dispatchPopulateAccessibilityEvent(AccessibilityEvent event) { public boolean super_dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
return super_dispatchPopulateAccessibilityEvent(event); return super.dispatchPopulateAccessibilityEvent(event);
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@ -362,7 +364,25 @@ public class QtActivity extends Activity {
@Override @Override
protected void onDestroy() { protected void onDestroy() {
super.onDestroy(); super.onDestroy();
QtApplication.invokeDelegate(); /*
cduarte https://highfidelity.manuscript.com/f/cases/16712/App-freezes-on-opening-randomly
After Qt upgrade to 5.11 we had a black screen crash after closing the application with
the hardware button "Back" and trying to start the app again. It could only be fixed after
totally closing the app swiping it in the list of running apps.
This problem did not happen with the previous Qt version.
After analysing changes we came up with this case and change:
https://codereview.qt-project.org/#/c/218882/
In summary they've moved libs loading to the same thread as main() and as a matter of correctness
in the onDestroy method in QtActivityDelegate, they exit that thread with `QtNative.m_qtThread.exit();`
That exit call is the main reason of this problem.
In this fix we just replace the `QtApplication.invokeDelegate();` call that may end using the
entire onDestroy method including that thread exit line for other three lines that purposely
terminate qt (borrowed from QtActivityDelegate::onDestroy as well).
*/
QtNative.terminateQt();
QtNative.setActivity(null, null);
System.exit(0);
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" android:opacity="opaque">
<item android:drawable="@android:color/black"/>
<item android:drawable="@drawable/hifi_logo_splash"
android:gravity="center_horizontal"
android:top="225dp"
android:height="242dp"
android:width="242dp">
</item>
</layer-list>

View File

@ -7,9 +7,17 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@android:color/black"> android:background="@android:color/black">
<ImageView <ImageView
android:id="@+id/hifi_logo"
android:layout_width="242dp" android:layout_width="242dp"
android:layout_height="242dp" android:layout_height="242dp"
android:src="@drawable/hifi_logo_splash" android:src="@drawable/hifi_logo_splash"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_marginTop="225dp"/> android:layout_marginTop="225dp"/>
<ProgressBar
style="@style/Widget.AppCompat.ProgressBar"
android:theme="@style/HifiCircularProgress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/hifi_logo"
android:layout_centerHorizontal="true"/>
</RelativeLayout> </RelativeLayout>

View File

@ -17,4 +17,5 @@
<color name="colorLoginError">#FF7171</color> <color name="colorLoginError">#FF7171</color>
<color name="black_060">#99000000</color> <color name="black_060">#99000000</color>
<color name="statusbar_color">#292929</color> <color name="statusbar_color">#292929</color>
<color name="hifiLogoColor">#23B2E7</color>
</resources> </resources>

View File

@ -19,6 +19,9 @@
<item name="windowActionBar">false</item> <item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item> <item name="windowNoTitle">true</item>
</style> </style>
<style name="Theme.AppCompat.Translucent.NoActionBar.Launcher" parent="Theme.AppCompat.Translucent.NoActionBar">
<item name="android:windowBackground">@drawable/launch_screen</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" /> <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
@ -62,4 +65,7 @@
<item name="android:background">@color/white_opaque</item> <item name="android:background">@color/white_opaque</item>
</style> </style>
<style name="HifiCircularProgress" parent="Theme.AppCompat.Light">
<item name="colorAccent">@color/hifiLogoColor</item>
</style>
</resources> </resources>

View File

@ -1223,7 +1223,7 @@
"name": "max_avatar_height", "name": "max_avatar_height",
"type": "double", "type": "double",
"label": "Maximum Avatar Height (meters)", "label": "Maximum Avatar Height (meters)",
"help": "Limits the scale of avatars in your domain. Cannot be greater than 1755.", "help": "Limits the height of avatars in your domain. Cannot be greater than 1755.",
"placeholder": 5.2, "placeholder": 5.2,
"default": 5.2 "default": 5.2
}, },

View File

@ -59,6 +59,10 @@ $(document).ready(function(){
Settings.handlePostSettings = function(formJSON) { Settings.handlePostSettings = function(formJSON) {
if (!verifyAvatarHeights()) {
return false;
}
// check if we've set the basic http password // check if we've set the basic http password
if (formJSON["security"]) { if (formJSON["security"]) {
@ -207,7 +211,7 @@ $(document).ready(function(){
swal({ swal({
title: '', title: '',
type: 'error', type: 'error',
text: "There was a problem retreiving domain information from High Fidelity API.", text: "There was a problem retrieving domain information from High Fidelity API.",
confirmButtonText: 'Try again', confirmButtonText: 'Try again',
showCancelButton: true, showCancelButton: true,
closeOnConfirm: false closeOnConfirm: false
@ -288,7 +292,7 @@ $(document).ready(function(){
swal({ swal({
title: 'Create new domain ID', title: 'Create new domain ID',
type: 'input', type: 'input',
text: 'Enter a label this machine.</br></br>This will help you identify which domain ID belongs to which machine.</br></br>', text: 'Enter a label for this machine.</br></br>This will help you identify which domain ID belongs to which machine.</br></br>',
showCancelButton: true, showCancelButton: true,
confirmButtonText: "Create", confirmButtonText: "Create",
closeOnConfirm: false, closeOnConfirm: false,
@ -669,7 +673,7 @@ $(document).ready(function(){
var spinner = createDomainSpinner(); var spinner = createDomainSpinner();
$('#' + Settings.PLACES_TABLE_ID).after($(spinner)); $('#' + Settings.PLACES_TABLE_ID).after($(spinner));
var errorEl = createDomainLoadingError("There was an error retreiving your places."); var errorEl = createDomainLoadingError("There was an error retrieving your places.");
$("#" + Settings.PLACES_TABLE_ID).after(errorEl); $("#" + Settings.PLACES_TABLE_ID).after(errorEl);
// do we have a domain ID? // do we have a domain ID?
@ -1091,4 +1095,43 @@ $(document).ready(function(){
$('#settings_backup .panel-body').html(html); $('#settings_backup .panel-body').html(html);
} }
function verifyAvatarHeights() {
var errorString = '';
var minAllowedHeight = 0.009;
var maxAllowedHeight = 1755;
var alertCss = { backgroundColor: '#ffa0a0' };
var minHeightElement = $('input[name="avatars.min_avatar_height"]');
var maxHeightElement = $('input[name="avatars.max_avatar_height"]');
var minHeight = Number(minHeightElement.val());
var maxHeight = Number(maxHeightElement.val());
if (maxHeight < minHeight) {
errorString = 'Maximum avatar height must not be less than minimum avatar height<br>';
minHeightElement.css(alertCss);
maxHeightElement.css(alertCss);
};
if (minHeight < minAllowedHeight) {
errorString += 'Minimum avatar height must not be less than ' + minAllowedHeight + '<br>';
minHeightElement.css(alertCss);
}
if (maxHeight > maxAllowedHeight) {
errorString += 'Maximum avatar height must not be greater than ' + maxAllowedHeight + '<br>';
maxHeightElement.css(alertCss);
}
if (errorString.length > 0) {
swal({
type: 'error',
title: '',
text: errorString,
html: true
});
return false;
} else {
return true;
}
}
}); });

View File

@ -275,6 +275,13 @@ Menu::Menu() {
QString("hifi/tablet/TabletGraphicsPreferences.qml"), "GraphicsPreferencesDialog"); QString("hifi/tablet/TabletGraphicsPreferences.qml"), "GraphicsPreferencesDialog");
}); });
// Settings > Attachments...
action = addActionToQMenuAndActionHash(settingsMenu, MenuOption::Attachments);
connect(action, &QAction::triggered, [] {
qApp->showDialog(QString("hifi/dialogs/AttachmentsDialog.qml"),
QString("hifi/tablet/TabletAttachmentsDialog.qml"), "AttachmentsDialog");
});
// Settings > Developer Menu // Settings > Developer Menu
addCheckableActionToQMenuAndActionHash(settingsMenu, "Developer Menu", 0, false, this, SLOT(toggleDeveloperMenus())); addCheckableActionToQMenuAndActionHash(settingsMenu, "Developer Menu", 0, false, this, SLOT(toggleDeveloperMenus()));

View File

@ -262,6 +262,9 @@ int main(int argc, const char* argv[]) {
// Extend argv to enable WebGL rendering // Extend argv to enable WebGL rendering
std::vector<const char*> argvExtended(&argv[0], &argv[argc]); std::vector<const char*> argvExtended(&argv[0], &argv[argc]);
argvExtended.push_back("--ignore-gpu-blacklist"); argvExtended.push_back("--ignore-gpu-blacklist");
#ifdef Q_OS_ANDROID
argvExtended.push_back("--suppress-settings-reset");
#endif
int argcExtended = (int)argvExtended.size(); int argcExtended = (int)argvExtended.size();
PROFILE_SYNC_END(startup, "main startup", ""); PROFILE_SYNC_END(startup, "main startup", "");

View File

@ -159,13 +159,12 @@ function fromQml(message) { // messages are {method, params}, like json-rpc. See
for(var bookmarkName in message.data.bookmarks) { for(var bookmarkName in message.data.bookmarks) {
var bookmark = message.data.bookmarks[bookmarkName]; var bookmark = message.data.bookmarks[bookmarkName];
if (!bookmark.avatarEntites) { // ensure avatarEntites always exist
bookmark.avatarEntites = [];
}
if (bookmark.avatarEntites) {
bookmark.avatarEntites.forEach(function(avatarEntity) { bookmark.avatarEntites.forEach(function(avatarEntity) {
avatarEntity.properties.localRotationAngles = Quat.safeEulerAngles(avatarEntity.properties.localRotation) avatarEntity.properties.localRotationAngles = Quat.safeEulerAngles(avatarEntity.properties.localRotation);
}) });
}
} }
sendToQml(message) sendToQml(message)

View File

@ -10,7 +10,7 @@
/* global Script, Controller, RIGHT_HAND, LEFT_HAND, enableDispatcherModule, disableDispatcherModule, makeRunningValues, /* global Script, Controller, RIGHT_HAND, LEFT_HAND, enableDispatcherModule, disableDispatcherModule, makeRunningValues,
Messages, makeDispatcherModuleParameters, HMD, getGrabPointSphereOffset, COLORS_GRAB_SEARCHING_HALF_SQUEEZE, Messages, makeDispatcherModuleParameters, HMD, getGrabPointSphereOffset, COLORS_GRAB_SEARCHING_HALF_SQUEEZE,
COLORS_GRAB_SEARCHING_FULL_SQUEEZE, COLORS_GRAB_DISTANCE_HOLD, DEFAULT_SEARCH_SPHERE_DISTANCE, TRIGGER_ON_VALUE, COLORS_GRAB_SEARCHING_FULL_SQUEEZE, COLORS_GRAB_DISTANCE_HOLD, DEFAULT_SEARCH_SPHERE_DISTANCE, TRIGGER_ON_VALUE,
getEnabledModuleByName, PICK_MAX_DISTANCE, isInEditMode, Picks, makeLaserParams getEnabledModuleByName, PICK_MAX_DISTANCE, isInEditMode, Picks, makeLaserParams, Entities
*/ */
Script.include("/~/system/libraries/controllerDispatcherUtils.js"); Script.include("/~/system/libraries/controllerDispatcherUtils.js");
@ -19,7 +19,7 @@ Script.include("/~/system/libraries/utils.js");
(function () { (function () {
var MARGIN = 25; var MARGIN = 25;
var TABLET_MATERIAL_ENTITY_NAME = 'Tablet-Material-Entity';
function InEditMode(hand) { function InEditMode(hand) {
this.hand = hand; this.hand = hand;
this.triggerClicked = false; this.triggerClicked = false;
@ -75,10 +75,12 @@ Script.include("/~/system/libraries/utils.js");
} }
} }
if (this.selectedTarget.type === Picks.INTERSECTED_ENTITY) { if (this.selectedTarget.type === Picks.INTERSECTED_ENTITY) {
if (!this.isTabletMaterialEntity(this.selectedTarget.objectID)) {
Messages.sendLocalMessage("entityToolUpdates", JSON.stringify({ Messages.sendLocalMessage("entityToolUpdates", JSON.stringify({
method: "selectEntity", method: "selectEntity",
entityID: this.selectedTarget.objectID entityID: this.selectedTarget.objectID
})); }));
}
} else if (this.selectedTarget.type === Picks.INTERSECTED_OVERLAY) { } else if (this.selectedTarget.type === Picks.INTERSECTED_OVERLAY) {
Messages.sendLocalMessage("entityToolUpdates", JSON.stringify({ Messages.sendLocalMessage("entityToolUpdates", JSON.stringify({
method: "selectOverlay", method: "selectOverlay",
@ -92,6 +94,12 @@ Script.include("/~/system/libraries/utils.js");
this.sendPointingAtData(controllerData); this.sendPointingAtData(controllerData);
}; };
this.isTabletMaterialEntity = function(entityID) {
return ((entityID === HMD.homeButtonHighlightMaterialID) ||
(entityID === HMD.homeButtonUnhighlightMaterialID));
};
this.sendPointingAtData = function(controllerData) { this.sendPointingAtData = function(controllerData) {
var rayPick = controllerData.rayPicks[this.hand]; var rayPick = controllerData.rayPicks[this.hand];
var hudRayPick = controllerData.hudRayPicks[this.hand]; var hudRayPick = controllerData.hudRayPicks[this.hand];

View File

@ -30,6 +30,8 @@ var INCHES_TO_METERS = 1 / 39.3701;
var NO_HANDS = -1; var NO_HANDS = -1;
var DELAY_FOR_30HZ = 33; // milliseconds var DELAY_FOR_30HZ = 33; // milliseconds
var TABLET_MATERIAL_ENTITY_NAME = 'Tablet-Material-Entity';
// will need to be recaclulated if dimensions of fbx model change. // will need to be recaclulated if dimensions of fbx model change.
var TABLET_NATURAL_DIMENSIONS = {x: 32.083, y: 48.553, z: 2.269}; var TABLET_NATURAL_DIMENSIONS = {x: 32.083, y: 48.553, z: 2.269};
@ -79,6 +81,19 @@ function calcSpawnInfo(hand, landscape) {
}; };
} }
cleanUpOldMaterialEntities = function() {
var avatarEntityData = MyAvatar.getAvatarEntityData();
for (var entityID in avatarEntityData) {
var entityName = Entities.getEntityProperties(entityID, ["name"]).name;
if (entityName === TABLET_MATERIAL_ENTITY_NAME && entityID !== HMD.homeButtonHighlightMaterialID &&
entityID !== HMD.homeButtonUnhighlightMaterialID) {
Entities.deleteEntity(entityID);
}
}
};
/** /**
* WebTablet * WebTablet
* @param url [string] url of content to show on the tablet. * @param url [string] url of content to show on the tablet.
@ -134,6 +149,7 @@ WebTablet = function (url, width, dpi, hand, clientOnly, location, visible) {
} }
this.cleanUpOldTablets(); this.cleanUpOldTablets();
cleanUpOldMaterialEntities();
this.tabletEntityID = Overlays.addOverlay("model", tabletProperties); this.tabletEntityID = Overlays.addOverlay("model", tabletProperties);
@ -180,6 +196,7 @@ WebTablet = function (url, width, dpi, hand, clientOnly, location, visible) {
this.homeButtonUnhighlightMaterial = Entities.addEntity({ this.homeButtonUnhighlightMaterial = Entities.addEntity({
type: "Material", type: "Material",
name: TABLET_MATERIAL_ENTITY_NAME,
materialURL: "materialData", materialURL: "materialData",
localPosition: { x: 0.0, y: 0.0, z: 0.0 }, localPosition: { x: 0.0, y: 0.0, z: 0.0 },
priority: HIGH_PRIORITY, priority: HIGH_PRIORITY,
@ -199,6 +216,7 @@ WebTablet = function (url, width, dpi, hand, clientOnly, location, visible) {
this.homeButtonHighlightMaterial = Entities.addEntity({ this.homeButtonHighlightMaterial = Entities.addEntity({
type: "Material", type: "Material",
name: TABLET_MATERIAL_ENTITY_NAME,
materialURL: "materialData", materialURL: "materialData",
localPosition: { x: 0.0, y: 0.0, z: 0.0 }, localPosition: { x: 0.0, y: 0.0, z: 0.0 },
priority: LOW_PRIORITY, priority: LOW_PRIORITY,

View File

@ -111,6 +111,11 @@ EntityListTool = function(shouldUseEditTabletApp) {
return value !== undefined ? value : ""; return value !== undefined ? value : "";
} }
function filterEntity(entityID) {
return ((entityID === HMD.homeButtonHighlightMaterialID) ||
(entityID === HMD.homeButtonUnhighlightMaterialID));
}
that.sendUpdate = function() { that.sendUpdate = function() {
var entities = []; var entities = [];
@ -121,6 +126,10 @@ EntityListTool = function(shouldUseEditTabletApp) {
ids = Entities.findEntities(MyAvatar.position, searchRadius); ids = Entities.findEntities(MyAvatar.position, searchRadius);
} }
ids = ids.filter(function(id) {
return !filterEntity(id);
});
var cameraPosition = Camera.position; var cameraPosition = Camera.position;
for (var i = 0; i < ids.length; i++) { for (var i = 0; i < ids.length; i++) {
var id = ids[i]; var id = ids[i];

View File

@ -381,6 +381,8 @@ SelectionDisplay = (function() {
var CTRL_KEY_CODE = 16777249; var CTRL_KEY_CODE = 16777249;
var RAIL_AXIS_LENGTH = 10000;
var TRANSLATE_DIRECTION = { var TRANSLATE_DIRECTION = {
X: 0, X: 0,
Y: 1, Y: 1,
@ -616,6 +618,40 @@ SelectionDisplay = (function() {
dashed: false dashed: false
}); });
var xRailOverlay = Overlays.addOverlay("line3d", {
visible: false,
start: Vec3.ZERO,
end: Vec3.ZERO,
color: {
red: 255,
green: 0,
blue: 0
},
ignoreRayIntersection: true // always ignore this
});
var yRailOverlay = Overlays.addOverlay("line3d", {
visible: false,
start: Vec3.ZERO,
end: Vec3.ZERO,
color: {
red: 0,
green: 255,
blue: 0
},
ignoreRayIntersection: true // always ignore this
});
var zRailOverlay = Overlays.addOverlay("line3d", {
visible: false,
start: Vec3.ZERO,
end: Vec3.ZERO,
color: {
red: 0,
green: 0,
blue: 255
},
ignoreRayIntersection: true // always ignore this
});
var allOverlays = [ var allOverlays = [
handleTranslateXCone, handleTranslateXCone,
handleTranslateXCylinder, handleTranslateXCylinder,
@ -656,7 +692,11 @@ SelectionDisplay = (function() {
handleScaleFLEdge, handleScaleFLEdge,
handleCloner, handleCloner,
selectionBox, selectionBox,
iconSelectionBox iconSelectionBox,
xRailOverlay,
yRailOverlay,
zRailOverlay
]; ];
var maximumHandleInAllOverlays = handleCloner; var maximumHandleInAllOverlays = handleCloner;
@ -873,11 +913,13 @@ SelectionDisplay = (function() {
}; };
// FUNCTION: MOUSE MOVE EVENT // FUNCTION: MOUSE MOVE EVENT
var lastMouseEvent = null;
that.mouseMoveEvent = function(event) { that.mouseMoveEvent = function(event) {
var wantDebug = false; var wantDebug = false;
if (wantDebug) { if (wantDebug) {
print("=============== eST::MouseMoveEvent BEG ======================="); print("=============== eST::MouseMoveEvent BEG =======================");
} }
lastMouseEvent = event;
if (activeTool) { if (activeTool) {
if (wantDebug) { if (wantDebug) {
print(" Trigger ActiveTool(" + activeTool.mode + ")'s onMove"); print(" Trigger ActiveTool(" + activeTool.mode + ")'s onMove");
@ -999,19 +1041,35 @@ SelectionDisplay = (function() {
}; };
// Control key remains active only while key is held down // Control key remains active only while key is held down
that.keyReleaseEvent = function(key) { that.keyReleaseEvent = function(event) {
if (key.key === CTRL_KEY_CODE) { if (event.key === CTRL_KEY_CODE) {
ctrlPressed = false; ctrlPressed = false;
that.updateActiveRotateRing(); that.updateActiveRotateRing();
} }
if (activeTool && lastMouseEvent !== null) {
lastMouseEvent.isShifted = event.isShifted;
lastMouseEvent.isMeta = event.isMeta;
lastMouseEvent.isControl = event.isControl;
lastMouseEvent.isAlt = event.isAlt;
activeTool.onMove(lastMouseEvent);
SelectionManager._update();
}
}; };
// Triggers notification on specific key driven events // Triggers notification on specific key driven events
that.keyPressEvent = function(key) { that.keyPressEvent = function(event) {
if (key.key === CTRL_KEY_CODE) { if (event.key === CTRL_KEY_CODE) {
ctrlPressed = true; ctrlPressed = true;
that.updateActiveRotateRing(); that.updateActiveRotateRing();
} }
if (activeTool && lastMouseEvent !== null) {
lastMouseEvent.isShifted = event.isShifted;
lastMouseEvent.isMeta = event.isMeta;
lastMouseEvent.isControl = event.isControl;
lastMouseEvent.isAlt = event.isAlt;
activeTool.onMove(lastMouseEvent);
SelectionManager._update();
}
}; };
// NOTE: mousePressEvent and mouseMoveEvent from the main script should call us., so we don't hook these: // NOTE: mousePressEvent and mouseMoveEvent from the main script should call us., so we don't hook these:
@ -1705,6 +1763,14 @@ SelectionDisplay = (function() {
}, },
onEnd: function(event, reason) { onEnd: function(event, reason) {
pushCommandForSelections(duplicatedEntityIDs); pushCommandForSelections(duplicatedEntityIDs);
if (isConstrained) {
Overlays.editOverlay(xRailOverlay, {
visible: false
});
Overlays.editOverlay(zRailOverlay, {
visible: false
});
}
}, },
elevation: function(origin, intersection) { elevation: function(origin, intersection) {
return (origin.y - intersection.y) / Vec3.distance(origin, intersection); return (origin.y - intersection.y) / Vec3.distance(origin, intersection);
@ -1768,10 +1834,46 @@ SelectionDisplay = (function() {
vector.x = 0; vector.x = 0;
} }
if (!isConstrained) { if (!isConstrained) {
var xStart = Vec3.sum(startPosition, {
x: -RAIL_AXIS_LENGTH,
y: 0,
z: 0
});
var xEnd = Vec3.sum(startPosition, {
x: RAIL_AXIS_LENGTH,
y: 0,
z: 0
});
var zStart = Vec3.sum(startPosition, {
x: 0,
y: 0,
z: -RAIL_AXIS_LENGTH
});
var zEnd = Vec3.sum(startPosition, {
x: 0,
y: 0,
z: RAIL_AXIS_LENGTH
});
Overlays.editOverlay(xRailOverlay, {
start: xStart,
end: xEnd,
visible: true
});
Overlays.editOverlay(zRailOverlay, {
start: zStart,
end: zEnd,
visible: true
});
isConstrained = true; isConstrained = true;
} }
} else { } else {
if (isConstrained) { if (isConstrained) {
Overlays.editOverlay(xRailOverlay, {
visible: false
});
Overlays.editOverlay(zRailOverlay, {
visible: false
});
isConstrained = false; isConstrained = false;
} }
} }

View File

@ -13,7 +13,7 @@
// //
/* global Script, HMD, WebTablet, UIWebTablet, UserActivityLogger, Settings, Entities, Messages, Tablet, Overlays, /* global Script, HMD, WebTablet, UIWebTablet, UserActivityLogger, Settings, Entities, Messages, Tablet, Overlays,
MyAvatar, Menu, AvatarInputs, Vec3 */ MyAvatar, Menu, AvatarInputs, Vec3, cleanUpOldMaterialEntities */
(function() { // BEGIN LOCAL_SCOPE (function() { // BEGIN LOCAL_SCOPE
var tabletRezzed = false; var tabletRezzed = false;
@ -31,6 +31,14 @@
Script.include("../libraries/WebTablet.js"); Script.include("../libraries/WebTablet.js");
function cleanupMaterialEntities() {
if (Window.isPhysicsEnabled()) {
cleanUpOldMaterialEntities();
return;
}
Script.setTimeout(cleanupMaterialEntities, 100);
}
function checkTablet() { function checkTablet() {
if (gTablet === null) { if (gTablet === null) {
gTablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); gTablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
@ -327,4 +335,5 @@
HMD.homeButtonHighlightMaterialID = null; HMD.homeButtonHighlightMaterialID = null;
HMD.homeButtonUnhighlightMaterialID = null; HMD.homeButtonUnhighlightMaterialID = null;
}); });
Script.setTimeout(cleanupMaterialEntities, 100);
}()); // END LOCAL_SCOPE }()); // END LOCAL_SCOPE