[SSE] Gradient Slider: add new color
This commit is contained in:
parent
0b849e76b6
commit
124a457283
|
@ -159,14 +159,16 @@ define([
|
||||||
me.changeSliderStyle();
|
me.changeSliderStyle();
|
||||||
},
|
},
|
||||||
|
|
||||||
addNewThumb: function(index, lastIndex, color) {
|
addNewThumb: function(index, color) {
|
||||||
var me = this;
|
var me = this;
|
||||||
me.thumbs[index].thumb.on('dblclick', null, function() {
|
me.thumbs[index].thumb.on('dblclick', null, function() {
|
||||||
me.trigger('thumbdblclick', me);
|
me.trigger('thumbdblclick', me);
|
||||||
});
|
});
|
||||||
me.thumbs[index].thumbcolor = me.thumbs[index].thumb.find('> div');
|
me.thumbs[index].thumbcolor = me.thumbs[index].thumb.find('> div');
|
||||||
(index>0) && this.setColorValue(this.getColorValue(lastIndex), index);
|
(index>0) && this.setColorValue(color, index);
|
||||||
|
me.sortThumbs();
|
||||||
me.changeSliderStyle();
|
me.changeSliderStyle();
|
||||||
|
me.changeGradientStyle();
|
||||||
},
|
},
|
||||||
|
|
||||||
removeThumb: function(index) {
|
removeThumb: function(index) {
|
||||||
|
|
|
@ -405,21 +405,21 @@ define([
|
||||||
|
|
||||||
var onTrackMouseUp = function (e) {
|
var onTrackMouseUp = function (e) {
|
||||||
if ( me.disabled ) return;
|
if ( me.disabled ) return;
|
||||||
|
if ( me.thumbs.length > 9 ) return;
|
||||||
|
|
||||||
var pos = Math.max(0, Math.min(100, (Math.round((e.pageX*Common.Utils.zoom() - me.cmpEl.offset().left) / me.width * 100)))),
|
var pos = Math.max(0, Math.min(100, (Math.round((e.pageX*Common.Utils.zoom() - me.cmpEl.offset().left) / me.width * 100)))),
|
||||||
lastIndex = findThumb(pos),
|
nearIndex = findThumb(pos),
|
||||||
thumbColor = me.thumbs[lastIndex].colorValue,
|
thumbColor = me.thumbs[nearIndex].colorValue,
|
||||||
lastValue = me.thumbs[lastIndex].value,
|
thumbValue = me.thumbs[nearIndex].value,
|
||||||
value = pos/me.delta + me.minValue;
|
value = pos/me.delta + me.minValue;
|
||||||
me.addThumb();
|
me.addThumb();
|
||||||
var newIndex = me.thumbs.length - 1;
|
var index = me.thumbs.length - 1;
|
||||||
me.setThumbPosition(newIndex, pos);
|
me.setThumbPosition(index, pos);
|
||||||
me.thumbs[newIndex].value = value;
|
me.thumbs[index].value = value;
|
||||||
me.trigger('addthumb', me, newIndex, lastIndex, thumbColor);
|
me.trigger('addthumb', me, index, nearIndex, thumbColor);
|
||||||
|
|
||||||
me.sortThumbs();
|
|
||||||
|
|
||||||
me.trigger('change', me);
|
me.trigger('change', me);
|
||||||
|
me.trigger('changecomplete', me);
|
||||||
};
|
};
|
||||||
|
|
||||||
/*var onTrackMouseDown = function (e) {
|
/*var onTrackMouseDown = function (e) {
|
||||||
|
@ -492,6 +492,7 @@ define([
|
||||||
|
|
||||||
setActiveThumb: function(index, suspend) {
|
setActiveThumb: function(index, suspend) {
|
||||||
this.currentThumb = index;
|
this.currentThumb = index;
|
||||||
|
this.$thumbs = this.cmpEl.find('.thumb');
|
||||||
this.$thumbs.removeClass('active');
|
this.$thumbs.removeClass('active');
|
||||||
this.thumbs[index].thumb.addClass('active');
|
this.thumbs[index].thumb.addClass('active');
|
||||||
if (suspend!==true) this.trigger('thumbclick', this, index);
|
if (suspend!==true) this.trigger('thumbclick', this, index);
|
||||||
|
|
|
@ -895,6 +895,9 @@ define([
|
||||||
me.sldrGradient.setColorValue(Common.Utils.String.format('#{0}', (typeof(me.GradColor.colors[index]) == 'object') ? me.GradColor.colors[index].color : me.GradColor.colors[index]), index);
|
me.sldrGradient.setColorValue(Common.Utils.String.format('#{0}', (typeof(me.GradColor.colors[index]) == 'object') ? me.GradColor.colors[index].color : me.GradColor.colors[index]), index);
|
||||||
me.sldrGradient.setValue(index, me.GradColor.values[index]);
|
me.sldrGradient.setValue(index, me.GradColor.values[index]);
|
||||||
}
|
}
|
||||||
|
if (me.GradColor.currentIdx) {
|
||||||
|
me.sldrGradient.setActiveThumb(me.GradColor.currentIdx);
|
||||||
|
}
|
||||||
this.OriginalFillType = Asc.c_oAscFill.FILL_TYPE_GRAD;
|
this.OriginalFillType = Asc.c_oAscFill.FILL_TYPE_GRAD;
|
||||||
this.FGColor = {Value: 1, Color: this.GradColor.colors[0]};
|
this.FGColor = {Value: 1, Color: this.GradColor.colors[0]};
|
||||||
this.BGColor = {Value: 1, Color: 'ffffff'};
|
this.BGColor = {Value: 1, Color: 'ffffff'};
|
||||||
|
@ -1293,10 +1296,9 @@ define([
|
||||||
me.GradColor.colors = colors;
|
me.GradColor.colors = colors;
|
||||||
me.GradColor.currentIdx = currentIdx;
|
me.GradColor.currentIdx = currentIdx;
|
||||||
});
|
});
|
||||||
this.sldrGradient.on('addthumb', function(cmp, index, lastIndex, color){
|
this.sldrGradient.on('addthumb', function(cmp, index, nearIndex, color){
|
||||||
me.GradColor.currentIdx = index;
|
me.GradColor.colors[index] = me.GradColor.colors[nearIndex];
|
||||||
|
me.sldrGradient.addNewThumb(index, color);
|
||||||
me.sldrGradient.addNewThumb(index, lastIndex, color);
|
|
||||||
});
|
});
|
||||||
this.fillControls.push(this.sldrGradient);
|
this.fillControls.push(this.sldrGradient);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue