Text Layer implemented
Text Layer implemented
Check box for selected Text Layer implemented in the UI
When text layer is selected it is now possible to drag text that is
inside another object.

--- a/source/content/homecontent/index.php
+++ b/source/content/homecontent/index.php
@@ -150,6 +150,7 @@
 				<li><div id="counter-top-cb"></div><div>Counter Top</div></li>
 				<li><div id="full-height-cb"></div><div>Full Height</div></li>
 				<li><div id="lower-cb"></div><div>Lower</div></li>
+				<li><div id="text-cb"></div><div>Text</div></li>
 			</ul>
 		</div>
 		<div class="pure-menu pure-menu-open snap-settings">

--- a/source/lib/scripts/CabinetEditor/CabinetEditor.js
+++ b/source/lib/scripts/CabinetEditor/CabinetEditor.js
@@ -1075,7 +1075,9 @@
 	 */

 	CabinetEditor.prototype.getDetail = function(x, y){

 

-		var i;

+		var i, detailObject;

+

+		detailObject = null;

 

 		this.mousedover_cabinet = null;

 		if(this.clicking) this.selected_cabinet = null;

@@ -1084,15 +1086,23 @@
 			if(Helper.collidingLayers(this.schematic.objects[i].getLayer(), this.schematic.selected_layer)){

 				if(this.schematic.objects[i].inBounds(new Point(x, y))){

 

-					if(this.clicking) this.setSelected(this.schematic.objects[i]);

-					else this.mousedover_cabinet = this.schematic.objects[i];

-

-					this.animate(); // TODO: update detail view only

-

-					break;

+					if( detailObject == null ||

+						(this.schematic.objects[i].getLayer() == this.schematic.selected_layer))

+						detailObject = this.schematic.objects[i];

 

 				}

 			}

+		}

+

+		if(detailObject != null){

+

+			//console.log(detailObject.className());

+

+			if(this.clicking) this.setSelected(detailObject);

+			else this.mousedover_cabinet = detailObject;

+

+			this.animate(); // TODO: update detail view only

+

 		}

 

 	};


--- a/source/lib/scripts/CabinetEditor/Picks/Item/Top/DragPick.js
+++ b/source/lib/scripts/CabinetEditor/Picks/Item/Top/DragPick.js
@@ -65,6 +65,10 @@
 
 	Class.extend(Pick, DragPick);
 
+	DragPick.prototype.className = function(){
+		return 'DragPick';
+	};
+
 	/**
 	 * Updates the Pick with the new XY position of the mouse
 	 * @method PickAction

--- a/source/lib/scripts/CabinetEditor/Picks/Item/Top/RotatePick.js
+++ b/source/lib/scripts/CabinetEditor/Picks/Item/Top/RotatePick.js
@@ -40,6 +40,10 @@
 	};
 
 	Class.extend(Pick, RotatePick);
+
+	RotatePick.prototype.className = function(){
+		return 'RotatePick';
+	};
 
 	RotatePick.prototype.pickAction = function(x, y, editor){
 

--- a/source/lib/scripts/CabinetEditor/Picks/Item/Top/ScalePick.js
+++ b/source/lib/scripts/CabinetEditor/Picks/Item/Top/ScalePick.js
@@ -44,6 +44,10 @@
 	};
 
 	Class.extend(DragPick, ScalePick);
+
+	ScalePick.prototype.className = function(){
+		return 'ScalePick';
+	};
 
 	ScalePick.prototype.pickAction = function(x, y, editor){
 

--- a/source/lib/scripts/CabinetEditor/Picks/MeasurementDragPick.js
+++ b/source/lib/scripts/CabinetEditor/Picks/MeasurementDragPick.js
@@ -64,6 +64,10 @@
 	};
 
 	Class.extend(Pick, MeasurementDragPick);
+
+	MeasurementDragPick.prototype.className = function(){
+		return 'MeasurementDragPick';
+	};
 
 	/**
 	 * Updates the Pick with the new XY position of the mouse

--- a/source/lib/scripts/CabinetEditor/Picks/MultiPick.js
+++ b/source/lib/scripts/CabinetEditor/Picks/MultiPick.js
@@ -31,6 +31,10 @@
 	};
 
 	Class.extend(Pick, MultiPick);
+
+	MultiPick.prototype.className = function(){
+		return 'MultiPick';
+	};
 
 	MultiPick.prototype.pickAction = function(x, y, editor){
 

--- a/source/lib/scripts/CabinetEditor/Picks/Pick.js
+++ b/source/lib/scripts/CabinetEditor/Picks/Pick.js
@@ -14,6 +14,10 @@
 	 */
 	function Pick(object){
 		this.object = object;
+	};
+
+	Pick.prototype.className = function(){
+		return 'Pick';
 	};
 
 	/**

--- a/source/lib/scripts/CabinetEditor/Schematic/Other/Measurements/Measurement.js
+++ b/source/lib/scripts/CabinetEditor/Schematic/Other/Measurements/Measurement.js
@@ -48,7 +48,9 @@
 		};
 
 		Class.extend(SchematicObject, Measurement);
-		
+
+		Measurement.DRAG_DISTANCE = 4;
+
 		Measurement.prototype.data = function(){
 
 			var data;
@@ -143,18 +145,25 @@
 
 		};
 
-		Measurement.prototype.getPick = function(x, y){
-
-			var offset, dragDistance;
+		Measurement.prototype.inBounds = function(point){
+
+			var offset;
 
 			offset = this.getCenter();
 			offset = Point.add(offset, new Point(this.x, this.y)).rotateAboutPoint(-this.getAngle(), offset);
 
-			dragDistance = 4;
-
-			if(this.visible && new Point(x, y).distanceToPoint(offset) < dragDistance){
+			if(this.visible && point.distanceToPoint(offset) < Measurement.DRAG_DISTANCE){
+				return true;
+			}
+
+			return false;
+
+		};
+
+		Measurement.prototype.getPick = function(x, y){
+
+			if(this.inBounds(new Point(x, y)))
 				return new MeasurementDragPick(x, y, this);
-			}
 
 			return null;
 

--- a/source/lib/scripts/CabinetEditor/Tools/Item/EditCabinetTool.js
+++ b/source/lib/scripts/CabinetEditor/Tools/Item/EditCabinetTool.js
@@ -402,8 +402,8 @@
 		}
 		if(picks_on_current_layer){
 			for(i = 0; i < picks.length; i++){
-				if(!Helper.collidingLayers(picks[i].object.getLayer(), editor.schematic.selected_layer)){
-
+				if(picks[i].object.getLayer() != editor.schematic.selected_layer){
+				//if(!Helper.collidingLayers(picks[i].object.getLayer(), editor.schematic.selected_layer)){
 					picks.splice(i, 1);
 					i--;
 

--- a/source/lib/scripts/GUI/Toolbar.js
+++ b/source/lib/scripts/GUI/Toolbar.js
@@ -71,6 +71,7 @@
 			counterTopCB = Util.dom.id('counter-top-cb'),
 			fullHeightCB = Util.dom.id('full-height-cb'),
 			lowerCB = Util.dom.id('lower-cb'),
+			textCB = Util.dom.id('text-cb'),
 
 			angleDD = Util.dom.id('angle-snap'),
 			distanceDD = Util.dom.id('distance-snap');
@@ -79,6 +80,7 @@
 		counterTopCB.style.borderColor = Config.layerColors[Layer.COUNTER_TOP];
 		fullHeightCB.style.borderColor = Config.layerColors[Layer.FULL];
 		lowerCB.style.borderColor = Config.layerColors[Layer.LOWER];
+		textCB.style.borderColor = Config.layerColors[Layer.TEXT];
 
 		lowerCB.style.backgroundColor = Config.layerColors[Layer.LOWER];
 
@@ -88,6 +90,7 @@
 			counterTopCB.style.backgroundColor = '';
 			fullHeightCB.style.backgroundColor = '';
 			lowerCB.style.backgroundColor = '';
+			textCB.style.backgroundColor = '';
 
 		};
 
@@ -120,6 +123,14 @@
 			clearLayerCheckboxes();
 			lowerCB.style.backgroundColor = Config.layerColors[Layer.LOWER];
 			editor.setLayer(Layer.LOWER, false);
+
+		};
+
+		textCB.onclick = function(){
+
+			clearLayerCheckboxes();
+			textCB.style.backgroundColor = Config.layerColors[Layer.TEXT];
+			editor.setLayer(Layer.TEXT, false);
 
 		};
 
@@ -137,6 +148,9 @@
 					break;
 				case Layer.LOWER:
 					lowerCB.onclick();
+					break;
+				case Layer.TEXT:
+					textCB.onclick();
 					break;
 			}