Bug 52187

This commit is contained in:
OVSharova 2021-10-02 01:20:52 +03:00
parent 3b2d55b6d5
commit 5f4345679d
6 changed files with 76 additions and 49 deletions

View file

@ -316,6 +316,7 @@ define([
me.delta = 100/(me.maxValue - me.minValue); me.delta = 100/(me.maxValue - me.minValue);
me.includeSnap = me.options.includeSnap; me.includeSnap = me.options.includeSnap;
me.intervalSnap = me.options.intervalSnap; me.intervalSnap = me.options.intervalSnap;
me.mouseFree = true;
me.thumbs = []; me.thumbs = [];
if (me.options.el) { if (me.options.el) {
me.render(); me.render();
@ -404,7 +405,7 @@ define([
$(document).off('mouseup', me.binding.onMouseUp); $(document).off('mouseup', me.binding.onMouseUp);
$(document).off('mousemove', me.binding.onMouseMove); $(document).off('mousemove', me.binding.onMouseMove);
me.mouseFree = true;
me._dragstart = undefined; me._dragstart = undefined;
!me.isRemoveThumb && me.trigger('changecomplete', me, value, lastValue); !me.isRemoveThumb && me.trigger('changecomplete', me, value, lastValue);
me.isRemoveThumb = undefined; me.isRemoveThumb = undefined;
@ -443,7 +444,7 @@ define([
var onMouseDown = function (e) { var onMouseDown = function (e) {
if ( me.disabled ) return; if ( me.disabled ) return;
me.mouseFree = false;
var index = e.data.index, var index = e.data.index,
thumb = me.thumbs[index].thumb; thumb = me.thumbs[index].thumb;

View file

@ -127,7 +127,7 @@ define([
this.fillControls = []; this.fillControls = [];
this.gradientColorsStr=""; this.gradientColorsStr="";
this.typeGradient = 0 ; this.typeGradient = 90 ;
this.render(); this.render();
}, },

View file

@ -121,8 +121,8 @@ define([
this.txtKnit, this.txtLeather, this.txtBrownPaper, this.txtPapyrus, this.txtWood]; this.txtKnit, this.txtLeather, this.txtBrownPaper, this.txtPapyrus, this.txtWood];
this.fillControls = []; this.fillControls = [];
this.gradientColorsStr=""; this.gradientColorsStr = "#000, #fff";
this.typeGradient = 0 ; this.typeGradient = 90 ;
this.render(); this.render();
@ -520,9 +520,39 @@ define([
this.api.setEndPointHistory(); this.api.setEndPointHistory();
this._gradientApplyFunc(); this._gradientApplyFunc();
} }
var arrGrCollors=[];
var scale=(this.GradFillType == Asc.c_oAscFillGradType.GRAD_LINEAR)?1:0.7;
for (var index=0; index < slider.thumbs.length; index++) {
arrGrCollors.push(slider.getColorValue(index)+ ' '+ slider.getValue(index)*scale +'%');
}
this.btnDirectionRedraw(slider, arrGrCollors.join(', '));
this._sendUndoPoint = true; this._sendUndoPoint = true;
}, },
btnDirectionRedraw: function(slider, gradientColorsStr) {
if(!slider.mouseFree) return;
this.gradientColorsStr = gradientColorsStr;
if (this.mnuDirectionPicker.dataViewItems.length == 1)
this.mnuDirectionPicker.dataViewItems[0].$el.children(0).css({'background': 'radial-gradient(' + gradientColorsStr + ')'});
else
this.mnuDirectionPicker.dataViewItems.forEach(function (item) {
var type = item.options.model.attributes.type + 90;
item.$el.children(0).css({'background': 'linear-gradient(' + type + 'deg, ' + gradientColorsStr + ')'});
});
if (this.typeGradient == -1)
this.btnDirection.$icon.css({'background': 'none'});
else if (this.typeGradient == 2)
this.btnDirection.$icon.css({'background': ('radial-gradient(' + gradientColorsStr + ')')});
else
this.btnDirection.$icon.css({
'background': ('linear-gradient(' + this.typeGradient + 'deg, ' + gradientColorsStr + ')')
});
},
_gradientApplyFunc: function() { _gradientApplyFunc: function() {
if (this._sliderChanged) { if (this._sliderChanged) {
var props = new Asc.asc_CShapeProperty(); var props = new Asc.asc_CShapeProperty();
@ -900,25 +930,7 @@ define([
arrGrCollors.push(me.sldrGradient.getColorValue(index)+ ' '+ me.sldrGradient.getValue(index)*scale +'%'); arrGrCollors.push(me.sldrGradient.getColorValue(index)+ ' '+ me.sldrGradient.getValue(index)*scale +'%');
} }
me.gradientColorsStr= arrGrCollors.join(', '); this.btnDirectionRedraw(me.sldrGradient, arrGrCollors.join(', '));
if (me.gradientColorsStr != "") {
if(me.mnuDirectionPicker.dataViewItems.length==1)
me.mnuDirectionPicker.dataViewItems[0].$el.children(0).css({'background': 'radial-gradient(' + me.gradientColorsStr + ')'});
else
me.mnuDirectionPicker.dataViewItems.forEach(function (item){
var type = item.options.model.attributes.type+90;
item.$el.children(0).css({'background': 'linear-gradient('+ type + 'deg, '+ me.gradientColorsStr + ')'});
});
if(this.typeGradient == -1)
this.btnDirection.$icon.css({'background': 'none'});
else if(this.typeGradient==2)
this.btnDirection.$icon.css({'background': ('radial-gradient(' + me.gradientColorsStr + ')')});
else
this.btnDirection.$icon.css({
'background': ('linear-gradient(' + this.typeGradient + 'deg, ' + me.gradientColorsStr + ')')
});
}
if (_.isUndefined(me.GradColor.currentIdx) || me.GradColor.currentIdx >= this.GradColor.colors.length) { if (_.isUndefined(me.GradColor.currentIdx) || me.GradColor.currentIdx >= this.GradColor.colors.length) {
me.GradColor.currentIdx = 0; me.GradColor.currentIdx = 0;
@ -1312,8 +1324,8 @@ define([
restoreHeight: 174, restoreHeight: 174,
store: new Common.UI.DataViewStore(me._viewDataLinear), store: new Common.UI.DataViewStore(me._viewDataLinear),
itemTemplate: _.template('<div id="<%= id %>" class="item-gradient" style="background: ' itemTemplate: _.template('<div id="<%= id %>" class="item-gradient" style="background: '
+'<% if(type!=2) {%>linear-gradient(<%= type + 90 %>deg,#000, #fff)' +'<% if(type!=2) {%>linear-gradient(<%= type + 90 %>deg, ' + me.gradientColorsStr + ' )'
+' <%} else {%> radial-gradient( #000 , #fff 70%) <%}%>;"></div>') +' <%} else {%> radial-gradient( ' + me.gradientColorsStr + ' 70%) <%}%>;"></div>')
}); });
}); });
this.btnDirection.render($('#shape-button-direction')); this.btnDirection.render($('#shape-button-direction'));

View file

@ -111,7 +111,7 @@ define([
this.txtKnit, this.txtLeather, this.txtBrownPaper, this.txtPapyrus, this.txtWood]; this.txtKnit, this.txtLeather, this.txtBrownPaper, this.txtPapyrus, this.txtWood];
this.gradientColorsStr=""; this.gradientColorsStr="";
this.typeGradient = 0 ; this.typeGradient = 90;
this.render(); this.render();
@ -594,9 +594,41 @@ define([
this.api.setEndPointHistory(); this.api.setEndPointHistory();
this._gradientApplyFunc(); this._gradientApplyFunc();
} }
var arrGrCollors=[];
var scale=(this.GradFillType == Asc.c_oAscFillGradType.GRAD_LINEAR)?1:0.7;
for (var index=0; index < slider.thumbs.length; index++) {
arrGrCollors.push(slider.getColorValue(index)+ ' '+ slider.getValue(index)*scale +'%');
}
this.btnDirectionRedraw(slider, arrGrCollors.join(', '));
this._sendUndoPoint = true; this._sendUndoPoint = true;
}, },
btnDirectionRedraw: function(slider, gradientColorsStr) {
if(!slider.mouseFree) return;
this.gradientColorsStr = gradientColorsStr;
if (this.mnuDirectionPicker.dataViewItems.length == 1)
this.mnuDirectionPicker.dataViewItems[0].$el.children(0).css({'background': 'radial-gradient(' + gradientColorsStr + ')'});
else
this.mnuDirectionPicker.dataViewItems.forEach(function (item) {
var type = item.options.model.attributes.type + 90;
item.$el.children(0).css({'background': 'linear-gradient(' + type + 'deg, ' + gradientColorsStr + ')'});
});
if (this.typeGradient == -1)
this.btnDirection.$icon.css({'background': 'none'});
else if (this.typeGradient == 2)
this.btnDirection.$icon.css({'background': ('radial-gradient(' + gradientColorsStr + ')')});
else
this.btnDirection.$icon.css({
'background': ('linear-gradient(' + this.typeGradient + 'deg, ' + gradientColorsStr + ')')
});
},
_gradientApplyFunc: function() { _gradientApplyFunc: function() {
if (this._sliderChanged) { if (this._sliderChanged) {
var props = new Asc.CAscSlideProps(); var props = new Asc.CAscSlideProps();
@ -1251,26 +1283,8 @@ define([
me.sldrGradient.setValue(index, me.GradColor.values[index]); me.sldrGradient.setValue(index, me.GradColor.values[index]);
arrGrCollors.push(me.sldrGradient.getColorValue(index)+ ' '+ me.sldrGradient.getValue(index)*scale +'%'); arrGrCollors.push(me.sldrGradient.getColorValue(index)+ ' '+ me.sldrGradient.getValue(index)*scale +'%');
} }
this.btnDirectionRedraw(me.sldrGradient, arrGrCollors.join(', '));
me.gradientColorsStr= arrGrCollors.join(', ');
if (me.gradientColorsStr != "") {
if(me.mnuDirectionPicker.dataViewItems.length==1)
me.mnuDirectionPicker.dataViewItems[0].$el.children(0).css({'background': 'radial-gradient(' + me.gradientColorsStr + ')'});
else
me.mnuDirectionPicker.dataViewItems.forEach(function (item){
var type = item.options.model.attributes.type+90;
item.$el.children(0).css({'background': 'linear-gradient('+ type + 'deg, '+ me.gradientColorsStr + ')'});
});
if(this.typeGradient == -1)
this.btnDirection.$icon.css({'background': 'none'});
else if(this.typeGradient == 2)
this.btnDirection.$icon.css({'background': ('radial-gradient(' + me.gradientColorsStr + ')')});
else
this.btnDirection.$icon.css({
'background': ('linear-gradient(' + this.typeGradient + 'deg, ' + me.gradientColorsStr + ')')
});
}
if (_.isUndefined(me.GradColor.currentIdx) || me.GradColor.currentIdx >= this.GradColor.colors.length) { if (_.isUndefined(me.GradColor.currentIdx) || me.GradColor.currentIdx >= this.GradColor.colors.length) {
me.GradColor.currentIdx = 0; me.GradColor.currentIdx = 0;
} }

View file

@ -92,7 +92,7 @@ define([
this.fillControls = []; this.fillControls = [];
this.gradientColorsStr=""; this.gradientColorsStr="";
this.typeGradient = 0; this.typeGradient = 90;
this.render(); this.render();
this.createDelayedControls(); this.createDelayedControls();

View file

@ -123,7 +123,7 @@ define([
this.fillControls = []; this.fillControls = [];
this.gradientColorsStr=""; this.gradientColorsStr="";
this.typeGradient = 0; this.typeGradient = 90;
this.render(); this.render();