Fixed issues with Detail View width adjust and added DV Height Adjust
Fixed issues with Detail View width adjust and added DV Height Adjust

--- a/source/lib/scripts/CabinetEditor/CabinetEditor.js
+++ b/source/lib/scripts/CabinetEditor/CabinetEditor.js
@@ -582,7 +582,8 @@
 

 		} else {

 

-			scaleFactor = cabinet_info.calculateDetailViewScaleFactor(this.dv_buffer_layer);

+			if(cabinet_info.calculateDetailViewScaleFactor)

+				scaleFactor = cabinet_info.calculateDetailViewScaleFactor(this.dv_buffer_layer);

 

 			if(this.active_pick != null && this.detailViewScaleFactor)

 				scaleFactor = this.detailViewScaleFactor;

@@ -1034,7 +1035,10 @@
 	 * @param {Array} curs Array of strings that holds the css3 properties for

 	 *  each type of cursor

 	 */

-	CabinetEditor.prototype.updateCursor = function(object_angle, direction, curs){

+	CabinetEditor.prototype.updateCursor = function(object_angle, direction, curs, canvas){

+

+		if(!canvas)

+			canvas = this.tv_canvas;

 

 		var cursor_sector_angle = -1*object_angle;

 

@@ -1050,15 +1054,15 @@
 		if(cursor_sector_angle >    Math.PI) cursor_sector_angle -= 2*Math.PI;

 		else if(cursor_sector_angle < -1*Math.PI) cursor_sector_angle += 2*Math.PI;

 

-		if(cursor_sector_angle > Math.PI* 7/8										 ) this.tv_canvas.style.cursor = curs[0];

-		else if(cursor_sector_angle > Math.PI* 5/8 && cursor_sector_angle <= Math.PI* 7/8) this.tv_canvas.style.cursor = curs[1];

-		else if(cursor_sector_angle > Math.PI* 3/8 && cursor_sector_angle <= Math.PI* 5/8) this.tv_canvas.style.cursor = curs[2];

-		else if(cursor_sector_angle > Math.PI* 1/8 && cursor_sector_angle <= Math.PI* 3/8) this.tv_canvas.style.cursor = curs[3];

-		else if(cursor_sector_angle > Math.PI*-1/8 && cursor_sector_angle <= Math.PI* 1/8) this.tv_canvas.style.cursor = curs[4];

-		else if(cursor_sector_angle > Math.PI*-3/8 && cursor_sector_angle <= Math.PI*-1/8) this.tv_canvas.style.cursor = curs[5];

-		else if(cursor_sector_angle > Math.PI*-5/8 && cursor_sector_angle <= Math.PI*-3/8) this.tv_canvas.style.cursor = curs[6];

-		else if(cursor_sector_angle > Math.PI*-7/8 && cursor_sector_angle <= Math.PI*-5/8) this.tv_canvas.style.cursor = curs[7];

-		else if(									  cursor_sector_angle <= Math.PI*-7/8) this.tv_canvas.style.cursor = curs[0];

+		if(cursor_sector_angle > Math.PI* 7/8										 ) canvas.style.cursor = curs[0];

+		else if(cursor_sector_angle > Math.PI* 5/8 && cursor_sector_angle <= Math.PI* 7/8) canvas.style.cursor = curs[1];

+		else if(cursor_sector_angle > Math.PI* 3/8 && cursor_sector_angle <= Math.PI* 5/8) canvas.style.cursor = curs[2];

+		else if(cursor_sector_angle > Math.PI* 1/8 && cursor_sector_angle <= Math.PI* 3/8) canvas.style.cursor = curs[3];

+		else if(cursor_sector_angle > Math.PI*-1/8 && cursor_sector_angle <= Math.PI* 1/8) canvas.style.cursor = curs[4];

+		else if(cursor_sector_angle > Math.PI*-3/8 && cursor_sector_angle <= Math.PI*-1/8) canvas.style.cursor = curs[5];

+		else if(cursor_sector_angle > Math.PI*-5/8 && cursor_sector_angle <= Math.PI*-3/8) canvas.style.cursor = curs[6];

+		else if(cursor_sector_angle > Math.PI*-7/8 && cursor_sector_angle <= Math.PI*-5/8) canvas.style.cursor = curs[7];

+		else if(									  cursor_sector_angle <= Math.PI*-7/8) canvas.style.cursor = curs[0];

 

 	};

 


--- /dev/null
+++ b/source/lib/scripts/CabinetEditor/Picks/Item/Detail/DetailHeightPick.js
@@ -1,1 +1,122 @@
+/**
+ * @file Pick to change the height of cabinets
+ * @author Michael Marques <dryerzinia@gmail.com>
+ * @module Pick/DetailHeightPick
+ */
 
+define(
+	[
+	 	'CabinetEditor/Picks/Item/Front/HeightPick',
+
+	 	'CabinetEditor/Defines/Cursors',
+	 	'CabinetEditor/Defines/Cardinal',
+
+	 	'CabinetEditor/Config',
+
+	 	'Util/Class'
+
+ 	],
+	function(
+		HeightPick,
+
+		cursors,
+		Cardinal,
+
+		Config,
+
+		Class
+	){
+
+	/**
+	 * Class for handling height adjusting actions
+	 * @constructor
+	 * @augments Pick
+	 * @param {Number} init_z Pick initial Z Coordinate
+	 * @param {Number} side Cardinal side Pick is on
+	 * @param {SchematicObject} object Schematic object Pick will modify
+	 * @property {Number} init_z Pick initial Z Coordinate
+	 * @property {Number} obj_d Object initial Depth Value
+	 * @property {Number} obj_z Object initial Z Coordinate
+	 * @property {Number} side Cardinal Side Pick is on
+	 * @property {Number} last_d Last value of d set for face_frame size
+	 *  adjustments
+	 */
+	var DetailHeightPick = function(init_z, side, object){
+
+		HeightPick.call(this, init_z, side, object);
+		this.initObjD = object.d;
+
+	};
+
+	Class.extend(HeightPick, DetailHeightPick);
+
+	DetailHeightPick.prototype.pickAction = function(x, y, editor){
+
+		if(this.side == Cardinal.S)
+			y += (this.initObjD - this.object.d);
+
+		var dir = -1,
+			dist = -1 * editor.snapDistance(this.init_z-y),
+			min_h = Config.minimumCabinetHeight,
+			i, tallest;
+
+		if(this.side == Cardinal.S){
+			dir = 1;
+			this.object.z = this.obj_z - dist;
+		}
+
+		// Dont let the object extend past the floor
+		if(this.object.z < 0){
+			dist += this.object.z;
+			this.object.z = 0;
+		}
+
+		this.object.d = this.obj_d + dir*dist;
+
+		// Keep the object of a minimum height per section or min overall height
+		if(this.object.faces != undefined)
+			min_h = this.object.faces.front_face.getMinimumHeight();
+
+		if(this.object.d < min_h){
+			dist += (this.object.d - min_h)*dir;
+			this.object.d = min_h;
+			if(dir == 1)
+				this.object.z = this.obj_z + (this.obj_d - min_h);
+		}
+
+		// Dont let the object extend past the ceiling
+		if(editor.schematic.ceiling_height < this.object.d + this.object.z){
+			dist += editor.schematic.ceiling_height-(this.object.d+this.object.z);
+			this.object.d = editor.schematic.ceiling_height-this.object.z;
+		}
+
+		if(this.object.faces != undefined){
+
+			// TODO: move this code into face object, make face object an actual class
+			tallest = this.object.faces.front_face.fronts[0];
+			for(i = 1; i < this.object.faces.front_face.fronts.length; i++){
+				if(this.object.faces.front_face.fronts[i].getHeight() > tallest.getHeight())
+					tallest = this.object.faces.front_face.fronts[i];
+			}
+
+			tallest.height += this.object.d-this.last_d;
+
+			this.last_d = this.object.d;
+
+		}
+
+	};
+
+	DetailHeightPick.prototype.updateCursor = function(clicking, editor){
+
+		if(this.side == Cardinal.S)
+			editor.dv_canvas.style.cursor = cursors.scale_cursors[6];
+		else
+			editor.dv_canvas.style.cursor = cursors.scale_cursors[2];
+
+	};
+
+	return DetailHeightPick;
+
+});
+

--- a/source/lib/scripts/CabinetEditor/Picks/Item/Detail/DetailScalePick.js
+++ b/source/lib/scripts/CabinetEditor/Picks/Item/Detail/DetailScalePick.js
@@ -35,7 +35,7 @@
 
 		ScalePick.call(this, init_x, init_y, direction, object);
 
-		this.objInitX = object.x;
+		this.objInitW = object.w;
 
 	};
 
@@ -46,7 +46,7 @@
 		var shift_angle = 0;
 
 		if(this.direction == Cardinal.W)
-			x -= this.object.x - this.objInitX;
+			x -= this.object.w - this.objInitW;
 
 		if(this.direction == Cardinal.E)	shift_angle = 0;
 		else if(this.direction == Cardinal.W)	shift_angle = Math.PI;
@@ -65,9 +65,9 @@
 
 	};
 
-	ScalePick.prototype.updateCursor = function(clicking, editor){
+	DetailScalePick.prototype.updateCursor = function(clicking, editor){
 
-		editor.dv_canvas.style.cursor = 'ew-resize';
+		editor.updateCursor(0, this.direction, cursors.scale_cursors, editor.dv_canvas);
 
 	};
 

--- a/source/lib/scripts/CabinetEditor/Picks/Item/Front/HeightPick.js
+++ b/source/lib/scripts/CabinetEditor/Picks/Item/Front/HeightPick.js
@@ -45,14 +45,16 @@
 
 		Pick.call(this, object);
 		this.init_z = init_z;
-		this.obj_d = object.d;
-		this.obj_z = object.z;
 		this.side = side;
-		this.last_d = object.d;
+		if(object){
+			this.obj_d = object.d;
+			this.obj_z = object.z;
+			this.last_d = object.d;
+			if(object.face != undefined){
+				// TODO: make something better and faster for here like real face class
+				this.old_face = JSON.parse(JSON.stringify(object.face));
+			}
 
-		if(object.face != undefined){
-			// TODO: make something better and faster for here like real face class
-			this.old_face = JSON.parse(JSON.stringify(object.face));
 		}
 
 	};
@@ -115,7 +117,10 @@
 
 	HeightPick.prototype.updateCursor = function(clicking, editor){
 
-		editor.fv_canvas.style.cursor = cursors.scale_cursors[2];
+		if(this.side == Cardinal.S)
+			editor.fv_canvas.style.cursor = cursors.scale_cursors[6];
+		else
+			editor.fv_canvas.style.cursor = cursors.scale_cursors[2];
 
 	};
 

--- a/source/lib/scripts/CabinetEditor/Picks/Item/Top/ScalePick.js
+++ b/source/lib/scripts/CabinetEditor/Picks/Item/Top/ScalePick.js
@@ -77,7 +77,7 @@
 
 	ScalePick.prototype.updateCursor = function(clicking, editor){
 
-		editor.updateCursor(0, this.direction, cursors.scale_cursors);
+		editor.updateCursor(this.object.angle, this.direction, cursors.scale_cursors);
 
 	};
 

--- a/source/lib/scripts/CabinetEditor/Schematic/Cabinet/Face/FrameFace.js
+++ b/source/lib/scripts/CabinetEditor/Schematic/Cabinet/Face/FrameFace.js
@@ -8,6 +8,7 @@
 	[
 	 	'CabinetEditor/Helper',
 	 	'CabinetEditor/Defines/Cardinal',
+	 	'CabinetEditor/Defines/Layer',
 
 	 	'CabinetEditor/Schematic/Cabinet/Face/Face',
 	 	'CabinetEditor/Schematic/Cabinet/Face/Front',
@@ -23,12 +24,14 @@
 	 	'CabinetEditor/Picks/Item/Detail/FaceDragPick',
 	 	'CabinetEditor/Picks/Item/Detail/StyleAdjustPick',
 	 	'CabinetEditor/Picks/Item/Detail/DetailScalePick',
+	 	'CabinetEditor/Picks/Item/Detail/DetailHeightPick',
 
 	 	'Util/Class'
 	],
 	function(
 		Helper,
 		Cardinal,
+		Layer,
 
 		Face,
 		Front,
@@ -39,10 +42,12 @@
 		DoubleDoorFront,
 		DoubleDrawerFront,
 		ApplianceFront,
+
 		RailLengthPick,
 		FaceDragPick,
 		StyleAdjustPick,
 		DetailScalePick,
+		DetailHeightPick,
 
 		Class
 	){
@@ -188,6 +193,13 @@
 		// Make sure pick is between styles for Rail Adjustments
 		if(x > this.left_style_width + rrlen
 				&& x < cabinet.getFrameWidth() - this.right_style_width - rrlen){
+
+			// Height Up Adjust
+			if(y < cabinet.d + 1.5 && y > cabinet.d && cabinet.getLayer() != Layer.LOWER && cabinet.getLayer() != Layer.FULL)
+				return new DetailHeightPick(y, Cardinal.S, cabinet);
+			// Z Down Adjust
+			if(y < 0 && y > -1.5)
+				return new DetailHeightPick(y, Cardinal.N, cabinet);
 
 			cur_h = 0;
 			for(i = 0; i < this.fronts.length; i++){