diff --git a/js/fea/DmaCell.js b/js/fea/DmaCell.js index 0671a2775be98aa5f1e2bc937a3950d402e2a513..5e61bf1ebed52a6c7cf36215fcc2a1c5260c4436 100644 --- a/js/fea/DmaCell.js +++ b/js/fea/DmaCell.js @@ -224,6 +224,14 @@ DMAFreeFormCell.prototype._calcPosition = function(){ return position; }; +DMAFreeFormCell.prototype.calcHighlighterPosition = function(face){ + var direction = face.normal.clone(); + direction.applyQuaternion(this.cellMesh.quaternion); + var position = this.getPosition(); + position.add(direction.clone().multiplyScalar(this.zScale()/2)); + return {index: _.clone(this.indices), direction:direction, position:position}; +}; + DMAFreeFormCell.prototype.toJSON = function(){ var json = DMACell.prototype.toJSON.call(this); _.extend(json, { diff --git a/js/fea/DmaCellOcta.js b/js/fea/DmaCellOcta.js index b11f60ac18979de9e340699c569c580daaef557d..39b784876e2dfc38b061b2a0bc51254744265f1b 100644 --- a/js/fea/DmaCellOcta.js +++ b/js/fea/DmaCellOcta.js @@ -34,9 +34,7 @@ DMAFaceOctaCell.prototype._doMeshTransformations = function(mesh){ }; DMAFaceOctaCell.prototype.calcHighlighterPosition = function(face){ - if (face.normal.z<0.99) return {index: _.clone(this.indices)};//only highlight horizontal faces - var direction = face.normal; var position = this.getPosition(); position.z += face.normal.z*this.zScale()/2; @@ -76,19 +74,6 @@ DMAFreeFormOctaCell.prototype._doMeshTransformations = function(mesh){ mesh.rotation.set(eulerRot.x, eulerRot.y, eulerRot.z); }; -DMAFreeFormOctaCell.prototype.calcHighlighterPosition = function(face){ - var direction = face.normal.clone(); - direction.applyQuaternion(this.cellMesh.quaternion); - - var position = this.getPosition(); - var zScale = this.zScale(); - position.x += direction.x*zScale/2; - position.y += direction.y*zScale/2; - position.z += direction.z*zScale/2; - - return {index: _.clone(this.indices), direction:direction, position:position}; -}; - DMAFreeFormOctaCell.prototype._initParts = function(){ var parts = []; for (var i=0;i<3;i++){ @@ -123,13 +108,8 @@ DMAEdgeOctaCell.prototype._doMeshTransformations = function(){}; DMAEdgeOctaCell.prototype.calcHighlighterPosition = function(face){ var direction = face.normal.clone(); direction.applyQuaternion(this.cellMesh.quaternion); - var position = this.getPosition(); - var zScale = this.zScale(); - position.x += direction.x*zScale/2; - position.y += direction.y*zScale/2; - position.z += direction.z*zScale/2; - + position.add(direction.clone().multiplyScalar(this.zScale()/2)); return {index: _.clone(this.indices), direction:direction, position:position}; }; @@ -204,8 +184,6 @@ DMARotatedEdgeCell.prototype.calcHighlighterPosition = function(face, point){ if (point.y > position.y) direction.y = 1; else direction.y = -1; } - - position.x += direction.x*this.xScale()/2; position.y += direction.y*this.yScale()/2; } diff --git a/js/fea/DmaCellTetra.js b/js/fea/DmaCellTetra.js index 79a92daeafc8d813782764698fce73687b90bda3..0ad033a9d450a42a9ec2290dce63dead84b0eaf8 100644 --- a/js/fea/DmaCellTetra.js +++ b/js/fea/DmaCellTetra.js @@ -79,20 +79,6 @@ DMAFreeFormTetraCell.prototype._doMeshTransformations = function(mesh){ mesh.rotation.set(eulerRot.x, eulerRot.y, eulerRot.z); }; -DMAFreeFormTetraCell.prototype.calcHighlighterPosition = function(face){ - - var direction = face.normal.clone(); - direction.applyQuaternion(this.cellMesh.quaternion); - - var position = this.getPosition(); - var zScale = this.zScale(); - position.x += direction.x*zScale/2; - position.y += direction.y*zScale/2; - position.z += direction.z*zScale/2; - - return {index: _.clone(this.indices), direction:direction, position:position}; -}; - DMAFreeFormTetraCell.prototype.getType = function(){ return "tetra"; }; diff --git a/js/models/AppState.js b/js/models/AppState.js index 347ed24768de2d4477f3df38c12f4f753b820f68..abb11d674120da4a87791de3b92ee68532e5177c 100644 --- a/js/models/AppState.js +++ b/js/models/AppState.js @@ -20,7 +20,7 @@ AppState = Backbone.Model.extend({ allCellTypes: {octa:"Octahedron", cube:"Cube", truncatedCube:"Truncated Cube", kelvin:"Kelvin (coming soon)"}, allConnectionTypes: { - octa: {face:"Face", freeformFace:"Freeform Face", edge:"Edge", edgeRot:"Rotated Edge", vertex:"Vertex"}, + octa: {face:"Face", freeformFace:"Freeform Face", edgeRot:"Edge", vertex:"Vertex"},//edge:"Edge", cube: {face:"Face"}, truncatedCube: {face:"Face"}, kelvin: {face: "Face"}