Skip to content
This repository has been archived by the owner on May 1, 2019. It is now read-only.

Commit

Permalink
Merge pull request #79 from speckleworks/Dim/dev/sidebar
Browse files Browse the repository at this point in the history
Dim/dev/sidebar
  • Loading branch information
didimitrie authored Nov 19, 2018
2 parents 66d129e + 5ed3d59 commit 45ff8fe
Show file tree
Hide file tree
Showing 18 changed files with 983 additions and 1,115 deletions.
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 13 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,19 @@
},
"devDependencies": {
"@branu-jp/v-drag": "0.0.10",
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"babel-polyfill": "^6.26.0",
"babel-preset-env": "^1.6.0",
"babel-preset-stage-3": "^6.24.1",
"cross-env": "^5.0.5",
"css-loader": "^0.28.7",
"debounce": "^1.1.0",
"event-emitter-es6": "^1.1.5",
"file-loader": "^1.1.4",
"node-sass": "^4.5.3",
"query-parse": "^2.0.0",
"sass-loader": "^6.0.6",
"three": "^0.89.0",
"three-orbit-controls": "^82.1.0",
"three.meshline": "^1.0.3",
Expand All @@ -36,21 +46,12 @@
"vue-color": "^2.4.3",
"vue-dragging": "^1.0.8",
"vue-json-tree-view": "^2.1.3",
"vue-loader": "^13.0.5",
"vue-material": "^1.0.0-beta-10.2",
"vue-router": "^3.0.1",
"vuex": "^3.0.1",
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"babel-polyfill": "^6.26.0",
"babel-preset-env": "^1.6.0",
"babel-preset-stage-3": "^6.24.1",
"cross-env": "^5.0.5",
"css-loader": "^0.28.7",
"file-loader": "^1.1.4",
"node-sass": "^4.5.3",
"sass-loader": "^6.0.6",
"vue-loader": "^13.0.5",
"vue-slider-component": "^2.8.1",
"vue-template-compiler": "^2.4.4",
"vuex": "^3.0.1",
"webpack": "^3.6.0",
"webpack-dev-server": "^2.9.1"
},
Expand Down
2 changes: 1 addition & 1 deletion speckle-plugin-manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Speckle Viewer",
"version":"0.1.12",
"version":"0.2.0",
"desc": "This plugins allows you to view streams in your browser, amongst other things.",
"serveFrom": "/view",
"author": "Speckle Project Contributors",
Expand Down
143 changes: 66 additions & 77 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,13 @@
</md-dialog>
</div>
<md-app>
<md-app-toolbar class="md-primary md-dense" style='z-index: 10'>
<md-app-toolbar class="md-transparent xxx-md-dense md-elevation-0 no-shadow" style='z-index: 10'>
<div class="md-toolbar-row">
<div class="md-toolbar-section-start">
<md-button class='md-icon-button md-raised' @click.native='showAccounts=!showAccounts'>
<md-icon style='color: black'>
{{ showAccounts ? "close" : "menu"}}
<md-button class='md-icon-button' @click.native='showAccounts=!showAccounts'>
<md-icon xxx-style='color: black'>
{{ showAccounts ? "arrow_left" : "menu"}}
</md-icon>
<md-tooltip v-if="!isIOS" md-direction="bottom">Menu</md-tooltip>
</md-button>
<md-button class='md-icon-button' @click.native='showAddStreamDialog=true'>
<md-icon>add</md-icon>
Expand All @@ -36,7 +35,6 @@
<md-icon>list</md-icon>
<md-tooltip v-if="!isIOS" md-direction="top">Show details for selected objects</md-tooltip>
</md-button>
<p class="md-caption" style="color:white" v-show='selectedObjects!=null'>{{selectedObjects ? selectedObjects.hash : ''}}</p>
<!-- <md-button class='md-icon-button' @click.native='showViewSelect = !showViewSelect'> -->
<!-- <md-icon>videocam</md-icon> -->
<!-- <md-tooltip md-direction="top">Set camera view</md-tooltip> -->
Expand Down Expand Up @@ -65,8 +63,8 @@
</div>
</div>
</md-app-toolbar>
<md-app-drawer :md-active.sync="showAccounts" style='z-index:100' class='md-elevation-4' md-persistent="full">
<sidebar-menu v-on:add="addReceiver"></sidebar-menu>
<md-app-drawer :md-active.sync="showAccounts" style='padding:14px; box-sizing:border-box; background-color:#448aff;' class='md-scrollbar md-elevation-4 md-primary' md-persistent="full">
<sidebar-menu v-on:addreceiver="addReceiver"></sidebar-menu>
</md-app-drawer>
<md-app-content>
<speckle-renderer></speckle-renderer>
Expand Down Expand Up @@ -124,7 +122,7 @@ export default {
showAddStreamDialog: false,
addStreamString: null,
showStreamList: false,
showAccounts: false,
showAccounts: true,
showViewSelect: false,
showSettings: false,
showObjectDetails: false,
Expand All @@ -134,42 +132,40 @@ export default {
progressMessage: 'All is ready.'
}
},
computed: {
isMobileView( ) {
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|BB|PlayBook|IEMobile|Windows Phone|Kindle|Silk|Opera Mini/i.test( navigator.userAgent ) && window.innerWidth < 768
},
isIOS( ) {
return ( typeof window.orientation !== "undefined" ) && ( navigator.userAgent.indexOf( 'OS X' ) !== -1 )
},
receivers( ) {
return this.$store.getters.allReceivers
},
objects( ) {
return this.$store.getters.allObjects
},
selectedObjects( ) {
return this.$store.getters.selectedObjects
}
},
methods: {
zoomExt( ) {
if ( !this.selectedObjects )
bus.$emit( 'zext' )
bus.$emit( 'r-zoom-ext' )
else
bus.$emit( 'zoomToObject' )
bus.$emit( 'r-zoom-to-object' )
},
zoomToObject( ) {
bus.$emit( 'zoomToObject' )
},
createReceivers( ) {
if ( this.receiversCreated ) return
if ( this.$store.state.initStreams.length != 0 ) {
let receivers = this.$store.state.initStreams
.filter( id => id != "" )
.map( id => {
return {
serverUrl: this.$store.state.server,
streamId: id,
token: this.$store.getters.user.apitoken,
objects: [ ],
layers: [ ],
history: [ ],
name: 'Loading ' + id + '...',
layerMaterials: [ ]
}
} )
this.$store.commit( 'ADD_RECEIVERS', { receivers } )
}
bus.$emit( 'r-zoom-to-object' )
},
addReceiver( streamId ) {
if ( !streamId ) {
this.snackbarMessage = 'Invalid streamId'
if ( !streamId || streamId === '' ) {
this.snackbarMessage = 'Invalid streamId.'
return this.showSnackbar = true
}
console.log( 'Adding a receiver', streamId )
if ( this.$store.getters.receiverById( streamId ) ) {
this.snackbarMessage = 'That stream is already loaded'
return this.showSnackbar = true
Expand All @@ -180,20 +176,33 @@ export default {
token: this.$store.getters.user.apitoken,
objects: [ ],
layers: [ ],
history: [ ],
name: 'Loading ' + streamId + '...',
layerMaterials: [ ]
children: [ ],
parent: null,
createdAt: null,
updatedAt: null,
baseProperties: {
units: null
},
owner: {
name: null,
surname: null,
},
comments: null,
name: 'Loading ' + streamId + '...'
}
this.$store.commit( 'ADD_RECEIVER', { receiver } )
},
saveSettings( settings ) {
window.localStorage.setItem( 'viewerSettings', JSON.stringify( settings ) )
this.$store.commit( 'SET_VIEWER_SETTINGS', { settings } )
},
snackbarUpdate( message ) {
this.snackbarMessage = message
this.showSnackbar = true
},
toggleObjectDetails( ) {
if ( !this.selectedObjects ) {
return this.snackbarUpdate( "No objects selected" )
Expand All @@ -203,44 +212,22 @@ export default {
}
},
created( ) {
this.createReceivers( )
if ( window.localStorage.getItem( 'viewerSettings' ) !== null ) {
this.$store.commit( 'SET_VIEWER_SETTINGS', { settings: JSON.parse( window.localStorage.getItem( 'viewerSettings' ) ) } )
}
this.viewerSettings = this.$store.getters.viewerSettings
},
computed: {
searchobjects( ) {
let objects = this.$store.getters.allObjects
if ( objects.length === 0 ) return [ ]
let objectIds = objects.map( ( obj ) => {
return obj.type + ' ' + obj._id
} )
return objectIds
},
isMobileView( ) {
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|BB|PlayBook|IEMobile|Windows Phone|Kindle|Silk|Opera Mini/i.test( navigator.userAgent ) && window.innerWidth < 768
},
isIOS ( ) {
return (typeof window.orientation !== "undefined") && (navigator.userAgent.indexOf('OS X') !== -1)
},
receivers( ) {
return this.$store.getters.allReceivers
},
objects( ) {
return this.$store.getters.allObjects
},
selectedObjects( ) {
return this.$store.getters.selectedObjects
}
},
mounted( ) {
this.$store.state.initStreams.forEach( streamId => {
this.addReceiver( streamId )
} )
bus.$on( 'snackbar-update', this.snackbarUpdate )
bus.$on( 'stream-load-progress', message => {
this.progressMessage = message
} )
}
},
mounted( ) {}
}
</script>
Expand All @@ -250,14 +237,6 @@ export default {
border: 1px solid rgba(#000, .12);
}
.view-field {
width: auto;
}
.md-menu-content {
max-height: none;
}
#app {
position: fixed;
top: 0;
Expand All @@ -266,6 +245,16 @@ export default {
height: 100%;
}
#main {}
.no-shadow {
box-shadow: none !important;
}
.no-margin {
margin: 0 !important;
}
.md-card.md-with-hover {
cursor: default;
}
</style>
64 changes: 35 additions & 29 deletions src/components/Controller.vue
Original file line number Diff line number Diff line change
@@ -1,59 +1,65 @@
<template>

<div class='speckle-input'>
<div class='controller-wrapper'>
<div class='md-subheading'>{{trimmedName}}: {{controller.value}}</div>
<div class='md-layout md-alignment-center-left'>
<!-- <vue-slider ref='slider' :interval='0.01' :dot-size='24' :width='200' :min="min" :max="max" v-model='controller.value'></vue-slider> -->
<div class='md-layout-item md-size-5 md-caption'>{{min}}</div>
<div class='md-layout-item slider-wrapper md-caption'><input type="range" :min="min" :max="max" step='0.01' class='slider' v-model.number="controller.value"></div>
<div class='md-layout-item md-size-10 md-caption'>{{max}}</div>
</div>
<div class='md-subheading-xxx'>{{trimmedName}}: <strong>{{controller.value}}</strong></div>
<!-- <div class='md-layout md-alignment-center-left'>
<div class='md-layout-item md-size-5 md-caption'>{{min}}</div>
<div class='md-layout-item slider-wrapper md-caption'><input type="range" :min="min" :max="max" step='0.01' class='slider' v-model.number="controller.value"></div>
<div class='md-layout-item md-size-10 md-caption'>{{max}}</div>
</div> -->
<vue-slider ref='slider' :interval='controller.step' :dot-size='24' :min="controller.min" :max="controller.max" :value='controller.value' tooltip='hover' lazy v-on:callback='changed' :disabled='!enabled'></vue-slider>
</div>
</div>
</template>

<script>
//import vueSlider from 'vue-slider-component'
import VueSlider from 'vue-slider-component'
export default {
name: 'Controller',
props: ['controller'],
props: [ 'controller', 'enabled' ],
components: {
//vueSlider
VueSlider
},
computed: {
trimmedName: function(){
return this.controller.name.slice(7)
trimmedName: function( ) {
return this.controller.name.slice( 7 )
},
},
data() {
data( ) {
return {
min: this.controller.min,
max: this.controller.max
}
},
methods: {
changed( val ) {
this.controller.value = val
this.$emit( 'changed' )
}
},
mounted()
{
mounted( ) {
}
}
</script>
</script>
<style scoped>
.speckle-input{
width:100%
.speckle-input {
width: 100%
}
.slider-wrapper{
padding-left:5px;
padding-right:5px;
.slider-wrapper {
padding-left: 5px;
padding-right: 5px;
}
.slider{
width:100%
.slider {
width: 100%
}
.controller-wrapper{
padding-top:5px;
padding-bottom:5px;
.controller-wrapper {
padding-top: 5px;
padding-bottom: 5px;
}
</style>
Loading

0 comments on commit 45ff8fe

Please sign in to comment.