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