Skip to content

Commit

Permalink
cleanup what needs to be same as main
Browse files Browse the repository at this point in the history
Signed-off-by: Hannah Bollar <[email protected]>
  • Loading branch information
hanbollar committed Feb 21, 2024
1 parent 2f9d9b7 commit 049b60d
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 160 deletions.
12 changes: 6 additions & 6 deletions dist/mr.js

Large diffs are not rendered by default.

9 changes: 3 additions & 6 deletions src/core/MRDivEntity.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@ export class MRDivEntity extends MREntity {
if (mrjsUtils.xr.isPresenting) {
return (rect.height / mrjsUtils.display.VIRTUAL_DISPLAY_RESOLUTION) * mrjsUtils.app.scale;
}
let val = (rect.height / global.appHeight) * global.viewPortHeight;
// console.log('mrdiventity height: ', val);
return val;
return (rect.height / global.appHeight) * global.viewPortHeight;
}

/**
Expand All @@ -72,9 +70,7 @@ export class MRDivEntity extends MREntity {
if (mrjsUtils.xr.isPresenting) {
return (rect.width / mrjsUtils.display.VIRTUAL_DISPLAY_RESOLUTION) * mrjsUtils.app.scale;
}
let val = (rect.width / global.appWidth) * global.viewPortWidth;
// console.log('mrdiventity width: ', val);
return val;
return (rect.width / global.appWidth) * global.viewPortWidth;
}

/**
Expand Down Expand Up @@ -126,6 +122,7 @@ export class MRDivEntity extends MREntity {
connected() {
this.background.geometry = mrjsUtils.geometry.UIPlane(this.width, this.height, [0], 18);
}

}

customElements.get('mr-div') || customElements.define('mr-div', MRDivEntity);
19 changes: 2 additions & 17 deletions src/core/MREntity.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,7 @@ export class MREntity extends MRElement {
* @returns {number} - the resolved width
*/
get width() {
let val = (this.compStyle.width.split('px')[0] / global.appWidth) * global.viewPortWidth;
// if (this instanceof MRPanel) {
console.log('entity width:', val);
// }
return val;
return (this.compStyle.width.split('px')[0] / global.appWidth) * global.viewPortWidth;
}

/**
Expand All @@ -91,9 +87,6 @@ export class MREntity extends MRElement {
*/
get contentWidth() {
this.aabb.setFromObject(this.object3D).getSize(this.size);
// if (this instanceof MRPanel) {
console.log('entity contentWidth:', this.size.x);
// }
return this.size.x;
}

Expand All @@ -103,14 +96,7 @@ export class MREntity extends MRElement {
* @returns {number} - the resolved height
*/
get height() {
// let val = (this.compStyle.height.split('px')[0] / global.appHeight) * global.viewPortHeight;

// old impl
const styleHeight = this.compStyle.height.split('px')[0] > 0 ? this.compStyle.height.split('px')[0] : global.appHeight;
let val = (styleHeight / global.appHeight) * global.viewPortHeight;

console.log('entity height:', val);
return val;
return (this.compStyle.height.split('px')[0] / global.appHeight) * global.viewPortHeight;
}

/**
Expand All @@ -120,7 +106,6 @@ export class MREntity extends MRElement {
*/
get contentHeight() {
this.aabb.setFromObject(this.object3D).getSize(this.size);
console.log('entity contentHeight:', this.size.y);
return this.size.y;
}

Expand Down
2 changes: 0 additions & 2 deletions src/core/componentSystems/ClippingSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,6 @@ export class ClippingSystem extends MRSystem {
* @param {MREntity} entity - given entity that will be clipped by the planes.
*/
onNewEntity(entity) {
return;

if (!entity.ignoreStencil) {
// only apply clipping planes to entities that arent masked through the stencil
// since doubling up on that is redundant and not helpful for runtime
Expand Down
16 changes: 8 additions & 8 deletions src/core/componentSystems/GeometryStyleSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,14 @@ export class GeometryStyleSystem extends MRSystem {
console.log('image width', w, 'contentwidth:', entity.contentWidth, 'textureWidth:', entity.textureWidth);
let h = entity.height;
let b = entity.borderRadii;
// if (entity._storedWidth != w || entity._storedHeight != h || entity._storedBorderRadii != b) {
// entity._storedWidth = w;
// entity._storedHeight = h;
// entity._storedBorderRadii = b;
// } else {
// // no update needed
// return false;
// }
if (entity._storedWidth != w || entity._storedHeight != h || entity._storedBorderRadii != b) {
entity._storedWidth = w;
entity._storedHeight = h;
entity._storedBorderRadii = b;
} else {
// no update needed
return false;
}

if (entity.object3D.geometry !== undefined) {
entity.object3D.geometry.dispose();
Expand Down
1 change: 0 additions & 1 deletion src/core/componentSystems/MaskingSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ export class MaskingSystem extends MRSystem {
* @param {MREntity} entity - the entity being added.
*/
onNewEntity(entity) {
return;
if (entity instanceof MRPanel) {
// Using an array for the panels in case we need them for more manipulations down the line instead
// of using the system's registry.
Expand Down
109 changes: 0 additions & 109 deletions src/core/componentSystems/temp

This file was deleted.

10 changes: 2 additions & 8 deletions src/core/entities/MRPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,16 +126,10 @@ export class MRPanel extends MRDivEntity {

let app = this.closest('mr-app');

if (app.compStyle.overflow == 'scroll' || app.compStyle.overflow == 'auto') {
let before = app.scrollTop;
if (app.compStyle.overflow == 'scroll') {
app.scrollTop += mrjsUtils.css.threeToPx(this.delta);
console.log('scroll/auto: scrolling before', before, ' after', app.scrollTop);
} else {
let before = app.scrollTop;

app.scrollTop += mrjsUtils.css.threeToPx(this.delta);
// window.scrollBy(0, mrjsUtils.css.threeToPx(this.delta));
console.log('NOT scroll/auto: scrolling before', before, ' after', app.scrollTop);
this.scrollBy(0, mrjsUtils.css.threeToPx(this.delta));
}
};

Expand Down
3 changes: 0 additions & 3 deletions src/defaultStyle.css
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@ mr-panel {
background-color: #fff;
border-radius: 2%;
position: fixed;
/* overflow: scroll;*/
overflow: auto;
/* padding-right: 15px; /* Adjust based on expected scrollbar width */
/*padding: 0;*/
height: 100vh;
width: 100vw;
}
Expand Down

0 comments on commit 049b60d

Please sign in to comment.