mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-10 05:52:35 +02:00
code review
This commit is contained in:
parent
9ef4d01772
commit
715493922e
1 changed files with 36 additions and 35 deletions
|
@ -113,14 +113,6 @@ WebTablet = function (url, width, dpi, hand, clientOnly, location) {
|
||||||
this.dpi = DEFAULT_DPI * (DEFAULT_WIDTH / this.width);
|
this.dpi = DEFAULT_DPI * (DEFAULT_WIDTH / this.width);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.getDimensions = function() {
|
|
||||||
if (this.landscape) {
|
|
||||||
return { x: this.width * 2, y: this.height, z: this.depth };
|
|
||||||
} else {
|
|
||||||
return { x: this.width, y: this.height, z: this.depth };
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
var modelURL = LOCAL_TABLET_MODEL_PATH;
|
var modelURL = LOCAL_TABLET_MODEL_PATH;
|
||||||
var tabletProperties = {
|
var tabletProperties = {
|
||||||
name: "WebTablet Tablet",
|
name: "WebTablet Tablet",
|
||||||
|
@ -135,14 +127,6 @@ WebTablet = function (url, width, dpi, hand, clientOnly, location) {
|
||||||
parentID: AVATAR_SELF_ID
|
parentID: AVATAR_SELF_ID
|
||||||
};
|
};
|
||||||
|
|
||||||
this.getTabletTextureResolution = function() {
|
|
||||||
if (this.landscape) {
|
|
||||||
return { x: TABLET_TEXTURE_RESOLUTION.x * 2, y: TABLET_TEXTURE_RESOLUTION.y };
|
|
||||||
} else {
|
|
||||||
return TABLET_TEXTURE_RESOLUTION;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// compute position, rotation & parentJointIndex of the tablet
|
// compute position, rotation & parentJointIndex of the tablet
|
||||||
this.calculateTabletAttachmentProperties(hand, true, tabletProperties);
|
this.calculateTabletAttachmentProperties(hand, true, tabletProperties);
|
||||||
if (location) {
|
if (location) {
|
||||||
|
@ -209,31 +193,12 @@ WebTablet = function (url, width, dpi, hand, clientOnly, location) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.setLandscape = function(newLandscapeValue) {
|
|
||||||
if (this.landscape == newLandscapeValue) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.landscape = newLandscapeValue;
|
|
||||||
Overlays.editOverlay(this.tabletEntityID, { dimensions: this.getDimensions() });
|
|
||||||
Overlays.editOverlay(this.webOverlayID, {
|
|
||||||
resolution: this.getTabletTextureResolution()
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
this.state = "idle";
|
this.state = "idle";
|
||||||
|
|
||||||
this.getRoot = function() {
|
this.getRoot = function() {
|
||||||
return Entities.getWebViewRoot(_this.tabletEntityID);
|
return Entities.getWebViewRoot(_this.tabletEntityID);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.getLocation = function() {
|
|
||||||
var location = Overlays.getProperty(this.tabletEntityID, "localPosition");
|
|
||||||
var orientation = Overlays.getProperty(this.tabletEntityID, "localOrientation");
|
|
||||||
return {
|
|
||||||
localPosition: location,
|
|
||||||
localRotation: orientation
|
|
||||||
};
|
|
||||||
};
|
|
||||||
this.clicked = false;
|
this.clicked = false;
|
||||||
|
|
||||||
this.myOnHmdChanged = function () {
|
this.myOnHmdChanged = function () {
|
||||||
|
@ -272,6 +237,42 @@ WebTablet = function (url, width, dpi, hand, clientOnly, location) {
|
||||||
Camera.modeUpdated.connect(this.myCameraModeChanged);
|
Camera.modeUpdated.connect(this.myCameraModeChanged);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
WebTablet.prototype.getDimensions = function() {
|
||||||
|
if (this.landscape) {
|
||||||
|
return { x: this.width * 2, y: this.height, z: this.depth };
|
||||||
|
} else {
|
||||||
|
return { x: this.width, y: this.height, z: this.depth };
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
WebTablet.prototype.getTabletTextureResolution = function() {
|
||||||
|
if (this.landscape) {
|
||||||
|
return { x: TABLET_TEXTURE_RESOLUTION.x * 2, y: TABLET_TEXTURE_RESOLUTION.y };
|
||||||
|
} else {
|
||||||
|
return TABLET_TEXTURE_RESOLUTION;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
WebTablet.prototype.setLandscape = function(newLandscapeValue) {
|
||||||
|
if (this.landscape == newLandscapeValue) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.landscape = newLandscapeValue;
|
||||||
|
Overlays.editOverlay(this.tabletEntityID, { dimensions: this.getDimensions() });
|
||||||
|
Overlays.editOverlay(this.webOverlayID, {
|
||||||
|
resolution: this.getTabletTextureResolution()
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
WebTablet.prototype.getLocation = function() {
|
||||||
|
var location = Overlays.getProperty(this.tabletEntityID, "localPosition");
|
||||||
|
var orientation = Overlays.getProperty(this.tabletEntityID, "localOrientation");
|
||||||
|
return {
|
||||||
|
localPosition: location,
|
||||||
|
localRotation: orientation
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
WebTablet.prototype.setHomeButtonTexture = function() {
|
WebTablet.prototype.setHomeButtonTexture = function() {
|
||||||
Entities.editEntity(this.tabletEntityID, {textures: JSON.stringify({"tex.close": HOME_BUTTON_TEXTURE})});
|
Entities.editEntity(this.tabletEntityID, {textures: JSON.stringify({"tex.close": HOME_BUTTON_TEXTURE})});
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue