Skip to content

Commit

Permalink
Zoom fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Fechner authored and Florian Fechner committed Feb 24, 2018
1 parent a8cfa72 commit fd86396
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions voxel-visualization.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ class VoxelVisualization extends Polymer.mixinBehaviors([Polymer.IronResizableBe
'_onSchematicJsonPathChanged(schematicJsonPath)',
'_onSchematicPathChanged(schematicPath)',
'_onAmbientLightIntensityChanged(ambientLightIntensity)',
'_onDirectionalLightIntensityChanged(directionalLightIntensity)'
'_onDirectionalLightIntensityChanged(directionalLightIntensity)',
'_onZoomChanged(zoom)'
]
}

Expand Down Expand Up @@ -131,6 +132,15 @@ class VoxelVisualization extends Polymer.mixinBehaviors([Polymer.IronResizableBe
if(this.directionalLight) this.directionalLight.color.set(directionalLightColor);
}

_onZoomChanged()
{
if(this.group)
{
let base = -2;
this.group.position.set(0, 0, base / this.zoom);
}
}

_onSchematicPathChanged(schematicPath)
{
let file = schematicPath;
Expand Down Expand Up @@ -246,8 +256,9 @@ class VoxelVisualization extends Polymer.mixinBehaviors([Polymer.IronResizableBe
let normals = new Float32Array(this.calculateNormals(faces, expandedWidth, expandedHeight, expandedDepth));
let uvs = new Float32Array(this.calculateUVs(faces, blockIdList));

let base = -2;
this.group = new THREE.Group();
this.group.position.set(0, 0, -3);
this.group.position.set(0, 0, base / this.zoom);

for(let i=0; i<keys.length; i++)
{
Expand Down

0 comments on commit fd86396

Please sign in to comment.