{"size": 1668, "ext": "js", "max_stars_repo_path": "Applications/static/scripts/Slider.js", "max_stars_repo_name": "cemac-ccs/Faze-In_App", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Applications/static/scripts/Slider.js", "max_issues_repo_name": "cemac-ccs/Faze-In_App", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Applications/static/scripts/Slider.js", "max_forks_repo_name": "cemac-ccs/Faze-In_App", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 24.8955223881, "max_line_length": 114, "alphanum_fraction": 0.6306954436}
(function() {

	/**
	 * Simple slider control for EaselJS examples.
	 **/
	function Slider(min, max, width, height) {
		this.Shape_constructor();

	// public properties:
		this.min = this.value = min||0;
		this.max = max||100;

		this.width = width||100;
		this.height = height||20;

		this.values = {};

		this.trackColor = "#BDBDD2";
		this.thumbColor = "#646483";

		this.cursor = "pointer";
		this.on("mousedown", this._handleInput, this);
		this.on("pressmove", this._handleInput, this);
	}
	var p = createjs.extend(Slider, createjs.Shape);


// public methods:
	p.isVisible = function() { return true; };

	p.draw = function(ctx, ignoreCache) {
		if (this._checkChange()) {
			var x = (this.width-this.height) * Math.max(0,Math.min(1,(this.value-this.min) / (this.max-this.min)));
			this.graphics.clear()
				.beginFill(this.trackColor).drawRect(0,0,this.width,this.height)
				.beginFill(this.thumbColor).drawRect(x,0,this.height, this.height);
		}
		this.Shape_draw(ctx, true);
	};


// private methods:
	p._checkChange = function() {
		var a = this, b = a.values;
		if (a.value !== b.value || a.min !== b.min || a.max !== b.max || a.width !== b.width || a.height !== b.height) {
			b.min = a.min;
			b.max = a.max;
			b.value = a.value;
			b.width = a.width;
			b.height = a.height;
			return true;
		}
		return false;
	};

	p._handleInput = function(evt) {
		var val = (evt.localX-this.height/2)/(this.width-this.height)*(this.max-this.min)+this.min;
		val = Math.max(this.min, Math.min(this.max, val));
		if (val == this.value) { return; }
		this.value = val;
		this.dispatchEvent("change");
	};


	window.Slider = createjs.promote(Slider, "Shape");
}());
