<commit_before>/**
_enyo.TransitionScrollStrategy_ is a helper kind that extends
<a href="#enyo.TouchScrollStrategy">enyo.TouchScrollStrategy</a>, optimizing it
for scrolling environments in which effecting scroll changes with transforms
using CSS transitions is fastest.

_enyo.TransitionScrollStrategy_ is not typically created in application code.
*/
enyo.kind({
	name: "enyo.TransitionScrollStrategy",
	kind: "enyo.TouchScrollStrategy",
	//* @protected
	components: [
		{name: "clientContainer", classes: "enyo-touch-scroller", components: [
			{name: "client"}
		]}
	],
	events: {
		onScrollStart: "",
		onScroll: "",
		onScrollStop: ""
	},
	handlers: {
		ondown: "down",
		ondragfinish: "dragfinish",
		onwebkitTransitionEnd: "transitionComplete"
	},
	//* No scrollMath tool for this strategy
	tools: [
		{name: "vthumb", kind: "ScrollThumb", axis: "v", showing: true},
		{name: "hthumb", kind: "ScrollThumb", axis: "h", showing: false}
	],
	//* Scalar applied to 'flick' event velocity
	kFlickScalar: 600,
	//* Top snap boundary, generally 0
	topBoundary: 0,
	//* Right snap boundary, generally (viewport width - content width)
	rightBoundary: 0,
	//* Bottom snap boundary, generally (viewport height - content height)
	bottomBoundary: 0,
	//* Left snap boundary, generally 0
	leftBoundary: 0,
	//* Flag to specify whether scrolling is in progress
	scrolling: false,
	//* Event listener for webkit transition completion
	listener: null,
	//* X Distance to scroll into overscroll space before bouncing back
	boundaryX:0,
	//* Y Distance to scroll into overscroll space before bouncing back
	boundaryY:0,
	//* Timeout used to stop scrolling on mousedown
	stopTimeout: null,
	//* MS delay used to stop scrolling on mousedown
	stopTimeoutMS: 80,
	//* Interval used to update scroll values and bubble scroll events during scroll animation
	scrollInterval: null,
	//* MS delay used to update scroll values and bubble scroll events during scroll animation
	scrollIntervalMS: 50,
	//* Transition animations
	transitions: {
		//* None - used for dragging, etc.
		none   : "",
		//* Scroll - basic scrolling behavior
		scroll : "3.8s cubic-bezier(.19,1,.28,1.0) 0s",
		//* Bounce - overscroll bounceback behavior
		bounce : "0.5s cubic-bezier(0.06,.5,.5,.94) 0s"
	},
	
	//* @public
	
	//* Sets the left scroll position within the scroller.
	setScrollLeft: function(inLeft) {
		var prevLeft = this.scrollLeft;
		this.stop();
		this.scrollLeft = inLeft;
		if(this.isInLeftOverScroll() || this.isInRightOverScroll()) {
			this.scrollLeft = prevLeft;
		}
		this.effectScroll();
	},
	//* Sets the top scroll position within the scroller.
	setScrollTop: function(inTop) {
		var prevTop = this.scrollTop;
		this.stop();
		this.scrollTop = inTop;
		if(this.isInTopOverScroll() || this.isInBottomOverScroll()) {
			this.scrollTop = prevTop;
		}
		this.effectScroll();
	},
	setScrollX: function(inLeft) {
		this.scrollLeft = -1*inLeft;
	},
	setScrollY: function(inTop) {
		this.scrollTop = -1*inTop;
	},
	
	//* Gets the left scroll position within the scroller.
	getScrollLeft: function() {
		return this.scrollLeft;
	},
	//* Gets the top scroll position within the scroller.
	getScrollTop: function() {
		return this.scrollTop;
	},
	
	//* @protected
	
	// apply initial transform so we're always composited
	create: function() {
		this.inherited(arguments);
		enyo.dom.transformValue(this.$.client, this.translation, "0,0,0");
	},
	destroy: function() {
		this.clearCSSTransitionInterval();
		this.inherited(arguments);
	},
	getScrollSize: function() {
		var n = this.$.client.hasNode();
		return {width: n ? n.scrollWidth : 0, height: n ? n.scrollHeight : 0};
	},
	horizontalChanged: function() {
		if(this.horizontal == "hidden") {
			this.scrollHorizontal = false;
		}
	},
	verticalChanged: function() {
		if(this.vertical == "hidden") {
			this.scrollVertical = false;
		}
	},
	calcScrollNode: function() {
		return this.$.clientContainer.hasNode();
	},
	calcBoundaries: function() {
		var b = this._getScrollBounds();
		this.bottomBoundary = b.clientHeight - b.height;
		this.rightBoundary = b.clientWidth - b.width;
	},
	maxHeightChanged: function() {
		// content should cover scroller at a minimum if there's no max-height.
		this.$.client.applyStyle("min-height", this.maxHeight ? null : "100%");
		this.$.client.applyStyle("max-height", this.maxHeight);
		this.$.clientContainer.addRemoveClass("enyo-scrollee-fit", !this.maxHeight);
	},
	calcAutoScrolling: function() {
		var b = this.getScrollBounds();
		if(this.vertical) {
			this.scrollVertical = b.height > b.clientHeight;
		}
		if(this.horizontal) {
			this.scrollHorizontal = b.width > b.clientWidth;
		}
	},
	isInOverScroll: function() {
		return (this.isInTopOverScroll() || this.isInBottomOverScroll() || this.isInLeftOverScroll() || this.isInRightOverScroll());
	},
	isInLeftOverScroll: function() {
		return (this.getScrollLeft() < this.leftBoundary);
	},
	isInRightOverScroll: function() {
		if(this.getScrollLeft <= 0) {
			return false;
		} else {
			return (this.getScrollLeft()*-1 < this.rightBoundary);
		}
	},
	isInTopOverScroll: function() {
		return (this.getScrollTop() < this.topBoundary);
	},
	isInBottomOverScroll: function() {
		if(this.getScrollTop() <= 0) {
			return false;
		} else {
			return (this.getScrollTop()*-1 < this.bottomBoundary);
		}
	},
	calcStartInfo: function() {
		var sb = this.getScrollBounds(), y = this.getScrollTop(), x = this.getScrollLeft();
		this.startEdges = {
			top: y === 0,
			bottom: y === sb.maxTop,
			left: x === 0,
			right: x === sb.maxLeft
		};
	},
	mousewheel: function(inSender, e) {
		if (!this.dragging) {
			this.calcBoundaries();
			this.syncScrollMath();
			var dy = this.vertical ? e.wheelDeltaY || e.wheelDelta : 0;
			var y = parseFloat(this.getScrollTop()) + -1*parseFloat(dy);
			y = (y*-1 < this.bottomBoundary) ? -1*this.bottomBoundary : (y < this.topBoundary) ? this.topBoundary : y;
			this.setScrollTop(y);
			this.doScroll();
			e.preventDefault();
			return true;
		}
	},<commit_msg>added mousewheel scrolling fix also to TransitionScrollStrategy.js<commit_after>/**
_enyo.TransitionScrollStrategy_ is a helper kind that extends
<a href="#enyo.TouchScrollStrategy">enyo.TouchScrollStrategy</a>, optimizing it
for scrolling environments in which effecting scroll changes with transforms
using CSS transitions is fastest.

_enyo.TransitionScrollStrategy_ is not typically created in application code.
*/
enyo.kind({
	name: "enyo.TransitionScrollStrategy",
	kind: "enyo.TouchScrollStrategy",
	//* @protected
	components: [
		{name: "clientContainer", classes: "enyo-touch-scroller", components: [
			{name: "client"}
		]}
	],
	events: {
		onScrollStart: "",
		onScroll: "",
		onScrollStop: ""
	},
	handlers: {
		ondown: "down",
		ondragfinish: "dragfinish",
		onwebkitTransitionEnd: "transitionComplete"
	},
	//* No scrollMath tool for this strategy
	tools: [
		{name: "vthumb", kind: "ScrollThumb", axis: "v", showing: true},
		{name: "hthumb", kind: "ScrollThumb", axis: "h", showing: false}
	],
	//* Scalar applied to 'flick' event velocity
	kFlickScalar: 600,
	//* Top snap boundary, generally 0
	topBoundary: 0,
	//* Right snap boundary, generally (viewport width - content width)
	rightBoundary: 0,
	//* Bottom snap boundary, generally (viewport height - content height)
	bottomBoundary: 0,
	//* Left snap boundary, generally 0
	leftBoundary: 0,
	//* Flag to specify whether scrolling is in progress
	scrolling: false,
	//* Event listener for webkit transition completion
	listener: null,
	//* X Distance to scroll into overscroll space before bouncing back
	boundaryX:0,
	//* Y Distance to scroll into overscroll space before bouncing back
	boundaryY:0,
	//* Timeout used to stop scrolling on mousedown
	stopTimeout: null,
	//* MS delay used to stop scrolling on mousedown
	stopTimeoutMS: 80,
	//* Interval used to update scroll values and bubble scroll events during scroll animation
	scrollInterval: null,
	//* MS delay used to update scroll values and bubble scroll events during scroll animation
	scrollIntervalMS: 50,
	//* Transition animations
	transitions: {
		//* None - used for dragging, etc.
		none   : "",
		//* Scroll - basic scrolling behavior
		scroll : "3.8s cubic-bezier(.19,1,.28,1.0) 0s",
		//* Bounce - overscroll bounceback behavior
		bounce : "0.5s cubic-bezier(0.06,.5,.5,.94) 0s"
	},
	
	//* @public
	
	//* Sets the left scroll position within the scroller.
	setScrollLeft: function(inLeft) {
		var prevLeft = this.scrollLeft;
		this.stop();
		this.scrollLeft = inLeft;
		if(this.isInLeftOverScroll() || this.isInRightOverScroll()) {
			this.scrollLeft = prevLeft;
		}
		this.effectScroll();
	},
	//* Sets the top scroll position within the scroller.
	setScrollTop: function(inTop) {
		var prevTop = this.scrollTop;
		this.stop();
		this.scrollTop = inTop;
		if(this.isInTopOverScroll() || this.isInBottomOverScroll()) {
			this.scrollTop = prevTop;
		}
		this.effectScroll();
	},
	setScrollX: function(inLeft) {
		this.scrollLeft = -1*inLeft;
	},
	setScrollY: function(inTop) {
		this.scrollTop = -1*inTop;
	},
	
	//* Gets the left scroll position within the scroller.
	getScrollLeft: function() {
		return this.scrollLeft;
	},
	//* Gets the top scroll position within the scroller.
	getScrollTop: function() {
		return this.scrollTop;
	},
	
	//* @protected
	
	// apply initial transform so we're always composited
	create: function() {
		this.inherited(arguments);
		enyo.dom.transformValue(this.$.client, this.translation, "0,0,0");
	},
	destroy: function() {
		this.clearCSSTransitionInterval();
		this.inherited(arguments);
	},
	getScrollSize: function() {
		var n = this.$.client.hasNode();
		return {width: n ? n.scrollWidth : 0, height: n ? n.scrollHeight : 0};
	},
	horizontalChanged: function() {
		if(this.horizontal == "hidden") {
			this.scrollHorizontal = false;
		}
	},
	verticalChanged: function() {
		if(this.vertical == "hidden") {
			this.scrollVertical = false;
		}
	},
	calcScrollNode: function() {
		return this.$.clientContainer.hasNode();
	},
	calcBoundaries: function() {
		var b = this._getScrollBounds();
		this.bottomBoundary = b.clientHeight - b.height;
		this.rightBoundary = b.clientWidth - b.width;
	},
	maxHeightChanged: function() {
		// content should cover scroller at a minimum if there's no max-height.
		this.$.client.applyStyle("min-height", this.maxHeight ? null : "100%");
		this.$.client.applyStyle("max-height", this.maxHeight);
		this.$.clientContainer.addRemoveClass("enyo-scrollee-fit", !this.maxHeight);
	},
	calcAutoScrolling: function() {
		var b = this.getScrollBounds();
		if(this.vertical) {
			this.scrollVertical = b.height > b.clientHeight;
		}
		if(this.horizontal) {
			this.scrollHorizontal = b.width > b.clientWidth;
		}
	},
	isInOverScroll: function() {
		return (this.isInTopOverScroll() || this.isInBottomOverScroll() || this.isInLeftOverScroll() || this.isInRightOverScroll());
	},
	isInLeftOverScroll: function() {
		return (this.getScrollLeft() < this.leftBoundary);
	},
	isInRightOverScroll: function() {
		if(this.getScrollLeft <= 0) {
			return false;
		} else {
			return (this.getScrollLeft()*-1 < this.rightBoundary);
		}
	},
	isInTopOverScroll: function() {
		return (this.getScrollTop() < this.topBoundary);
	},
	isInBottomOverScroll: function() {
		if(this.getScrollTop() <= 0) {
			return false;
		} else {
			return (this.getScrollTop()*-1 < this.bottomBoundary);
		}
	},
	calcStartInfo: function() {
		var sb = this.getScrollBounds(), y = this.getScrollTop(), x = this.getScrollLeft();
		this.startEdges = {
			top: y === 0,
			bottom: y === sb.maxTop,
			left: x === 0,
			right: x === sb.maxLeft
		};
	},
	mousewheel: function(inSender, e) {
		if (!this.dragging) {
			this.calcBoundaries();
			this.syncScrollMath();
			this.stabilize();
			var dy = this.vertical ? e.wheelDeltaY || e.wheelDelta : 0;
			var y = parseFloat(this.getScrollTop()) + -1*parseFloat(dy);
			y = (y*-1 < this.bottomBoundary) ? -1*this.bottomBoundary : (y < this.topBoundary) ? this.topBoundary : y;
			this.setScrollTop(y);
			this.doScroll();
			e.preventDefault();
			return true;
		}
	},
{'fraction_non_alphanumeric': 0.14131152956722828, 'fraction_numerical': 0.009084902543772711, 'mean_word_length': 4.034927234927235, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 11, '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': '4541746', 'n_tokens_mistral': 4352, 'n_tokens_neox': 3973, 'n_words': 1001}