azkaban-developers

Details

diff --git a/src/web/js/azkaban/util/svg-navigate.js b/src/web/js/azkaban/util/svg-navigate.js
index 8e2e9b8..604d436 100644
--- a/src/web/js/azkaban/util/svg-navigate.js
+++ b/src/web/js/azkaban/util/svg-navigate.js
@@ -15,7 +15,6 @@
  */
 
 (function($) {
-
 	var mouseUp = function(evt) {
 		if (evt.button > 1) {
 			return;
@@ -86,13 +85,16 @@
 		if (evt.wheelDelta) {
 			if (evt.wheelDelta > 0) {
 				delta = Math.ceil(evt.wheelDelta / 120);
-			} else {
+			}
+			else {
 				delta = Math.floor(evt.wheelDelta / 120);
 			}
-		} else if (evt.detail) {
+		} 
+		else if (evt.detail) {
 			if (evt.detail > 0) {
 				delta = -Math.ceil(evt.detail / 3);
-			} else {
+			}
+			else {
 				delta = -Math.floor(evt.detail / 3);
 			}
 		}
@@ -118,7 +120,8 @@
 	this.boundZoomLevel = function(target, level) {
 		if (level >= target.settings.zoomNumLevels) {
 			return target.settings.zoomNumLevels - 1;
-		} else if (level <= 0) {
+		}
+		else if (level <= 0) {
 			return 0;
 		}
 
@@ -148,13 +151,11 @@
 	}
 
 	this.retransform = function(target) {
-		// $(target).children('g').attr("transform", "translate(" +
-		// target.translateX + "," + target.translateY + ") scale(" +
-		// target.scale + ")");
 		var gs = target.childNodes;
 
-		var transformString = "translate(" + target.translateX + ","
-		        + target.translateY + ") scale(" + target.scale + ")";
+		var transformString = "translate(" + target.translateX + "," + target.translateY + 
+							  ") scale(" + target.scale + ")";
+
 		for ( var i = 0; i < gs.length; ++i) {
 			var g = gs[i];
 			if (g.nodeName == 'g') {
@@ -194,9 +195,9 @@
 			var aspectRatioGraph = height / width;
 			var aspectRatioDiv = divHeight / divWidth;
 
-			var scale = aspectRatioGraph > aspectRatioDiv ? (divHeight / height)
-			        * factor
-			        : (divWidth / width) * factor;
+			var scale = aspectRatioGraph > aspectRatioDiv 
+							? (divHeight / height) * factor 
+							: (divWidth / width) * factor;
 			target.scale = scale;
 		} else {
 			target.zoomIndex = boundZoomLevel(target, settings.zoomIndex);
@@ -226,20 +227,15 @@
 			var timeDiff = time - target.startTime;
 			var progress = timeDiff / (target.endTime - target.startTime);
 
-			// target.zoomIndex = Math.floor((target.toScaleLevel -
-			// target.fromScaleLevel)*progress) + target.fromScaleLevel;
-			// target.scale = target.zoomLevels[target.zoomIndex];
-			target.scale = (target.toScale - target.fromScale) * progress
-			        + target.fromScale;
-			target.translateX = (target.toX - target.fromX) * progress
-			        + target.fromX;
-			target.translateY = (target.toY - target.fromY) * progress
-			        + target.fromY;
+			target.scale = (target.toScale - target.fromScale) * progress + target.fromScale;
+			target.translateX = (target.toX - target.fromX) * progress + target.fromX;
+			target.translateY = (target.toY - target.fromY) * progress + target.fromY;
 			retransform(target);
 			setTimeout(function() {
 				this.animateTick(target)
 			}, 1);
-		} else {
+		} 
+		else {
 			target.zoomIndex = target.toScaleLevel;
 			target.scale = target.zoomLevels[target.zoomIndex];
 			target.translateX = target.toX;
@@ -251,7 +247,8 @@
 	this.calculateZoomScale = function(scaleLevel, numLevels, points) {
 		if (scaleLevel <= 0) {
 			return points[0];
-		} else if (scaleLevel >= numLevels) {
+		} 
+		else if (scaleLevel >= numLevels) {
 			return points[points.length - 1];
 		}
 		var factor = (scaleLevel / numLevels) * (points.length - 1);
@@ -266,7 +263,8 @@
 	this.calculateZoomLevel = function(scale, zoomLevels) {
 		if (scale >= zoomLevels[zoomLevels.length - 1]) {
 			return zoomLevels.length - 1;
-		} else if (scale <= zoomLevels[0]) {
+		}
+		else if (scale <= zoomLevels[0]) {
 			return 0;
 		}
 
@@ -287,128 +285,123 @@
 	}
 
 	var methods = {
-	    init : function(options) {
-		    var settings = {
-		        x : 0,
-		        y : 0,
-		        x2 : 0,
-		        y2 : 0,
-		        minX : -1000,
-		        minY : -1000,
-		        maxX : 1000,
-		        maxY : 1000,
-		        zoomIndex : 24,
-		        zoomPoints : [ 0.1, 0.14, 0.2, 0.4, 0.8, 1, 1.6, 2.4, 4, 8, 16 ],
-		        zoomNumLevels : 48
-		    };
-		    if (options) {
-			    $.extend(settings, options);
-		    }
-		    return this.each(function() {
-			    var $this = $(this);
-			    this.settings = settings;
-			    this.marker = true;
-
-			    if (window.addEventListener)
-				    this.addEventListener('DOMMouseScroll', mouseScrolled,
-				            false);
-			    this.onmousewheel = mouseScrolled;
-			    this.onmousedown = mouseDown;
-			    this.onmouseup = mouseUp;
-			    this.onmousemove = mouseMove;
-			    this.onmouseout = mouseOut;
-
-			    this.zoomLevels = new Array(settings.zoomNumLevels);
-			    for ( var i = 0; i < settings.zoomNumLevels; ++i) {
-				    var scale = calculateZoomScale(i, settings.zoomNumLevels,
-				            settings.zoomPoints);
-				    this.zoomLevels[i] = scale;
-			    }
-			    resetTransform(this);
-		    });
-	    },
-	    transformToBox : function(arguments) {
-		    var $this = $(this);
-		    var target = ($this)[0];
-		    var x = arguments.x;
-		    var y = arguments.y;
-		    var factor = 0.9;
-		    var duration = arguments.duration;
-
-		    var width = arguments.width ? arguments.width : 1;
-		    var height = arguments.height ? arguments.height : 1;
-
-		    var divHeight = target.parentNode.clientHeight;
-		    var divWidth = target.parentNode.clientWidth;
-
-		    var aspectRatioGraph = height / width;
-		    var aspectRatioDiv = divHeight / divWidth;
-
-		    var scale = aspectRatioGraph > aspectRatioDiv ? (divHeight / height)
-		            * factor
-		            : (divWidth / width) * factor;
-		    // console.log("(" + x + "," + y + "," + width.toPrecision(4) + ","
-			// + height.toPrecision(4) + ")");
-		    // console.log("(rg:" + aspectRatioGraph.toPrecision(3) + ",rd:" +
-			// aspectRatioDiv.toPrecision(3) + "," + scale.toPrecision(3) +
-			// ")");
-
-		    if (arguments.maxScale) {
-			    if (scale > arguments.maxScale) {
-				    scale = arguments.maxScale;
-			    }
-		    }
-		    if (arguments.minScale) {
-			    if (scale < arguments.minScale) {
-				    scale = arguments.minScale;
-			    }
-		    }
-
-		    // Center
-		    var scaledWidth = width * scale;
-		    var scaledHeight = height * scale;
-
-		    var sx = (divWidth - scaledWidth) / 2 - scale * x;
-		    var sy = (divHeight - scaledHeight) / 2 - scale * y;
-		    console.log("sx,sy:" + sx + "," + sy);
-
-		    if (duration != 0 && !duration) {
-			    duration = 500;
-		    }
-
-		    animateTransform(target, scale, sx, sy, duration);
-	    },
-	    attachNavigateModel : function(arguments) {
-		    var $this = $(this);
-		    var target = ($this)[0];
-		    target.model = arguments;
-
-		    if (target.model) {
-			    var obj = {};
-			    obj.scale = target.scale;
-			    obj.height = target.parentNode.clientHeight;
-			    obj.width = target.parentNode.clientWidth;
-
-			    obj.x1 = target.translateX;
-			    obj.y1 = target.translateY;
-			    obj.x2 = obj.x1 + obj.height * obj.scale;
-			    obj.y2 = obj.y1 + obj.width * obj.scale;
-
-			    target.model.set({
-				    transform : obj
-			    });
-		    }
-	    }
+		init : function(options) {
+			var settings = {
+				x : 0,
+				y : 0,
+				x2 : 0,
+				y2 : 0,
+				minX : -1000,
+				minY : -1000,
+				maxX : 1000,
+				maxY : 1000,
+				zoomIndex : 24,
+				zoomPoints : [ 0.1, 0.14, 0.2, 0.4, 0.8, 1, 1.6, 2.4, 4, 8, 16 ],
+				zoomNumLevels : 48
+			};
+			if (options) {
+				$.extend(settings, options);
+			}
+			return this.each(function() {
+				var $this = $(this);
+				this.settings = settings;
+				this.marker = true;
+
+				if (window.addEventListener)
+					this.addEventListener('DOMMouseScroll', mouseScrolled,
+							false);
+				this.onmousewheel = mouseScrolled;
+				this.onmousedown = mouseDown;
+				this.onmouseup = mouseUp;
+				this.onmousemove = mouseMove;
+				this.onmouseout = mouseOut;
+
+				this.zoomLevels = new Array(settings.zoomNumLevels);
+				for ( var i = 0; i < settings.zoomNumLevels; ++i) {
+					var scale = calculateZoomScale(i, settings.zoomNumLevels,
+							settings.zoomPoints);
+					this.zoomLevels[i] = scale;
+				}
+				resetTransform(this);
+			});
+		},
+		transformToBox : function(arguments) {
+			var $this = $(this);
+			var target = ($this)[0];
+			var x = arguments.x;
+			var y = arguments.y;
+			var factor = 0.9;
+			var duration = arguments.duration;
+
+			var width = arguments.width ? arguments.width : 1;
+			var height = arguments.height ? arguments.height : 1;
+
+			var divHeight = target.parentNode.clientHeight;
+			var divWidth = target.parentNode.clientWidth;
+
+			var aspectRatioGraph = height / width;
+			var aspectRatioDiv = divHeight / divWidth;
+
+			var scale = aspectRatioGraph > aspectRatioDiv ? (divHeight / height) * factor
+					: (divWidth / width) * factor;
+
+			if (arguments.maxScale) {
+				if (scale > arguments.maxScale) {
+					scale = arguments.maxScale;
+				}
+			}
+			if (arguments.minScale) {
+				if (scale < arguments.minScale) {
+					scale = arguments.minScale;
+				}
+			}
+
+			// Center
+			var scaledWidth = width * scale;
+			var scaledHeight = height * scale;
+
+			var sx = (divWidth - scaledWidth) / 2 - scale * x;
+			var sy = (divHeight - scaledHeight) / 2 - scale * y;
+			console.log("sx,sy:" + sx + "," + sy);
+
+			if (duration != 0 && !duration) {
+				duration = 500;
+			}
+
+			animateTransform(target, scale, sx, sy, duration);
+		},
+		attachNavigateModel : function(arguments) {
+			var $this = $(this);
+			var target = ($this)[0];
+			target.model = arguments;
+
+			if (target.model) {
+				var obj = {};
+				obj.scale = target.scale;
+				obj.height = target.parentNode.clientHeight;
+				obj.width = target.parentNode.clientWidth;
+
+				obj.x1 = target.translateX;
+				obj.y1 = target.translateY;
+				obj.x2 = obj.x1 + obj.height * obj.scale;
+				obj.y2 = obj.y1 + obj.width * obj.scale;
+
+				target.model.set({
+					transform : obj
+				});
+			}
+		}
 	};
 
 	// Main Constructor
 	$.fn.svgNavigate = function(method) {
 		if (methods[method]) {
-			return methods[method].apply(this, Array.prototype.slice.call(
-			        arguments, 1));
-		} else if (typeof method === 'object' || !method) {
+			return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
+		}
+		else if (typeof method === 'object' || !method) {
 			return methods.init.apply(this, arguments);
-		} else {
+		}
+		else {
 			$.error('Method ' + method + ' does not exist on svgNavigate');
 		}
 	};