[SSE] Gradient Slider: add new color
This commit is contained in:
parent
0b849e76b6
commit
124a457283
|
@ -159,14 +159,16 @@ define([
|
|||
me.changeSliderStyle();
|
||||
},
|
||||
|
||||
addNewThumb: function(index, lastIndex, color) {
|
||||
addNewThumb: function(index, color) {
|
||||
var me = this;
|
||||
me.thumbs[index].thumb.on('dblclick', null, function() {
|
||||
me.trigger('thumbdblclick', me);
|
||||
});
|
||||
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.changeGradientStyle();
|
||||
},
|
||||
|
||||
removeThumb: function(index) {
|
||||
|
|
|
@ -405,21 +405,21 @@ define([
|
|||
|
||||
var onTrackMouseUp = function (e) {
|
||||
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)))),
|
||||
lastIndex = findThumb(pos),
|
||||
thumbColor = me.thumbs[lastIndex].colorValue,
|
||||
lastValue = me.thumbs[lastIndex].value,
|
||||
nearIndex = findThumb(pos),
|
||||
thumbColor = me.thumbs[nearIndex].colorValue,
|
||||
thumbValue = me.thumbs[nearIndex].value,
|
||||
value = pos/me.delta + me.minValue;
|
||||
me.addThumb();
|
||||
var newIndex = me.thumbs.length - 1;
|
||||
me.setThumbPosition(newIndex, pos);
|
||||
me.thumbs[newIndex].value = value;
|
||||
me.trigger('addthumb', me, newIndex, lastIndex, thumbColor);
|
||||
|
||||
me.sortThumbs();
|
||||
var index = me.thumbs.length - 1;
|
||||
me.setThumbPosition(index, pos);
|
||||
me.thumbs[index].value = value;
|
||||
me.trigger('addthumb', me, index, nearIndex, thumbColor);
|
||||
|
||||
me.trigger('change', me);
|
||||
me.trigger('changecomplete', me);
|
||||
};
|
||||
|
||||
/*var onTrackMouseDown = function (e) {
|
||||
|
@ -492,6 +492,7 @@ define([
|
|||
|
||||
setActiveThumb: function(index, suspend) {
|
||||
this.currentThumb = index;
|
||||
this.$thumbs = this.cmpEl.find('.thumb');
|
||||
this.$thumbs.removeClass('active');
|
||||
this.thumbs[index].thumb.addClass('active');
|
||||
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.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.FGColor = {Value: 1, Color: this.GradColor.colors[0]};
|
||||
this.BGColor = {Value: 1, Color: 'ffffff'};
|
||||
|
@ -1293,10 +1296,9 @@ define([
|
|||
me.GradColor.colors = colors;
|
||||
me.GradColor.currentIdx = currentIdx;
|
||||
});
|
||||
this.sldrGradient.on('addthumb', function(cmp, index, lastIndex, color){
|
||||
me.GradColor.currentIdx = index;
|
||||
|
||||
me.sldrGradient.addNewThumb(index, lastIndex, color);
|
||||
this.sldrGradient.on('addthumb', function(cmp, index, nearIndex, color){
|
||||
me.GradColor.colors[index] = me.GradColor.colors[nearIndex];
|
||||
me.sldrGradient.addNewThumb(index, color);
|
||||
});
|
||||
this.fillControls.push(this.sldrGradient);
|
||||
|
||||
|
|
Loading…
Reference in a new issue