Skip to content

Commit

Permalink
Merge pull request #86 from Smithsonian/bug-fixes
Browse files Browse the repository at this point in the history
Bug fixes
  • Loading branch information
gjcope authored Aug 12, 2021
2 parents 19a1f6e + 1f2cd75 commit 214c1d8
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 8 deletions.
2 changes: 1 addition & 1 deletion libs/ff-scene
8 changes: 6 additions & 2 deletions source/client/components/CVAnnotationView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ export default class CVAnnotationView extends CObject3D
ins.lead.setValue(annotation ? annotation.lead : "", true);
ins.tags.setValue(annotation ? annotation.tags.join(", ") : "", true);
ins.style.setOption(annotation ? annotation.data.style : AnnotationFactory.defaultTypeName, true);
ins.scale.setValue(annotation ? annotation.data.scale : 1, true);
ins.offset.setValue(annotation ? annotation.data.offset : 0, true);
ins.scale.setValue(annotation ? annotation.data.scale * 100 * unitScaleFactor(this.model.ins.localUnits.getValidatedValue(), EUnitType.m) : 1, true);
ins.offset.setValue(annotation ? annotation.data.offset * 100 * unitScaleFactor(this.model.ins.localUnits.getValidatedValue(), EUnitType.m) : 0, true);
ins.tilt.setValue(annotation ? annotation.data.tilt : 0, true);
ins.azimuth.setValue(annotation ? annotation.data.azimuth : 0, true);
ins.color.setValue(annotation ? annotation.data.color.slice() : [ 1, 1, 1 ], true);
Expand All @@ -163,6 +163,10 @@ export default class CVAnnotationView extends CObject3D
}
}

get hasAnnotations() {
return Object.keys(this._annotations).length > 0;
}

constructor(node: Node, id: string)
{
super(node, id);
Expand Down
2 changes: 1 addition & 1 deletion source/client/io/ModelReader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import UberPBRMaterial from "../shaders/UberPBRMaterial";

////////////////////////////////////////////////////////////////////////////////

const DEFAULT_DRACO_PATH = "https://www.gstatic.com/draco/versioned/decoders/1.4.2/";
const DEFAULT_DRACO_PATH = "https://www.gstatic.com/draco/versioned/decoders/1.3.6/";

export default class ModelReader
{
Expand Down
5 changes: 4 additions & 1 deletion source/client/ui/explorer/ContentView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export default class ContentView extends DocumentView
{
protected sceneView: SceneView = null;
protected documentProps = new Subscriber("value", this.onUpdate, this);
protected isMobile: boolean = null;

protected get analytics() {
return this.system.getMainComponent(CVAnalytics);
Expand All @@ -65,6 +66,8 @@ export default class ContentView extends DocumentView
{
this.classList.add("sv-content-view");
this.sceneView = new SceneView(this.system);

this.isMobile = this.mobileCheck();
}

protected connected()
Expand Down Expand Up @@ -112,7 +115,7 @@ export default class ContentView extends DocumentView
readerPosition = reader.ins.position.value;

// do not use right reader position on mobile
if(this.mobileCheck() === true) {
if(this.isMobile === true) {
readerPosition = EReaderPosition.Overlay;
}

Expand Down
9 changes: 6 additions & 3 deletions source/client/ui/explorer/MainMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { EDerivativeQuality } from "../../schema/model";

import DocumentView, { customElement, html } from "./DocumentView";
import ShareMenu from "./ShareMenu";
import CVAnnotationView from "client/components/CVAnnotationView";

////////////////////////////////////////////////////////////////////////////////

Expand Down Expand Up @@ -85,16 +86,18 @@ export default class MainMenu extends DocumentView
const isEditing = !!this.system.getComponent("CVStoryApplication", true);

const setup = document.setup;
const scene = this.sceneNode;

const tourButtonVisible = setup.tours.outs.count.value > 0;
const toursActive = setup.tours.ins.enabled.value;

const modeButtonsDisabled = toursActive && !isEditing;

const readerButtonVisible = true; //setup.reader.articles.length > 0 && !isEditing;
const readerButtonVisible = setup.reader.articles.length > 0; // && !isEditing;
const readerActive = setup.reader.ins.enabled.value;

const annotationsButtonVisible = true;
const views = scene.getGraphComponents(CVAnnotationView);
const annotationsButtonVisible = views.some(view => {return view.hasAnnotations;}); //true;
const annotationsActive = setup.viewer.ins.annotationsVisible.value;

const fullscreen = this.fullscreen;
Expand All @@ -107,7 +110,7 @@ export default class MainMenu extends DocumentView
const language = setup.language;

// TODO - push to ARManager?
const models = this.sceneNode.getGraphComponents(CVModel2);
const models = scene.getGraphComponents(CVModel2);
const ARderivatives = models[0] ? models[0].derivatives.getByQuality(EDerivativeQuality.AR) : [];
const arButtonVisible = this.arManager.outs.available.value && ARderivatives.length > 0 && models.length >= 1;

Expand Down

0 comments on commit 214c1d8

Please sign in to comment.