12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- var Config = function () {
- var name = 'threejs-editor';
- var storage = {
- 'theme': 'css/light.css',
- 'camera/position': [ 500, 250, 500 ],
- 'camera/target': [ 0, 0, 0 ],
- 'ui/sidebar/animation/collapsed': true,
- 'ui/sidebar/geometry/collapsed': true,
- 'ui/sidebar/material/collapsed': true,
- 'ui/sidebar/object3d/collapsed': false,
- 'ui/sidebar/renderer/collapsed': true,
- 'ui/sidebar/scene/collapsed': false,
- 'ui/sidebar/script/collapsed': true
- };
- if ( window.localStorage[ name ] === undefined ) {
- window.localStorage[ name ] = JSON.stringify( storage );
- } else {
- var data = JSON.parse( window.localStorage[ name ] );
- for ( var key in data ) {
- storage[ key ] = data[ key ];
- }
- }
- return {
- getKey: function ( key ) {
- return storage[ key ];
- },
- setKey: function ( key, value ) {
- storage[ key ] = value;
- window.localStorage[ name ] = JSON.stringify( storage );
- console.log( '[' + /\d\d\:\d\d\:\d\d/.exec( new Date() )[ 0 ] + ']', 'Saved config to LocalStorage.' );
- },
- clear: function () {
- delete window.localStorage[ name ];
- }
- }
- };
|