Skip to content

Commit c82b51f

Browse files
committed
Revert fix regression since #140
2 parents 0b984a6 + ec05292 commit c82b51f

File tree

1 file changed

+23
-14
lines changed

1 file changed

+23
-14
lines changed

js/jquery.knob.js

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@
147147
s.v[k] = $this.val();
148148

149149
$this.bind(
150-
'change input'
150+
'change'
151151
, function () {
152152
var val = {};
153153
val[k] = $this.val();
@@ -165,7 +165,7 @@
165165
(this.v == '') && (this.v = this.o.min);
166166

167167
this.$.bind(
168-
'change input'
168+
'change'
169169
, function () {
170170
s.val(s._validate(s.$.val()));
171171
}
@@ -318,6 +318,13 @@
318318
e.originalEvent.touches[s.t].pageY
319319
);
320320

321+
if (v == s.cv) return;
322+
323+
if (
324+
s.cH
325+
&& (s.cH(v) === false)
326+
) return;
327+
321328
s.change(s._validate(v));
322329
s._draw();
323330
};
@@ -352,6 +359,13 @@
352359

353360
var mouseMove = function (e) {
354361
var v = s.xy2val(e.pageX, e.pageY);
362+
if (v == s.cv) return;
363+
364+
if (
365+
s.cH
366+
&& (s.cH(v) === false)
367+
) return;
368+
355369
s.change(s._validate(v));
356370
s._draw();
357371
};
@@ -514,13 +528,7 @@
514528

515529
this.val = function (v) {
516530
if (null != v) {
517-
var newValue = this.o.stopper ? max(min(v, this.o.max), this.o.min) : v;
518-
if (newValue == this.cv) return;
519-
this.cv = newValue;
520-
if (
521-
this.cH
522-
&& (this.cH(this.cv) === false)
523-
) return;
531+
this.cv = this.o.stopper ? max(min(v, this.o.max), this.o.min) : v;
524532
this.v = this.cv;
525533
this.$.val(this.v);
526534
this._draw();
@@ -562,6 +570,12 @@
562570
,deltaX = ori.detail || ori.wheelDeltaX
563571
,deltaY = ori.detail || ori.wheelDeltaY
564572
,v = parseInt(s.$.val()) + (deltaX>0 || deltaY>0 ? s.o.step : deltaX<0 || deltaY<0 ? -s.o.step : 0);
573+
574+
if (
575+
s.cH
576+
&& (s.cH(v) === false)
577+
) return;
578+
565579
s.val(v);
566580
}
567581
, kval, to, m = 1, kv = {37:-s.o.step, 38:s.o.step, 39:s.o.step, 40:-s.o.step};
@@ -735,12 +749,7 @@
735749
};
736750

737751
this.change = function (v) {
738-
if (v == this.cv) return;
739752
this.cv = v;
740-
if (
741-
this.cH
742-
&& (this.cH(v) === false)
743-
) return;
744753
this.$.val(v);
745754
};
746755

0 commit comments

Comments
 (0)