Commit 7662f6db authored by amandaghassaei's avatar amandaghassaei

eod

parent 70b52e9e
......@@ -85,7 +85,7 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre
return new this.cellSubclass(json);
},
addCellsInRange: function(range, clone){//add a block of cells (extrude)
addCellsInRange: function(range, clone, params){//add a block of cells (extrude)
var cellOutsideCurrentBounds = this._checkForIndexOutsideBounds(range.min) || this._checkForIndexOutsideBounds(range.max);
if (cellOutsideCurrentBounds) this._expandCellsMatrix(range.max, range.min);
......@@ -99,6 +99,11 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre
var quaternion = null;
if (clone){
var relIndex = index.clone().sub(range.min);
if (params.mirrorX) relIndex.x = range.max.x-range.min.x-relIndex.x;
if (params.mirrorY) relIndex.y = range.max.y-range.min.y-relIndex.y;
if (params.mirrorZ) relIndex.z = range.max.z-range.min.z-relIndex.z;
var cloneSize = clone.get("size");
_.each(relIndex, function(val, key){
relIndex[key] = val%cloneSize[key];
......@@ -107,6 +112,16 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre
if (!cell) continue;
materialID = cell.getMaterialID();
quaternion = cell.getOrientation();
if (materialID == "conductiveJunction2" || materialID == "flexureCondJunction2"){//todo make this better
if (params.mirrorX) quaternion = new THREE.Quaternion(0, 0, 0.7071067811865476, 0.7071067811865476).multiply(quaternion.clone());
if (params.mirrorY) quaternion = new THREE.Quaternion(0, 0, -0.7071067811865476, 0.7071067811865476).multiply(quaternion.clone());
if (params.mirrorZ) quaternion = new THREE.Quaternion(1, 0, 0, 0).multiply(quaternion.clone());
} else {
if (params.mirrorX) quaternion = new THREE.Quaternion(0, 0, 1, 0).multiply(new THREE.Quaternion(1, 0, 0, 0)).multiply(quaternion.clone());
if (params.mirrorY) quaternion = new THREE.Quaternion(0, 0, 1, 0).multiply(new THREE.Quaternion(0, 1, 0, 0)).multiply(quaternion.clone());
if (params.mirrorZ) quaternion = new THREE.Quaternion(0, 1, 0, 0).multiply(new THREE.Quaternion(0, 0, 1, 0)).multiply(quaternion.clone());
}
}
this._addCellAtIndex(index, {materialID: materialID, quaternion: quaternion}, true);
}
......
......@@ -38,7 +38,8 @@ define(['jquery', 'underscore', 'menuParent', 'plist', 'text!menus/templates/Sel
_finishSelection: function(e){
e.preventDefault();
globals.get("selection3D").finish();
var params = {mirrorX:$("#mirrorX").is(':checked'), mirrorY:$("#mirrorY").is(':checked'), mirrorZ:$("#mirrorZ").is(':checked')};
globals.get("selection3D").finish(params);
},
_exitSelection: function(e){
......
......@@ -13,6 +13,18 @@
<input data-property="max" data-key="y" data-incr="<%= selection3D.sizeIncrement.y %>" data-min="<%= selection3D.min.y + selection3D.sizeIncrement.y - 1 %>" value="<%= selection3D.max.y %>" placeholder="Y" class="form-control selection3D intInput" type="text">&nbsp;
<input data-property="max" data-key="z" data-incr="<%= selection3D.sizeIncrement.z %>" data-min="<%= selection3D.min.z + selection3D.sizeIncrement.z - 1 %>" value="<%= selection3D.max.z %>" placeholder="Z" class="form-control selection3D intInput" type="text"><br/><br/>
<a href="#" class="fillCutSelection btn btn-block btn-lg btn-success">Fill with Clone Region &nbsp;(ENTER)</a>
<label class="checkbox" for="mirrorX">
<input id="mirrorX" type="checkbox" value="" data-toggle="checkbox" class="custom-checkbox">
<span class="icons"><span class="icon-unchecked"></span><span class="icon-checked"></span></span>
Mirror X</label>
<label class="checkbox" for="mirrorY">
<input id="mirrorY" type="checkbox" value="" data-toggle="checkbox" class="custom-checkbox">
<span class="icons"><span class="icon-unchecked"></span><span class="icon-checked"></span></span>
Mirror Y</label>
<label class="checkbox" for="mirrorZ">
<input id="mirrorZ" type="checkbox" value="" data-toggle="checkbox" class="custom-checkbox">
<span class="icons"><span class="icon-unchecked"></span><span class="icon-checked"></span></span>
Mirror Z</label><br/>
<a href="#" id="exitSelection" class="btn btn-block btn-lg btn-default">Undo Selection &nbsp;(ESC)</a><br/>
<% } else { %>
Shift + Drag to select area to paste to<br/>
......
......@@ -212,7 +212,7 @@ define([], function(){
}
},
flexureCondJunction2:{
name: "Electronic Routing (Split Type 1)",
name: "Electronic Routing (Split Type 2)",
color: "#b4ac9c",
altColor: "#b4ac9c",
texture: "stripes",
......@@ -315,7 +315,7 @@ define([], function(){
brass: {
name: "Brass",
color: "#b5a642",
altColor: "#857B64",
altColor: "#ababcc",
properties: {
conductive: true,
density: 8500,//kg/m^3
......@@ -348,7 +348,7 @@ define([], function(){
rubber: {
name: "Rubber",
color: "#cda4f3",
altColor: "#cda4f3",
altColor: "#f5e8d0",
texture: "stripes",
properties: {
conductive: false,
......
......@@ -210,14 +210,14 @@ define(['backbone', 'underscore', 'lattice', 'three', 'threeModel', 'globals', '
return lattice.getCellAtIndex(this.get("min").clone().add(relIndex));
},
finish: function(){
if (globals.get("selectedRegion")) this.clone();
finish: function(cloneParams){
if (globals.get("selectedRegion")) this.clone(cloneParams);
else if (this.get("cutMode")) this.cut();
else this.fill();
},
clone: function(){
lattice.addCellsInRange({min: this.get("min").clone(), max: this.get("max").clone()}, globals.get("selectedRegion"));
clone: function(params){
lattice.addCellsInRange({min: this.get("min").clone(), max: this.get("max").clone()}, globals.get("selectedRegion"), params);
appState.set("showOneLayer", false);
globals.destroySelection3D();
},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment