From 2b9eac38c7e3491dd5b2f5eb8d3e7d6a3e55f896 Mon Sep 17 00:00:00 2001 From: casperlamboo Date: Tue, 12 Dec 2017 22:15:03 +0100 Subject: [PATCH] don't regenerate hole mesh when not needed --- src/d3/ShapeMesh.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/d3/ShapeMesh.js b/src/d3/ShapeMesh.js index 14a1f99..ed9749e 100644 --- a/src/d3/ShapeMesh.js +++ b/src/d3/ShapeMesh.js @@ -61,10 +61,12 @@ class ShapeMesh extends THREE.Object3D { if (!this._solid) return false; if (holes === this._holes && !this._changedGeometry) return false; - this._holeMesh.geometry.dispose(); - if (holes === null || !this._fill || this._type === 'EXPORT_SHAPE') { + if (this._holeMeshIsOriginal) return false; + + this._holeMesh.geometry.dispose(); this._holeMesh.geometry = new THREE.Geometry().fromBufferGeometry(this._mesh.geometry); + this._holeMeshIsOriginal = true; return true; } @@ -77,6 +79,7 @@ class ShapeMesh extends THREE.Object3D { this._holes = holes; this._changedGeometry = false; + this._holeMeshIsOriginal = false; return true; }