jquery-mousewheel-rails 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/jquery-mousewheel-rails/version.rb +1 -1
- data/vendor/assets/javascripts/jquery.mousewheel.js +56 -5
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06772f314185b1cbd581918cd5f595bd2e34d377
|
4
|
+
data.tar.gz: 15a09792ecb91bd62a4853339be395c557408aaa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce4639fe93209555a8638f63d3241e36bc91fc7d2f4580e46c5e91db7b5ad3f670a7339ad61dc2033401a7700a647f69b70d946789df86e47da836da587ba4e6
|
7
|
+
data.tar.gz: 1684d55af7336c9a34e969e169249e4b858ef51a67bb730ae5df1e876950c81dce4818b2b055545ad8ccb0bc7d80563fea858bd07808a629524c4e84c2732602
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
/*! Copyright (c) 2013 Brandon Aaron (http://brandon.aaron.sh)
|
2
2
|
* Licensed under the MIT License (LICENSE.txt).
|
3
3
|
*
|
4
|
-
* Version: 3.1.
|
4
|
+
* Version: 3.1.8
|
5
5
|
*
|
6
6
|
* Requires: jQuery 1.2.2+
|
7
7
|
*/
|
@@ -21,9 +21,9 @@
|
|
21
21
|
|
22
22
|
var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'],
|
23
23
|
toBind = ( 'onwheel' in document || document.documentMode >= 9 ) ?
|
24
|
-
|
24
|
+
['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'],
|
25
25
|
slice = Array.prototype.slice,
|
26
|
-
nullLowestDeltaTimeout, lowestDelta;
|
26
|
+
oldMode, nullLowestDeltaTimeout, lowestDelta;
|
27
27
|
|
28
28
|
if ( $.event.fixHooks ) {
|
29
29
|
for ( var i = toFix.length; i; ) {
|
@@ -31,8 +31,8 @@
|
|
31
31
|
}
|
32
32
|
}
|
33
33
|
|
34
|
-
$.event.special.mousewheel = {
|
35
|
-
version: '3.1.
|
34
|
+
var special = $.event.special.mousewheel = {
|
35
|
+
version: '3.1.8',
|
36
36
|
|
37
37
|
setup: function() {
|
38
38
|
if ( this.addEventListener ) {
|
@@ -42,6 +42,9 @@
|
|
42
42
|
} else {
|
43
43
|
this.onmousewheel = handler;
|
44
44
|
}
|
45
|
+
// Store the line height and page height for this particular element
|
46
|
+
$.data(this, 'mousewheel-line-height', special.getLineHeight(this));
|
47
|
+
$.data(this, 'mousewheel-page-height', special.getPageHeight(this));
|
45
48
|
},
|
46
49
|
|
47
50
|
teardown: function() {
|
@@ -52,6 +55,14 @@
|
|
52
55
|
} else {
|
53
56
|
this.onmousewheel = null;
|
54
57
|
}
|
58
|
+
},
|
59
|
+
|
60
|
+
getLineHeight: function(elem) {
|
61
|
+
return parseInt($(elem)['offsetParent' in $.fn ? 'offsetParent' : 'parent']().css('fontSize'), 10);
|
62
|
+
},
|
63
|
+
|
64
|
+
getPageHeight: function(elem) {
|
65
|
+
return $(elem).height();
|
55
66
|
}
|
56
67
|
};
|
57
68
|
|
@@ -104,10 +115,45 @@
|
|
104
115
|
// No change actually happened, no reason to go any further
|
105
116
|
if ( deltaY === 0 && deltaX === 0 ) { return; }
|
106
117
|
|
118
|
+
// Need to convert lines and pages to pixels if we aren't already in pixels
|
119
|
+
// There are three delta modes:
|
120
|
+
// * deltaMode 0 is by pixels, nothing to do
|
121
|
+
// * deltaMode 1 is by lines
|
122
|
+
// * deltaMode 2 is by pages
|
123
|
+
if ( orgEvent.deltaMode === 1 ) {
|
124
|
+
var lineHeight = $.data(this, 'mousewheel-line-height');
|
125
|
+
delta *= lineHeight;
|
126
|
+
deltaY *= lineHeight;
|
127
|
+
deltaX *= lineHeight;
|
128
|
+
} else if ( orgEvent.deltaMode === 2 ) {
|
129
|
+
var pageHeight = $.data(this, 'mousewheel-page-height');
|
130
|
+
delta *= pageHeight;
|
131
|
+
deltaY *= pageHeight;
|
132
|
+
deltaX *= pageHeight;
|
133
|
+
}
|
134
|
+
|
107
135
|
// Store lowest absolute delta to normalize the delta values
|
108
136
|
absDelta = Math.max( Math.abs(deltaY), Math.abs(deltaX) );
|
137
|
+
|
109
138
|
if ( !lowestDelta || absDelta < lowestDelta ) {
|
110
139
|
lowestDelta = absDelta;
|
140
|
+
|
141
|
+
// Assuming that if the lowestDelta is 120, then that the browser
|
142
|
+
// is treating this as an older mouse wheel event.
|
143
|
+
// We'll divide it by 40 to try and get a more usable deltaFactor.
|
144
|
+
if ( lowestDelta === 120 ) {
|
145
|
+
oldMode = true;
|
146
|
+
lowestDelta /= 40;
|
147
|
+
}
|
148
|
+
}
|
149
|
+
|
150
|
+
// When in oldMode the delta is based on 120.
|
151
|
+
// Dividing by 40 to try and get a more usable deltaFactor.
|
152
|
+
if ( oldMode ) {
|
153
|
+
// Divide all the things by 40!
|
154
|
+
delta /= 40;
|
155
|
+
deltaX /= 40;
|
156
|
+
deltaY /= 40;
|
111
157
|
}
|
112
158
|
|
113
159
|
// Get a whole, normalized value for the deltas
|
@@ -119,6 +165,10 @@
|
|
119
165
|
event.deltaX = deltaX;
|
120
166
|
event.deltaY = deltaY;
|
121
167
|
event.deltaFactor = lowestDelta;
|
168
|
+
// Go ahead and set deltaMode to 0 since we converted to pixels
|
169
|
+
// Although this is a little odd since we overwrite the deltaX/Y
|
170
|
+
// properties with normalized deltas.
|
171
|
+
event.deltaMode = 0;
|
122
172
|
|
123
173
|
// Add event and delta to the front of the arguments
|
124
174
|
args.unshift(event, delta, deltaX, deltaY);
|
@@ -135,6 +185,7 @@
|
|
135
185
|
|
136
186
|
function nullLowestDelta() {
|
137
187
|
lowestDelta = null;
|
188
|
+
oldMode = null;
|
138
189
|
}
|
139
190
|
|
140
191
|
}));
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jquery-mousewheel-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike MacDonald
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-12-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -109,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
109
109
|
version: '0'
|
110
110
|
requirements: []
|
111
111
|
rubyforge_project:
|
112
|
-
rubygems_version: 2.0.
|
112
|
+
rubygems_version: 2.0.14
|
113
113
|
signing_key:
|
114
114
|
specification_version: 4
|
115
115
|
summary: Integrates jquery-mousewheel with rails.
|