Door way fix for detail view and front view picking
Door way fix for detail view and front view picking

--- a/source/lib/scripts/CabinetEditor/Schematic/Other/WallInserts/DoorWay.js
+++ b/source/lib/scripts/CabinetEditor/Schematic/Other/WallInserts/DoorWay.js
@@ -1,11 +1,27 @@
 define(
 	[
+
 	 	'CabinetEditor/Schematic/Other/WallInserts/WallInsert',
+	 	'CabinetEditor/Picks/Item/Front/HeightPick',
+
+	 	'CabinetEditor/Defines/Cardinal',
+
+	 	'CabinetEditor/Helper',
+
 	 	'Util/Class'
-	],
+
+ 	],
 	function(
+
 		WallInsert,
+		HeightPick,
+
+		Cardinal,
+
+		Helper,
+
 		Class
+
 	){
 
 		var DoorWay = function(id, style, x, y, w, h, z, d, angle){
@@ -54,6 +70,20 @@
 			ctx.strokeRect(-this.w / 2, -this.h / 2, this.w, this.h);
 
 			ctx.restore();
+
+		};
+
+		DoorWay.prototype.getPickFrontView = function(x, y){
+
+			var fw = this.getFrameWidth(),
+			pickSpace = 3.0;					// TODO: make pickSpace a global
+
+			// Top
+			if(x >= this.fv_x          - pickSpace
+					&& x <= this.fv_x + fw     + pickSpace
+					&& y >= this.z    + this.d - pickSpace
+					&& y <= this.z    + this.d + pickSpace)
+				return new HeightPick(y, Cardinal.N, this);
 
 		};
 
@@ -114,6 +144,51 @@
 
 		};
 
+		DoorWay.prototype.renderDetailView = function(ctx, cvs){
+
+			var scale_factor, x, y;
+
+			ctx.save();
+
+			scale_factor = Helper.calculateDetailViewScaleFactor(cvs, this.w, this.d);
+			x = cvs.width/2/scale_factor;
+			y = cvs.height/2/scale_factor;
+
+			ctx.scale(scale_factor, scale_factor);
+			ctx.translate(x, y);
+
+			ctx.lineWidth = 0.5;
+
+			if(this.style === 'square'){
+				ctx.beginPath();
+				ctx.moveTo(- this.w / 2,   this.d / 2);
+				ctx.lineTo(- this.w / 2, - this.d / 2);
+				ctx.lineTo(  this.w / 2, - this.d / 2);
+				ctx.lineTo(  this.w / 2,   this.d / 2);
+				ctx.stroke();
+			}
+			else if(this.style === 'arch'){
+
+				var arcScale = 1.5;
+
+				ctx.moveTo(- this.w / 2, this.d / 2);
+				ctx.lineTo(- this.w / 2, - this.d / 2 + this.w / (2 * arcScale));
+				ctx.moveTo(  this.w / 2, - this.d / 2 + this.w / (2 * arcScale));
+				ctx.lineTo(  this.w / 2, this.d / 2);
+				ctx.stroke();
+
+				ctx.save();
+				ctx.translate(- this.w / 2, this.z + this.d/ 2);
+				DoorWay.archPath(ctx, arcScale, this.w, this.z, this.d);
+				ctx.restore();
+				ctx.stroke();
+
+			}
+
+			ctx.restore();
+
+		};
+
 		Class.register(DoorWay);
 
 		return DoorWay;