mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 12:04:18 +02:00
Fixes for scaling tablet at high frame rates
This commit is contained in:
parent
9c6b8a6826
commit
1a01209020
3 changed files with 8 additions and 11 deletions
|
@ -3031,9 +3031,7 @@ function MyController(hand) {
|
|||
Overlays.editOverlay(this.grabbedThingID, reparentProps);
|
||||
// AJT: resize tablet to allow it to counter scale.
|
||||
if (this.grabbedThingID === HMD.tabletID) {
|
||||
var DEFAULT_TABLET_WIDTH = 0.4375;
|
||||
var tabletScalePercentage = getTabletScalePercentageFromSettings();
|
||||
resizeTablet(DEFAULT_TABLET_WIDTH * (tabletScalePercentage / 100));
|
||||
resizeTablet(getTabletWidthFromSettings(), reparentProps.parentJointIndex);
|
||||
}
|
||||
} else {
|
||||
if (grabbedProperties.userData.length > 0) {
|
||||
|
@ -3813,9 +3811,7 @@ function MyController(hand) {
|
|||
});
|
||||
// AJT: resizeTablet to counter adjust offsets to account for change of scale from sensorToWorldMatrix
|
||||
if (this.grabbedThingID === HMD.tabletID) {
|
||||
var DEFAULT_TABLET_WIDTH = 0.4375;
|
||||
var tabletScalePercentage = getTabletScalePercentageFromSettings();
|
||||
resizeTablet(DEFAULT_TABLET_WIDTH * (tabletScalePercentage / 100));
|
||||
resizeTablet(getTabletWidthFromSettings(), this.previousParentJointIndex[this.grabbedThingID]);
|
||||
}
|
||||
} else {
|
||||
// we're putting this back as a child of some other parent, so zero its velocity
|
||||
|
|
|
@ -178,7 +178,7 @@ WebTablet = function (url, width, dpi, hand, clientOnly, location, visible) {
|
|||
localPosition: {x: -0.001, y: -HOME_BUTTON_Y_OFFSET, z: 0.0},
|
||||
localRotation: {x: 0, y: 1, z: 0, w: 0},
|
||||
dimensions: { x: 4 * tabletScaleFactor, y: 4 * tabletScaleFactor, z: 4 * tabletScaleFactor},
|
||||
alpha: 1.0,
|
||||
alpha: 0.0,
|
||||
visible: visible,
|
||||
drawInFront: false,
|
||||
parentID: this.tabletEntityID,
|
||||
|
|
|
@ -352,7 +352,8 @@ flatten = function(array) {
|
|||
return [].concat.apply([], array);
|
||||
}
|
||||
|
||||
getTabletScalePercentageFromSettings = function () {
|
||||
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 = 100;
|
||||
|
@ -364,10 +365,10 @@ getTabletScalePercentageFromSettings = function () {
|
|||
tabletScalePercentage = Settings.getValue("desktopTabletScale") || DEFAULT_TABLET_SCALE;
|
||||
}
|
||||
}
|
||||
return tabletScalePercentage;
|
||||
return DEFAULT_TABLET_WIDTH * (tabletScalePercentage / 100);
|
||||
};
|
||||
|
||||
resizeTablet = function (width, newParentJointID) {
|
||||
resizeTablet = function (width, newParentJointIndex) {
|
||||
|
||||
if (!HMD.tabletID || !HMD.tabletScreenID || !HMD.homeButtonID) {
|
||||
return;
|
||||
|
@ -376,7 +377,7 @@ resizeTablet = function (width, newParentJointID) {
|
|||
var sensorScaleFactor = MyAvatar.sensorToWorldScale;
|
||||
var sensorScaleOffsetOverride = 1;
|
||||
var SENSOR_TO_ROOM_MATRIX = 65534;
|
||||
var parentJointIndex = Overlays.getProperty(HMD.tabletID, "parentJointIndex");
|
||||
var parentJointIndex = newParentJointIndex || Overlays.getProperty(HMD.tabletID, "parentJointIndex");
|
||||
if (parentJointIndex === SENSOR_TO_ROOM_MATRIX) {
|
||||
sensorScaleOffsetOverride = 1 / sensorScaleFactor;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue