Skip to content

Commit

Permalink
fixes, style improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
framefactory committed Apr 5, 2019
1 parent b87a751 commit c7466a4
Show file tree
Hide file tree
Showing 15 changed files with 237 additions and 233 deletions.
2 changes: 1 addition & 1 deletion libs/ff-scene
2 changes: 1 addition & 1 deletion libs/ff-three
2 changes: 0 additions & 2 deletions source/client/applications/MiniApplication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import NVEngine from "../nodes/NVEngine";
import NVDocuments from "../nodes/NVDocuments";

import MainView from "../ui/mini/MainView";
import NVTools from "../nodes/NVTools";

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

Expand Down Expand Up @@ -85,7 +84,6 @@ export default class MiniApplication
const system = this.system = new System(registry);

const engine = system.graph.createCustomNode(NVEngine);
system.graph.createCustomNode(NVTools);
system.graph.createCustomNode(NVDocuments);

if (parent) {
Expand Down
12 changes: 7 additions & 5 deletions source/client/components/CVModel2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,15 @@ export default class CVModel2 extends CObject3D
private _derivatives = new DerivativeList();
private _activeDerivative: Derivative = null;

private _boundingBox = new THREE.Box3();
private _boundingBox:THREE.Box3;
private _boxFrame: THREE.Mesh = null;

constructor(node: Node, id: string)
{
super(node, id);

this.object3D = new THREE.Group();

this._boxFrame = new (THREE.Box3Helper as any)(this._boundingBox, "#ffffff");
this.addObject3D(this._boxFrame);
this._boundingBox = new THREE.Box3().makeEmpty();
}

get derivatives() {
Expand Down Expand Up @@ -224,6 +222,10 @@ export default class CVModel2 extends CObject3D
if (data.boundingBox) {
this._boundingBox.min.fromArray(data.boundingBox.min);
this._boundingBox.max.fromArray(data.boundingBox.max);

this._boxFrame = new (THREE.Box3Helper as any)(this._boundingBox, "#ffffff");
this.addObject3D(this._boxFrame);

this.emit("bounding-box");
}

Expand Down Expand Up @@ -270,7 +272,7 @@ export default class CVModel2 extends CObject3D
data.derivatives = this.derivatives.toJSON();

const annotations = this.getComponent(CVAnnotationView).toData();
if (annotations.length > 0) {
if (annotations && annotations.length > 0) {
data.annotations = annotations;
}

Expand Down
11 changes: 9 additions & 2 deletions source/client/components/CVSnapshots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export default class CVSnapshots extends CTweenMachine
});

this.targetFeatures["navigation"] = true;
this.targetFeatures["reader"] = true;
this.targetFeatures["models"] = false;
this.targetFeatures["lights"] = false;
}
Expand Down Expand Up @@ -102,11 +103,17 @@ export default class CVSnapshots extends CTweenMachine
{
this.clear();

const features = this.targetFeatures;
const keys = Object.keys(features);

if (data.features) {
const features = this.targetFeatures;
const keys = Object.keys(features);
keys.forEach(key => features[key] = data.features.indexOf(key) >= 0);
}
else {
keys.forEach(key => features[key] = false);
features["navigation"] = true;
features["reader"] = true;
}

const missingTargets = new Set<number>();

Expand Down
29 changes: 17 additions & 12 deletions source/client/ui/explorer/ContentView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,45 +65,50 @@ export default class ContentView extends DocumentView

let readerVisible = false;
let readerPosition = EReaderPosition.Overlay;
let tourMenuVisible = false;

const document = this.activeDocument;
const reader = document && document.setup.reader;
const tours = document && document.setup.tours;

if (tours) {
tourMenuVisible = tours.ins.enabled.value && tours.outs.tourIndex.value === -1;
}
if (reader) {
readerVisible = reader.ins.visible.value;
readerVisible = ! tourMenuVisible && reader.ins.visible.value;
readerPosition = reader.ins.position.value;
}

const sceneView = this.sceneView;
sceneView.classList.remove("sv-blur");

const blurContent =
(readerVisible && readerPosition === EReaderPosition.Overlay) ||
(tours && tours.ins.enabled.value && tours.outs.tourIndex.value === -1);
(readerVisible && readerPosition === EReaderPosition.Overlay) || tourMenuVisible;

if (blurContent) {
if (!blurContent) {
sceneView.classList.remove("sv-blur");
}
else {
setTimeout(() => sceneView.classList.add("sv-blur"), 1);
}

if (readerVisible) {
if (readerPosition === EReaderPosition.Right) {

return html`<div class="sv-content-reader-split">${sceneView}
return html`<div class="ff-fullsize sv-content-split">
${sceneView}
<ff-splitter direction="horizontal"></ff-splitter>
<sv-reader-view .system=${system} class="sv-reader-split"></sv-reader-view></div>
<sv-spinner ?visible=${isLoading}></sv-spinner>`;

}
if (readerPosition === EReaderPosition.Overlay) {

return html`<div class="sv-content-reader-overlay">${sceneView}
<sv-reader-view .system=${system}></sv-reader-view>
return html`<div class="ff-fullsize sv-content-stack">${sceneView}
<div class="sv-reader-container">
<sv-reader-view .system=${system}></sv-reader-view>
</div>
<sv-spinner ?visible=${isLoading}></sv-spinner></div>`;
}
}

return html`<div class="sv-content-reader-off">${sceneView}</div>
return html`<div class="ff-fullsize sv-content-only">${sceneView}</div>
<sv-spinner ?visible=${isLoading}></sv-spinner>`;
}

Expand Down
12 changes: 2 additions & 10 deletions source/client/ui/explorer/MainMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@ export default class MainMenu extends DocumentView

return html`<ff-button icon="document" title="Read more..."
?selected=${readerVisible} @click=${this.onToggleReader}></ff-button>
${readerVisible ? null : html`<ff-button icon="globe" title="Interactive Tours"
<ff-button icon="globe" title="Interactive Tours"
?selected=${toursVisible} @click=${this.onToggleTours}></ff-button>
<ff-button icon="comment" title="Toggle Annotations"
?selected=${annotationsVisible} @click=${this.onToggleAnnotations}></ff-button>
${showFullscreenButton ? html`<ff-button icon="expand" title="Toggle fullscreen mode"
?selected=${fullscreenActive} @click=${this.onToggleFullscreen}></ff-button>` : null}
${showToolButton ? html`<ff-button icon="tools" title="Tools and Settings"
?selected=${toolsVisible} @click=${this.onToggleTools}></ff-button>` : null}`}`;
?selected=${toolsVisible} @click=${this.onToggleTools}></ff-button>` : null}`;
}

protected onToggleReader()
Expand All @@ -98,10 +98,6 @@ export default class MainMenu extends DocumentView
{
const toursProp = this.activeDocument.setup.tours.ins.enabled;
toursProp.setValue(!toursProp.value);

if (toursProp.value) {
this.toolProvider.ins.visible.setValue(false);
}
}

protected onToggleAnnotations()
Expand All @@ -119,10 +115,6 @@ export default class MainMenu extends DocumentView
{
const toolsProp = this.toolProvider.ins.visible;
toolsProp.setValue(!toolsProp.value);

if (toolsProp.value) {
this.activeDocument.setup.tours.ins.enabled.setValue(false);
}
}

protected onActiveDocument(previous: CVDocument, next: CVDocument)
Expand Down
4 changes: 2 additions & 2 deletions source/client/ui/explorer/ReaderView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default class ReaderView extends DocumentView

protected render()
{
return html`<div class="sv-article">
return html`<div class="sv-left"></div><div class="sv-article">
<h1>Article Title</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et
dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex
Expand All @@ -50,6 +50,6 @@ export default class ReaderView extends DocumentView
egestas ac nec est. Sed et sodales justo. Duis scelerisque arcu quis nunc pretium, a accumsan lacus
bibendum. Nam malesuada sem elit, eu volutpat tortor lobortis varius. Donec eget lacus id ex lacinia
consectetur. Sed ornare tristique risus quis luctus. Nam euismod massa in accumsan volutpat.</p>
</div>`;
</div><div class="sv-right"></div>`;
}
}
11 changes: 6 additions & 5 deletions source/client/ui/explorer/ToolBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ export default class ToolBar extends SystemView

protected firstConnected()
{
this.classList.add("sv-tool-bar", "sv-transition");
super.firstConnected();
this.classList.add("sv-bottom-bar-container", "sv-tool-bar", "sv-transition");
setTimeout(() => this.classList.remove("sv-transition"), 1);
}

Expand All @@ -62,15 +63,15 @@ export default class ToolBar extends SystemView
?selected=${tool === activeTool} @click=${e => this.onSelectTool(tool)}></ff-button>`);

const toolView = activeTool ? html`<div class="sv-section">
<ff-button class="sv-section-button" transparent icon=${activeTool.icon}></ff-button>
<ff-button class="sv-section-lead" transparent icon=${activeTool.icon}></ff-button>
${activeTool.createView()}</div>` : null;

return html`${toolView}
return html`<div class="sv-blue-bar">${toolView}
<div class="sv-section">
<ff-button class="sv-section-button" transparent icon="close" @click=${this.onClose}></ff-button>
<ff-button class="sv-section-lead" transparent icon="close" @click=${this.onClose}></ff-button>
<div class="sv-tool-buttons">${toolButtons}</div>
<sv-tool-menu-view .system=${this.system}></sv-tool-menu-view>
</div>`;
</div></div>`;
}

protected onSelectTool(tool: CVTool)
Expand Down
4 changes: 2 additions & 2 deletions source/client/ui/explorer/TourMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ export default class TourMenu extends CustomElement
protected renderTour(tour: ITour, index: number)
{
return html`<div class="sv-tour-menu-entry" @click=${e => this.onClick(e, index)}>
<div class="sv-tour-menu-title">${tour.title}</div>
<div class="sv-tour-menu-lead">${tour.lead}</div>
<h1>${tour.title}</h1>
<p>${tour.lead}</p>
</div>`;
}

Expand Down
17 changes: 9 additions & 8 deletions source/client/ui/explorer/TourNavigator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ export default class TourNavigator extends DocumentView
protected firstConnected()
{
super.firstConnected();
this.classList.add("sv-bottom-bar-container", "sv-tour-navigator");
this.classList.add("sv-bottom-bar-container", "sv-tour-navigator", "sv-transition");
setTimeout(() => this.classList.remove("sv-transition"), 1);
}

protected render()
Expand All @@ -53,14 +54,14 @@ export default class TourNavigator extends DocumentView
info = "---";
}

return html`<div class="sv-bottom-bar"><div class="sv-section">
<ff-button class="sv-section-head" transparent icon="bars" ?disabled=${!activeTour} @click=${this.onClickMenu}></ff-button>
<div class="ff-ellipsis sv-tour-content">
<div class="ff-ellipsis sv-tour-title">${title}</div>
<div class="ff-ellipsis sv-tour-info">${info}</div>
return html`<div class="sv-blue-bar"><div class="sv-section">
<ff-button class="sv-section-lead" transparent icon="bars" ?disabled=${!activeTour} @click=${this.onClickMenu}></ff-button>
<div class="ff-ellipsis sv-content">
<div class="ff-ellipsis sv-title">${title}</div>
<div class="ff-ellipsis sv-text">${info}</div>
</div>
<ff-button class="sv-section-button" transparent icon="triangle-left" ?disabled=${!activeTour} @click=${this.onClickPrevious}></ff-button>
<ff-button class="sv-section-button" transparent icon="triangle-right" ?disabled=${!activeTour} @click=${this.onClickNext}></ff-button>
<ff-button class="sv-section-trail" transparent icon="triangle-left" ?disabled=${!activeTour} @click=${this.onClickPrevious}></ff-button>
<ff-button class="sv-section-trail" transparent icon="triangle-right" ?disabled=${!activeTour} @click=${this.onClickNext}></ff-button>
</div></div>`;
}

Expand Down
Loading

0 comments on commit c7466a4

Please sign in to comment.