()
| 8 | |
| 9 | class App{ |
| 10 | constructor(){ |
| 11 | const canvas = document.createElement('canvas'); |
| 12 | document.body.appendChild( canvas ); |
| 13 | this.canvas = canvas; |
| 14 | |
| 15 | this.store = new Store(); |
| 16 | |
| 17 | let activePath = this.store.read( 'activePath' ); |
| 18 | if (activePath==null) activePath = "Path1"; |
| 19 | |
| 20 | this.config = { yAxis: 0.5, xAxis: 0.5, xMax: 2, units: 'm', snap: true, |
| 21 | export: () => { |
| 22 | this.export(); |
| 23 | }, |
| 24 | delete: () => { |
| 25 | this.deletePath(); |
| 26 | }, |
| 27 | newPath: () => { |
| 28 | this.newPath(); |
| 29 | }, |
| 30 | copyPath: () => { |
| 31 | this.copyPath(); |
| 32 | }, |
| 33 | show: () => { |
| 34 | //console.log( 'Show' ); |
| 35 | if (this.config.holes){ |
| 36 | this.preview.show( this.nodes, this.config.depth, this.ghosts.paths ); |
| 37 | }else{ |
| 38 | this.preview.show( this.nodes, this.config.depth ); |
| 39 | } |
| 40 | this.previewOn = true; |
| 41 | }, |
| 42 | udo: () => { |
| 43 | if (this.store.udo()){ |
| 44 | this.loadPath( this.activePath ); |
| 45 | } |
| 46 | }, |
| 47 | readme: () => { |
| 48 | window.location = 'https://github.com/NikLever/ThreeJS-PathEditor'; |
| 49 | }, |
| 50 | name: activePath, |
| 51 | tool: 'select', depth: 0.2, |
| 52 | snap: false, |
| 53 | holes: false |
| 54 | }; |
| 55 | |
| 56 | this.graph = new Graph( canvas, this.config ); |
| 57 | |
| 58 | const pathNames = this.store.getPathNames(); |
| 59 | |
| 60 | const gui = new GUI(); |
| 61 | const config = gui.addFolder( 'Settings' ); |
| 62 | config.add( this.config, 'xAxis', 0, 1).onChange( value => this.render() ); |
| 63 | config.add( this.config, 'yAxis', 0, 1).onChange( value => this.render() ); |
| 64 | config.add( this.config, 'xMax', 0.5, 10, 1).onChange( value => this.render() ); |
| 65 | //gui.add( this.config, 'scale', 0, 100).name('scale (%)'); |
| 66 | config.add( this.config, 'units', [ 'm', 'cm', 'mm' ] ); |
| 67 | config.add( this.config, 'depth', 0.02, 2 ).name('extrude depth'); |
nothing calls this directly
no test coverage detected