Gradient Slider - refactoring.
This commit is contained in:
parent
4a408e0d3a
commit
4ffa3c5a92
|
|
@ -153,13 +153,13 @@ define([
|
|||
},
|
||||
|
||||
sortThumbs: function() {
|
||||
var recalc_indexes = Common.UI.MultiSlider.prototype.sortThumbs.call(this);
|
||||
var colors = [],
|
||||
var recalc_indexes = Common.UI.MultiSlider.prototype.sortThumbs.call(this),
|
||||
new_colors = [],
|
||||
me = this;
|
||||
_.each (this.colorValues, function(color, index) {
|
||||
colors[index] = me.colorValues[recalc_indexes[index]];
|
||||
_.each (recalc_indexes, function(recalc_index) {
|
||||
new_colors.push(me.colorValues[recalc_index]);
|
||||
});
|
||||
this.colorValues = colors;
|
||||
this.colorValues = new_colors;
|
||||
this.trigger('sortthumbs', me, recalc_indexes);
|
||||
return recalc_indexes;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -503,15 +503,11 @@ define([
|
|||
|
||||
sortThumbs: function() {
|
||||
this.thumbs.sort(function(a, b) {
|
||||
if (a.position < b.position)
|
||||
return -1;
|
||||
if (a.position > b.position)
|
||||
return 1;
|
||||
return 0;
|
||||
return (a.position - b.position);
|
||||
});
|
||||
var recalc_indexes = [];
|
||||
_.each (this.thumbs, function(thumb, index) {
|
||||
recalc_indexes[index] = thumb.index;
|
||||
recalc_indexes.push(thumb.index);
|
||||
thumb.index = index;
|
||||
});
|
||||
return recalc_indexes;
|
||||
|
|
|
|||
|
|
@ -1341,12 +1341,12 @@ define([
|
|||
this.sldrGradient.on('thumbdblclick', function(cmp){
|
||||
me.btnGradColor.cmpEl.find('button').dropdown('toggle');
|
||||
});
|
||||
this.sldrGradient.on('sortthumbs', function(cmp, indexes){
|
||||
this.sldrGradient.on('sortthumbs', function(cmp, recalc_indexes){
|
||||
var colors = [],
|
||||
currentIdx;
|
||||
_.each (me.GradColor.colors, function(color, index) {
|
||||
colors[index] = me.GradColor.colors[indexes[index]];
|
||||
if (me.GradColor.currentIdx == indexes[index])
|
||||
_.each (recalc_indexes, function(recalc_index, index) {
|
||||
colors.push(me.GradColor.colors[recalc_index]);
|
||||
if (me.GradColor.currentIdx == recalc_index)
|
||||
currentIdx = index;
|
||||
});
|
||||
me.OriginalFillType = null;
|
||||
|
|
|
|||
|
|
@ -916,12 +916,12 @@ define([
|
|||
this.sldrGradient.on('thumbdblclick', function(cmp){
|
||||
me.btnGradColor.cmpEl.find('button').dropdown('toggle');
|
||||
});
|
||||
this.sldrGradient.on('sortthumbs', function(cmp, indexes){
|
||||
this.sldrGradient.on('sortthumbs', function(cmp, recalc_indexes){
|
||||
var colors = [],
|
||||
currentIdx;
|
||||
_.each (me.GradColor.colors, function(color, index) {
|
||||
colors[index] = me.GradColor.colors[indexes[index]];
|
||||
if (me.GradColor.currentIdx == indexes[index])
|
||||
_.each (recalc_indexes, function(recalc_index, index) {
|
||||
colors.push(me.GradColor.colors[recalc_index]);
|
||||
if (me.GradColor.currentIdx == recalc_index)
|
||||
currentIdx = index;
|
||||
});
|
||||
me.OriginalFillType = null;
|
||||
|
|
|
|||
|
|
@ -1234,12 +1234,12 @@ define([
|
|||
this.sldrGradient.on('thumbdblclick', function(cmp){
|
||||
me.btnGradColor.cmpEl.find('button').dropdown('toggle');
|
||||
});
|
||||
this.sldrGradient.on('sortthumbs', function(cmp, indexes){
|
||||
this.sldrGradient.on('sortthumbs', function(cmp, recalc_indexes){
|
||||
var colors = [],
|
||||
currentIdx;
|
||||
_.each (me.GradColor.colors, function(color, index) {
|
||||
colors[index] = me.GradColor.colors[indexes[index]];
|
||||
if (me.GradColor.currentIdx == indexes[index])
|
||||
_.each (recalc_indexes, function(recalc_index, index) {
|
||||
colors.push(me.GradColor.colors[recalc_index]);
|
||||
if (me.GradColor.currentIdx == recalc_index)
|
||||
currentIdx = index;
|
||||
});
|
||||
me.OriginalFillType = null;
|
||||
|
|
|
|||
|
|
@ -755,12 +755,12 @@ define([
|
|||
this.sldrGradient.on('thumbdblclick', function(cmp){
|
||||
me.btnGradColor.cmpEl.find('button').dropdown('toggle');
|
||||
});
|
||||
this.sldrGradient.on('sortthumbs', function(cmp, indexes){
|
||||
this.sldrGradient.on('sortthumbs', function(cmp, recalc_indexes){
|
||||
var colors = [],
|
||||
currentIdx;
|
||||
_.each (me.GradColor.colors, function(color, index) {
|
||||
colors[index] = me.GradColor.colors[indexes[index]];
|
||||
if (me.GradColor.currentIdx == indexes[index])
|
||||
_.each (recalc_indexes, function(recalc_index, index) {
|
||||
colors.push(me.GradColor.colors[recalc_index]);
|
||||
if (me.GradColor.currentIdx == recalc_index)
|
||||
currentIdx = index;
|
||||
});
|
||||
me.OriginalFillType = null;
|
||||
|
|
|
|||
|
|
@ -1224,12 +1224,12 @@ define([
|
|||
this.sldrGradient.on('thumbdblclick', function(cmp){
|
||||
me.btnGradColor.cmpEl.find('button').dropdown('toggle');
|
||||
});
|
||||
this.sldrGradient.on('sortthumbs', function(cmp, indexes){
|
||||
this.sldrGradient.on('sortthumbs', function(cmp, recalc_indexes){
|
||||
var colors = [],
|
||||
currentIdx;
|
||||
_.each (me.GradColor.colors, function(color, index) {
|
||||
colors[index] = me.GradColor.colors[indexes[index]];
|
||||
if (me.GradColor.currentIdx == indexes[index])
|
||||
_.each (recalc_indexes, function(recalc_index, index) {
|
||||
colors.push(me.GradColor.colors[recalc_index]);
|
||||
if (me.GradColor.currentIdx == recalc_index)
|
||||
currentIdx = index;
|
||||
});
|
||||
me.OriginalFillType = null;
|
||||
|
|
|
|||
|
|
@ -1258,12 +1258,12 @@ define([
|
|||
this.sldrGradient.on('thumbdblclick', function(cmp){
|
||||
me.btnGradColor.cmpEl.find('button').dropdown('toggle');
|
||||
});
|
||||
this.sldrGradient.on('sortthumbs', function(cmp, indexes){
|
||||
this.sldrGradient.on('sortthumbs', function(cmp, recalc_indexes){
|
||||
var colors = [],
|
||||
currentIdx;
|
||||
_.each (me.GradColor.colors, function(color, index) {
|
||||
colors[index] = me.GradColor.colors[indexes[index]];
|
||||
if (me.GradColor.currentIdx == indexes[index])
|
||||
_.each (recalc_indexes, function(recalc_index, index) {
|
||||
colors.push(me.GradColor.colors[recalc_index]);
|
||||
if (me.GradColor.currentIdx == recalc_index)
|
||||
currentIdx = index;
|
||||
});
|
||||
me.OriginalFillType = null;
|
||||
|
|
|
|||
|
|
@ -1228,12 +1228,12 @@ define([
|
|||
this.sldrGradient.on('thumbdblclick', function(cmp){
|
||||
me.btnGradColor.cmpEl.find('button').dropdown('toggle');
|
||||
});
|
||||
this.sldrGradient.on('sortthumbs', function(cmp, indexes){
|
||||
this.sldrGradient.on('sortthumbs', function(cmp, recalc_indexes){
|
||||
var colors = [],
|
||||
currentIdx;
|
||||
_.each (me.GradColor.colors, function(color, index) {
|
||||
colors[index] = me.GradColor.colors[indexes[index]];
|
||||
if (me.GradColor.currentIdx == indexes[index])
|
||||
_.each (recalc_indexes, function(recalc_index, index) {
|
||||
colors.push(me.GradColor.colors[recalc_index]);
|
||||
if (me.GradColor.currentIdx == recalc_index)
|
||||
currentIdx = index;
|
||||
});
|
||||
me.OriginalFillType = null;
|
||||
|
|
|
|||
Loading…
Reference in a new issue