stl-viewer
Advanced tools
Comparing version 0.10.0 to 0.10.1
@@ -34,2 +34,3 @@ 'use strict'; | ||
}); | ||
this.reqNumber = 0; | ||
} | ||
@@ -58,6 +59,5 @@ | ||
if (this.mesh !== undefined) { | ||
this.scene.remove(this.mesh); | ||
this.mesh.geometry.dispose(); | ||
this.mesh.material.dispose(); | ||
this.scene.remove(this.mesh); | ||
delete this.mesh; | ||
} | ||
@@ -83,7 +83,8 @@ var directionalLightObj = this.scene.getObjectByName(DIRECTIONAL_LIGHT); | ||
this.addSTLToScene(); | ||
this.reqNumber += 1; | ||
this.addSTLToScene(this.reqNumber); | ||
} | ||
}, { | ||
key: 'addSTLToScene', | ||
value: function addSTLToScene() { | ||
value: function addSTLToScene(reqId) { | ||
var _this = this; | ||
@@ -93,2 +94,5 @@ | ||
this.loader.load(this.url, function (geometry) { | ||
if (_this.reqNumber !== reqId) { | ||
return; | ||
} | ||
// Calculate mesh noramls for MeshLambertMaterial. | ||
@@ -95,0 +99,0 @@ geometry.computeFaceNormals(); |
{ | ||
"name": "stl-viewer", | ||
"version": "0.10.0", | ||
"version": "0.10.1", | ||
"description": "A component for viewing an STL object from a given URL by utilizing Three.js", | ||
@@ -5,0 +5,0 @@ "main": "dist/STLViewer.js", |
@@ -14,2 +14,3 @@ import THREE from './Three'; | ||
}); | ||
this.reqNumber = 0; | ||
} | ||
@@ -36,6 +37,5 @@ | ||
if (this.mesh !== undefined) { | ||
this.scene.remove(this.mesh); | ||
this.mesh.geometry.dispose(); | ||
this.mesh.material.dispose(); | ||
this.scene.remove(this.mesh); | ||
delete this.mesh; | ||
} | ||
@@ -61,8 +61,12 @@ const directionalLightObj = this.scene.getObjectByName(DIRECTIONAL_LIGHT); | ||
this.addSTLToScene(); | ||
this.reqNumber += 1; | ||
this.addSTLToScene(this.reqNumber); | ||
} | ||
addSTLToScene() { | ||
addSTLToScene(reqId) { | ||
this.loader.crossOrigin = ''; | ||
this.loader.load(this.url, geometry => { | ||
if (this.reqNumber !== reqId) { | ||
return; | ||
} | ||
// Calculate mesh noramls for MeshLambertMaterial. | ||
@@ -69,0 +73,0 @@ geometry.computeFaceNormals(); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
5730220
3595