<commit_before>var tempBarView = Backbone.View.extend({
	containerDimensions: null,
	handleTop: null,
	scale: null,
	type: null,
	dragging: false,
	events: {
		'touchstart .set-temp': 'onTouchStart',
		'touchmove .set-temp': 'onTouchMove',
		'touchend .set-temp': 'onTouchEnd',
		'resize': 'onResize',
		'click button.temp-off': 'turnOff'
	},
	initialize: function(params) {
		this.scale = params.scale;
		this.type = params.type;
		this.onResize();
	},
	turnOff: function(e) {
		this._sendToolCommand('target', this.type, 0);
		this.setHandle(0);
	},
	setHandle: function(value) {
		if (!this.dragging) {
			var position = this._temp2px(value);
			var handle = this.$el.find('.set-temp');

			handle.css({transition: 'top 0.5s'});
			handle.css({top: position + 'px'});
			handle.text(value);
			setTimeout(function() {
				handle.css({transition: ''});
			}, 500);
		}
	},
	onTouchStart: function(e) {
		e.preventDefault();

		this.dragging = true;

		var target = $(e.target);

		this.handleTop = target.position().top;

		target.addClass('moving');
	},
	onTouchMove: function(e) {
		e.preventDefault();

		var target = $(e.target);

		var newTop = e.originalEvent.changedTouches[0].clientY - this.containerDimensions.top;
		newTop = Math.min(Math.max(newTop, 0), this.containerDimensions.maxTop );

		target.css({top: newTop+'px'});

		target.text(this._px2temp(newTop));
	},
	onTouchEnd: function(e) {
		e.preventDefault();

		this.handleTop = null;

		$(e.target).removeClass('moving');

		//Set it here
		this._sendToolCommand('target', this.type, this.$el.find('.set-temp').text());

		this.dragging = false;
	},
	onResize: function() {
		var container = this.$el.find('.temp-bar');
		var handle = container.find('.set-temp');
		var label = container.find('label');

		var height = container.height();
		var maxTop = height - handle.innerHeight() - label.innerHeight();
<commit_msg>mouse temp control<commit_after>var tempBarView = Backbone.View.extend({
	containerDimensions: null,
	handleTop: null,
	scale: null,
	type: null,
	dragging: false,
	events: {
		'touchstart .set-temp': 'onTouchStart',
		'mousedown .set-temp': 'onTouchStart',
		'touchmove .set-temp': 'onTouchMove',
		'mousemove .set-temp': 'onTouchMove',
		'touchend .set-temp': 'onTouchEnd',
		'mouseup .set-temp': 'onTouchEnd',
		'mouseout .set-temp': 'onTouchEnd',
		'resize': 'onResize',
		'click button.temp-off': 'turnOff'
	},
	initialize: function(params) {
		this.scale = params.scale;
		this.type = params.type;
		this.onResize();
	},
	turnOff: function(e) {
		this._sendToolCommand('target', this.type, 0);
		this.setHandle(0);
	},
	setHandle: function(value) {
		if (!this.dragging) {
			var position = this._temp2px(value);
			var handle = this.$el.find('.set-temp');

			handle.css({transition: 'top 0.5s'});
			handle.css({top: position + 'px'});
			handle.text(value);
			setTimeout(function() {
				handle.css({transition: ''});
			}, 500);
		}
	},
	onTouchStart: function(e) {
		e.preventDefault();

		this.dragging = true;

		var target = $(e.target);

		this.handleTop = target.position().top;

		target.addClass('moving');
	},
	onTouchMove: function(e) {
		if (this.dragging) {
			e.preventDefault();

			var target = $(e.target);

			if (e.type == 'mousemove') {
				var pageY = e.originalEvent.pageY 
			} else {
				var pageY = e.originalEvent.changedTouches[0].clientY;
			}

			var newTop = pageY - this.containerDimensions.top - target.innerHeight()/2.0;
			newTop = Math.min(Math.max(newTop, 0), this.containerDimensions.maxTop );

			target.css({top: newTop+'px'});

			target.text(this._px2temp(newTop));
		}
	},
	onTouchEnd: function(e) {
		e.preventDefault();

		this.handleTop = null;

		$(e.target).removeClass('moving');

		//Set it here
		this._sendToolCommand('target', this.type, this.$el.find('.set-temp').text());

		this.dragging = false;
	},
	onResize: function() {
		var container = this.$el.find('.temp-bar');
		var handle = container.find('.set-temp');
		var label = container.find('label');

		var height = container.height();
		var maxTop = height - handle.innerHeight() - label.innerHeight();

{'fraction_non_alphanumeric': 0.18307804522246535, 'fraction_numerical': 0.005835156819839533, 'mean_word_length': 3.950661853188929, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4734207', 'n_tokens_mistral': 1615, 'n_tokens_neox': 1455, 'n_words': 271}