MCPcopy Create free account
hub / github.com/NikLever/ThreeJS-PathEditor / show

Method show

preview.js:37–71  ·  view source on GitHub ↗
( nodes, depth, holes )

Source from the content-addressed store, hash-verified

35 }
36
37 show( nodes, depth, holes ){
38 const shape = this.nodesToShape( nodes );
39
40 if (holes){
41 for( const [key, nodes] of Object.entries(holes)){
42 const path = this.nodesToPath( nodes );
43 shape.holes.push( path );
44 }
45 }
46
47 if ( this.mesh ){
48 this.mesh.geometry.dispose();
49 this.scene.remove( this.mesh );
50 }
51
52 const geometry = new ExtrudeGeometry( shape, {
53 depth,
54 bevelEnabled: false
55 });
56
57 this.mesh = new Mesh( geometry, this.material );
58 this.scene.add( this.mesh );
59
60 const height = window.innerHeight;
61 const top = (height - 512) / 2;
62 this.container.style.top = `${top}px`;
63
64 this.controls.target = this.getCenterPoint( this.mesh );
65 this.camera.position.set( this.controls.target.x, this.controls.target.y, this.getCameraOffset( this.mesh ) );
66 this.controls.update();
67
68 this.render();
69
70 this.on = true;
71 }
72
73 hide(){
74 this.container.style.top = "-600px";

Callers

nothing calls this directly

Calls 5

nodesToShapeMethod · 0.95
nodesToPathMethod · 0.95
getCenterPointMethod · 0.95
getCameraOffsetMethod · 0.95
renderMethod · 0.95

Tested by

no test coverage detected