Rename js to src
This commit is contained in:
92
src/state.js
Normal file
92
src/state.js
Normal file
@@ -0,0 +1,92 @@
|
||||
/**
|
||||
* @namespace AppState
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} NormalizedSceneNode
|
||||
* @property {String} label Required
|
||||
* @property {String} id
|
||||
* @property {String} model
|
||||
* @property {Boolean} isMain
|
||||
* @property {Number|null} opacity
|
||||
* @property {Boolean} active
|
||||
*/
|
||||
|
||||
let AppState = {
|
||||
// The Leaflet map object
|
||||
map : null,
|
||||
// The root scene object
|
||||
root: null,
|
||||
// {id: String, active: Boolean}
|
||||
nodes: [],
|
||||
/**
|
||||
* @type {NormalizedSceneNode[]} normalizedNodes
|
||||
*/
|
||||
normalizedNodes: [],
|
||||
treeNodes: {},
|
||||
semanticNodes: new Map,
|
||||
mainNodeId: null,
|
||||
currentScene: null,
|
||||
sceneHasAudio: false,
|
||||
layersMenuBuilt: false,
|
||||
initialRotation: null,
|
||||
lightDirection: [],
|
||||
/**
|
||||
* @type {Number}
|
||||
*/
|
||||
exposure: null,
|
||||
camera: null,
|
||||
renderer: null,
|
||||
ambientOcclusion : true,
|
||||
shadows : true,
|
||||
lightProbe : false,
|
||||
clipping : {
|
||||
enabled: false,
|
||||
plane : null,
|
||||
controls: null,
|
||||
onDrag: null,
|
||||
helper : null,
|
||||
arrow : null,
|
||||
boundingSphere: null,
|
||||
listeners: {
|
||||
button: false,
|
||||
plane: false,
|
||||
},
|
||||
vector: null,
|
||||
},
|
||||
/**
|
||||
* Reset the overall app state
|
||||
* to default values but keep map
|
||||
*
|
||||
* @param {L.Map} map - The Leaflet map object
|
||||
*/
|
||||
resetSceneState(map) {
|
||||
AppState = {
|
||||
root: null,
|
||||
mainNodeId: null,
|
||||
initialRotation: null,
|
||||
camera: null,
|
||||
renderer: null,
|
||||
ambientOcclusion : true,
|
||||
shadows : true,
|
||||
lightProbe : false,
|
||||
map,
|
||||
clipping : {
|
||||
enabled: false,
|
||||
plane : null,
|
||||
controls: null,
|
||||
onDrag: null,
|
||||
helper : null,
|
||||
arrow : null,
|
||||
boundingSphere: null,
|
||||
listeners: {
|
||||
button: false,
|
||||
plane: false,
|
||||
},
|
||||
vector: null,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default AppState;
|
||||
Reference in New Issue
Block a user