Add intervalSnap
This commit is contained in:
parent
45a3afb1ca
commit
5de89888bc
|
@ -56,6 +56,7 @@ define([
|
||||||
colorValues: ['#000000', '#ffffff'],
|
colorValues: ['#000000', '#ffffff'],
|
||||||
currentThumb: 0,
|
currentThumb: 0,
|
||||||
includeSnap: true,
|
includeSnap: true,
|
||||||
|
intervalSnap: 5,
|
||||||
thumbTemplate: '<div class="thumb" style="">' +
|
thumbTemplate: '<div class="thumb" style="">' +
|
||||||
'<div class="thumb-top"><div class="thumb-top-inner"></div></div>' +
|
'<div class="thumb-top"><div class="thumb-top-inner"></div></div>' +
|
||||||
'<div class="thumb-bottom"><div class="thumb-bottom-inner"></div></div>' +
|
'<div class="thumb-bottom"><div class="thumb-bottom-inner"></div></div>' +
|
||||||
|
|
|
@ -286,6 +286,7 @@ define([
|
||||||
maxValue: 100,
|
maxValue: 100,
|
||||||
values: [0, 100],
|
values: [0, 100],
|
||||||
includeSnap: false,
|
includeSnap: false,
|
||||||
|
intervalSnap: undefined,
|
||||||
thumbTemplate: '<div class="thumb" style=""></div>'
|
thumbTemplate: '<div class="thumb" style=""></div>'
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -314,6 +315,7 @@ define([
|
||||||
me.maxValue = me.options.maxValue;
|
me.maxValue = me.options.maxValue;
|
||||||
me.delta = 100/(me.maxValue - me.minValue);
|
me.delta = 100/(me.maxValue - me.minValue);
|
||||||
me.includeSnap = me.options.includeSnap;
|
me.includeSnap = me.options.includeSnap;
|
||||||
|
me.intervalSnap = me.options.intervalSnap;
|
||||||
me.thumbs = [];
|
me.thumbs = [];
|
||||||
if (me.options.el) {
|
if (me.options.el) {
|
||||||
me.render();
|
me.render();
|
||||||
|
@ -364,7 +366,7 @@ define([
|
||||||
var resetPageX = function (e) {
|
var resetPageX = function (e) {
|
||||||
if(!me.includeSnap) return;
|
if(!me.includeSnap) return;
|
||||||
_.each(me.centers, function (x) {
|
_.each(me.centers, function (x) {
|
||||||
if((e.pageX <= x + 10) && (e.pageX >= x - 10)) {
|
if((e.pageX <= x + me.intervalSnap) && (e.pageX >= x - me.intervalSnap)) {
|
||||||
e.pageX = x;
|
e.pageX = x;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue