Skip to content

Commit ec05292

Browse files
committed
Revert fix regression since aterrien#140
1 parent 87c54d4 commit ec05292

File tree

1 file changed

+26
-15
lines changed

1 file changed

+26
-15
lines changed

js/jquery.knob.js

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@
141141
s.v[k] = $this.val();
142142

143143
$this.bind(
144-
'change input'
144+
'change'
145145
, function () {
146146
var val = {};
147147
val[k] = $this.val();
@@ -159,7 +159,7 @@
159159
(this.v == '') && (this.v = this.o.min);
160160

161161
this.$.bind(
162-
'change input'
162+
'change'
163163
, function () {
164164
s.val(s._validate(s.$.val()));
165165
}
@@ -302,6 +302,15 @@
302302
e.originalEvent.touches[s.t].pageX,
303303
e.originalEvent.touches[s.t].pageY
304304
);
305+
306+
if (v == s.cv) return;
307+
308+
if (
309+
s.cH
310+
&& (s.cH(v) === false)
311+
) return;
312+
313+
305314
s.change(s._validate(v));
306315
s._draw();
307316
};
@@ -336,6 +345,13 @@
336345

337346
var mouseMove = function (e) {
338347
var v = s.xy2val(e.pageX, e.pageY);
348+
if (v == s.cv) return;
349+
350+
if (
351+
s.cH
352+
&& (s.cH(v) === false)
353+
) return;
354+
339355
s.change(s._validate(v));
340356
s._draw();
341357
};
@@ -500,13 +516,7 @@
500516

501517
this.val = function (v) {
502518
if (null != v) {
503-
var newValue = this.o.stopper ? max(min(v, this.o.max), this.o.min) : v;
504-
if (newValue == this.cv) return;
505-
this.cv = newValue;
506-
if (
507-
this.cH
508-
&& (this.cH(this.cv) === false)
509-
) return;
519+
this.cv = this.o.stopper ? max(min(v, this.o.max), this.o.min) : v;
510520
this.v = this.cv;
511521
this.$.val(this.v);
512522
this._draw();
@@ -548,6 +558,12 @@
548558
,deltaX = ori.detail || ori.wheelDeltaX
549559
,deltaY = ori.detail || ori.wheelDeltaY
550560
,v = parseInt(s.$.val()) + (deltaX>0 || deltaY>0 ? s.o.step : deltaX<0 || deltaY<0 ? -s.o.step : 0);
561+
562+
if (
563+
s.cH
564+
&& (s.cH(v) === false)
565+
) return;
566+
551567
s.val(v);
552568
}
553569
, kval, to, m = 1, kv = {37:-s.o.step, 38:s.o.step, 39:s.o.step, 40:-s.o.step};
@@ -675,12 +691,7 @@
675691
};
676692

677693
this.change = function (v) {
678-
if (v == this.cv) return;
679694
this.cv = v;
680-
if (
681-
this.cH
682-
&& (this.cH(v) === false)
683-
) return;
684695
this.$.val(v);
685696
};
686697

@@ -746,4 +757,4 @@
746757
).parent();
747758
};
748759

749-
})(jQuery);
760+
})(jQuery);

0 commit comments

Comments
 (0)