Refactoring
This commit is contained in:
parent
ed88e631ab
commit
6f62faf5f3
|
@ -55,11 +55,11 @@ define([
|
||||||
values: [0, 100],
|
values: [0, 100],
|
||||||
colorValues: ['#000000', '#ffffff'],
|
colorValues: ['#000000', '#ffffff'],
|
||||||
currentThumb: 0,
|
currentThumb: 0,
|
||||||
|
includeSnap: true,
|
||||||
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>' +
|
||||||
'</div>',
|
'</div>'
|
||||||
includeSnap: true
|
|
||||||
},
|
},
|
||||||
|
|
||||||
disabled: false,
|
disabled: false,
|
||||||
|
|
|
@ -285,8 +285,8 @@ define([
|
||||||
minValue: 0,
|
minValue: 0,
|
||||||
maxValue: 100,
|
maxValue: 100,
|
||||||
values: [0, 100],
|
values: [0, 100],
|
||||||
thumbTemplate: '<div class="thumb" style=""></div>',
|
includeSnap: false,
|
||||||
includeSnap: false
|
thumbTemplate: '<div class="thumb" style=""></div>'
|
||||||
},
|
},
|
||||||
|
|
||||||
disabled: false,
|
disabled: false,
|
||||||
|
@ -313,6 +313,7 @@ define([
|
||||||
me.minValue = me.options.minValue;
|
me.minValue = me.options.minValue;
|
||||||
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.thumbs = [];
|
me.thumbs = [];
|
||||||
if (me.options.el) {
|
if (me.options.el) {
|
||||||
me.render();
|
me.render();
|
||||||
|
@ -344,7 +345,7 @@ define([
|
||||||
|
|
||||||
var centers = [];
|
var centers = [];
|
||||||
var setCenters = function (index) {
|
var setCenters = function (index) {
|
||||||
if(!me.options.includeSnap) return;
|
if(!me.includeSnap) return;
|
||||||
centers = [50];
|
centers = [50];
|
||||||
var n=0;
|
var n=0;
|
||||||
_.each(me.thumbs, function (thumb, indexT) {
|
_.each(me.thumbs, function (thumb, indexT) {
|
||||||
|
@ -357,6 +358,7 @@ define([
|
||||||
};
|
};
|
||||||
|
|
||||||
var resetPageX = function (e) {
|
var resetPageX = function (e) {
|
||||||
|
if(!me.includeSnap) return;
|
||||||
var x;
|
var x;
|
||||||
_.each(centers, function (cnt){
|
_.each(centers, function (cnt){
|
||||||
x=(0.01 * me.width * cnt + me.cmpEl.offset().left + me._dragstart)/Common.Utils.zoom();
|
x=(0.01 * me.width * cnt + me.cmpEl.offset().left + me._dragstart)/Common.Utils.zoom();
|
||||||
|
@ -370,8 +372,7 @@ define([
|
||||||
var onMouseUp = function (e) {
|
var onMouseUp = function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
resetPageX(e);
|
||||||
if (me.options.includeSnap) resetPageX(e);
|
|
||||||
|
|
||||||
var index = e.data.index,
|
var index = e.data.index,
|
||||||
lastValue = me.thumbs[index].value,
|
lastValue = me.thumbs[index].value,
|
||||||
|
@ -414,7 +415,7 @@ define([
|
||||||
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
if (me.options.includeSnap) resetPageX(e);
|
resetPageX(e);
|
||||||
|
|
||||||
var index = e.data.index,
|
var index = e.data.index,
|
||||||
lastValue = me.thumbs[index].value,
|
lastValue = me.thumbs[index].value,
|
||||||
|
|
Loading…
Reference in a new issue