Fix Bug 55735

This commit is contained in:
Julia Radzhabova 2022-02-24 15:42:21 +03:00
parent 7f3feb26c9
commit 84854bc475
5 changed files with 95 additions and 62 deletions

View file

@ -129,7 +129,7 @@ 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 = 90 ; this.typeGradient = 90 ;
this.render(); this.render();
}, },
@ -468,9 +468,13 @@ define([
rawData = record; rawData = record;
} }
this.typeGradient = rawData.type + 90; if (this.GradFillType === Asc.c_oAscFillGradType.GRAD_LINEAR) {
this.GradLinearDirectionType = rawData.type;
(this.GradFillType == Asc.c_oAscFillGradType.GRAD_LINEAR) ? this.GradLinearDirectionType = rawData.type : this.GradRadialDirectionIdx = 0; this.typeGradient = rawData.type + 90;
} else {
this.GradRadialDirectionIdx = 0;
this.typeGradient = rawData.type;
}
if (this.api) { if (this.api) {
if (this.GradFillType == Asc.c_oAscFillGradType.GRAD_LINEAR) { if (this.GradFillType == Asc.c_oAscFillGradType.GRAD_LINEAR) {
this.numGradientAngle.setValue(rawData.type, true); this.numGradientAngle.setValue(rawData.type, true);
@ -1223,13 +1227,13 @@ define([
btnDirectionRedraw: function(slider, gradientColorsStr) { btnDirectionRedraw: function(slider, gradientColorsStr) {
this.gradientColorsStr = gradientColorsStr; this.gradientColorsStr = gradientColorsStr;
if (this.mnuDirectionPicker.dataViewItems.length == 1) _.each(this._viewDataLinear, function(item){
this.mnuDirectionPicker.dataViewItems[0].$el.children(0).css({'background': 'radial-gradient(' + gradientColorsStr + ')'}); item.gradientColorsStr = gradientColorsStr;
else });
this.mnuDirectionPicker.dataViewItems.forEach(function (item) { this._viewDataRadial.gradientColorsStr = this.gradientColorsStr;
var type = item.model.get('type') + 90; this.mnuDirectionPicker.store.each(function(item){
item.$el.children(0).css({'background': 'linear-gradient(' + type + 'deg, ' + gradientColorsStr + ')'}); item.set('gradientColorsStr', gradientColorsStr);
}); }, this);
if (this.typeGradient == -1) if (this.typeGradient == -1)
this.btnDirection.$icon.css({'background': 'none'}); this.btnDirection.$icon.css({'background': 'none'});
@ -1397,9 +1401,12 @@ define([
{ type:270, subtype:3}, { type:270, subtype:3},
{ type:225, subtype:7} { type:225, subtype:7}
]; ];
_.each(this._viewDataLinear, function(item){
item.gradientColorsStr = me.gradientColorsStr;
});
this._viewDataRadial = [ this._viewDataRadial = [
{ type:2, subtype:5} { type:2, subtype:5, gradientColorsStr: this.gradientColorsStr}
]; ];
this.btnDirection = new Common.UI.Button({ this.btnDirection = new Common.UI.Button({
@ -1424,8 +1431,8 @@ define([
allowScrollbar: false, allowScrollbar: false,
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,<%= gradientColorsStr %>)'
+' <%} else {%> radial-gradient( #000 , #fff 70%) <%}%>;"></div>') +' <%} else {%> radial-gradient(<%= gradientColorsStr %>) <%}%>;"></div>')
}); });
}); });
this.btnDirection.render($('#shape-button-direction')); this.btnDirection.render($('#shape-button-direction'));

View file

@ -448,8 +448,13 @@ define([
rawData = record; rawData = record;
} }
this.typeGradient = rawData.type + 90; if (this.GradFillType === Asc.c_oAscFillGradType.GRAD_LINEAR) {
(this.GradFillType == Asc.c_oAscFillGradType.GRAD_LINEAR) ? this.GradLinearDirectionType = rawData.type : this.GradRadialDirectionIdx = 0; this.GradLinearDirectionType = rawData.type;
this.typeGradient = rawData.type + 90;
} else {
this.GradRadialDirectionIdx = 0;
this.typeGradient = rawData.type;
}
if (this.api) { if (this.api) {
if (this.GradFillType == Asc.c_oAscFillGradType.GRAD_LINEAR) { if (this.GradFillType == Asc.c_oAscFillGradType.GRAD_LINEAR) {
this.numGradientAngle.setValue(rawData.type, true); this.numGradientAngle.setValue(rawData.type, true);
@ -536,13 +541,13 @@ define([
btnDirectionRedraw: function(slider, gradientColorsStr) { btnDirectionRedraw: function(slider, gradientColorsStr) {
this.gradientColorsStr = gradientColorsStr; this.gradientColorsStr = gradientColorsStr;
if (this.mnuDirectionPicker.dataViewItems.length == 1) _.each(this._viewDataLinear, function(item){
this.mnuDirectionPicker.dataViewItems[0].$el.children(0).css({'background': 'radial-gradient(' + gradientColorsStr + ')'}); item.gradientColorsStr = gradientColorsStr;
else });
this.mnuDirectionPicker.dataViewItems.forEach(function (item) { this._viewDataRadial.gradientColorsStr = this.gradientColorsStr;
var type = item.model.get('type') + 90; this.mnuDirectionPicker.store.each(function(item){
item.$el.children(0).css({'background': 'linear-gradient(' + type + 'deg, ' + gradientColorsStr + ')'}); item.set('gradientColorsStr', gradientColorsStr);
}); }, this);
if (this.typeGradient == -1) if (this.typeGradient == -1)
this.btnDirection.$icon.css({'background': 'none'}); this.btnDirection.$icon.css({'background': 'none'});
@ -1302,9 +1307,12 @@ define([
{ type:270, subtype:3}, { type:270, subtype:3},
{ type:225, subtype:7} { type:225, subtype:7}
]; ];
_.each(this._viewDataLinear, function(item){
item.gradientColorsStr = me.gradientColorsStr;
});
this._viewDataRadial = [ this._viewDataRadial = [
{ type:2, subtype:5} { type:2, subtype:5, gradientColorsStr: this.gradientColorsStr}
]; ];
this.btnDirection = new Common.UI.Button({ this.btnDirection = new Common.UI.Button({
@ -1328,8 +1336,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, ' + me.gradientColorsStr + ' )' +'<% if(type!=2) {%>linear-gradient(<%= type + 90 %>deg,<%= gradientColorsStr %>)'
+' <%} else {%> radial-gradient( ' + me.gradientColorsStr + ' 70%) <%}%>;"></div>') +' <%} else {%> radial-gradient(<%= gradientColorsStr %>) <%}%>;"></div>')
}); });
}); });
this.btnDirection.render($('#shape-button-direction')); this.btnDirection.render($('#shape-button-direction'));

View file

@ -110,7 +110,7 @@ define([
this.textureNames = [this.txtCanvas, this.txtCarton, this.txtDarkFabric, this.txtGrain, this.txtGranite, this.txtGreyPaper, this.textureNames = [this.txtCanvas, this.txtCarton, this.txtDarkFabric, this.txtGrain, this.txtGranite, this.txtGreyPaper,
this.txtKnit, this.txtLeather, this.txtBrownPaper, this.txtPapyrus, this.txtWood]; this.txtKnit, this.txtLeather, this.txtBrownPaper, this.txtPapyrus, this.txtWood];
this.gradientColorsStr=""; this.gradientColorsStr="#000, #fff";
this.typeGradient = 90; this.typeGradient = 90;
this.render(); this.render();
@ -519,8 +519,13 @@ define([
rawData = record; rawData = record;
} }
this.typeGradient = rawData.type + 90; if (this.GradFillType === Asc.c_oAscFillGradType.GRAD_LINEAR) {
(this.GradFillType == Asc.c_oAscFillGradType.GRAD_LINEAR) ? this.GradLinearDirectionType = rawData.type : this.GradRadialDirectionIdx = 0; this.GradLinearDirectionType = rawData.type;
this.typeGradient = rawData.type + 90;
} else {
this.GradRadialDirectionIdx = 0;
this.typeGradient = rawData.type;
}
if (this.api) { if (this.api) {
if (this.GradFillType == Asc.c_oAscFillGradType.GRAD_LINEAR) { if (this.GradFillType == Asc.c_oAscFillGradType.GRAD_LINEAR) {
this.numGradientAngle.setValue(rawData.type, true); this.numGradientAngle.setValue(rawData.type, true);
@ -607,13 +612,13 @@ define([
btnDirectionRedraw: function(slider, gradientColorsStr) { btnDirectionRedraw: function(slider, gradientColorsStr) {
this.gradientColorsStr = gradientColorsStr; this.gradientColorsStr = gradientColorsStr;
if (this.mnuDirectionPicker.dataViewItems.length == 1) _.each(this._viewDataLinear, function(item){
this.mnuDirectionPicker.dataViewItems[0].$el.children(0).css({'background': 'radial-gradient(' + gradientColorsStr + ')'}); item.gradientColorsStr = gradientColorsStr;
else });
this.mnuDirectionPicker.dataViewItems.forEach(function (item) { this._viewDataRadial.gradientColorsStr = this.gradientColorsStr;
var type = item.model.get('type') + 90; this.mnuDirectionPicker.store.each(function(item){
item.$el.children(0).css({'background': 'linear-gradient(' + type + 'deg, ' + gradientColorsStr + ')'}); item.set('gradientColorsStr', gradientColorsStr);
}); }, this);
if (this.typeGradient == -1) if (this.typeGradient == -1)
this.btnDirection.$icon.css({'background': 'none'}); this.btnDirection.$icon.css({'background': 'none'});
@ -799,9 +804,12 @@ define([
{ type:270, subtype:3}, { type:270, subtype:3},
{ type:225, subtype:7} { type:225, subtype:7}
]; ];
_.each(this._viewDataLinear, function(item){
item.gradientColorsStr = me.gradientColorsStr;
});
this._viewDataRadial = [ this._viewDataRadial = [
{ type:2, subtype:5} { type:2, subtype:5, gradientColorsStr: this.gradientColorsStr}
]; ];
this.btnDirection = new Common.UI.Button({ this.btnDirection = new Common.UI.Button({
@ -825,8 +833,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,<%= gradientColorsStr %>)'
+' <%} else {%> radial-gradient( #000 , #fff 70%) <%}%>;"></div>') +' <%} else {%> radial-gradient(<%= gradientColorsStr %>) <%}%>;"></div>')
}); });
}); });
this.btnDirection.render($('#slide-button-direction')); this.btnDirection.render($('#slide-button-direction'));

View file

@ -92,7 +92,7 @@ define([
this.GradColor = { values: [0, 100], colors: ['000000', 'ffffff'], currentIdx: 0}; this.GradColor = { values: [0, 100], colors: ['000000', 'ffffff'], currentIdx: 0};
this.fillControls = []; this.fillControls = [];
this.gradientColorsStr=""; this.gradientColorsStr="#000, #fff";
this.typeGradient = 90; this.typeGradient = 90;
this.render(); this.render();
@ -242,6 +242,9 @@ define([
{ offsetx: 50, offsety: 100, type:270, subtype:3}, { offsetx: 50, offsety: 100, type:270, subtype:3},
{ offsetx: 100, offsety: 100, type:225, subtype:7} { offsetx: 100, offsety: 100, type:225, subtype:7}
]; ];
_.each(this._viewDataLinear, function(item){
item.gradientColorsStr = me.gradientColorsStr;
});
this.btnDirection = new Common.UI.Button({ this.btnDirection = new Common.UI.Button({
cls : 'btn-large-dataview', cls : 'btn-large-dataview',
@ -263,7 +266,8 @@ define([
parentMenu: btn.menu, parentMenu: btn.menu,
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" ></div>') itemTemplate: _.template('<div id="<%= id %>" class="item-gradient" style="background: '
+'linear-gradient(<%= type + 90 %>deg,<%= gradientColorsStr %>);"></div>')
}); });
}); });
this.btnDirection.render($('#cell-button-direction')); this.btnDirection.render($('#cell-button-direction'));
@ -1080,15 +1084,13 @@ define([
}, },
btnDirectionRedraw: function(slider, gradientColorsStr) { btnDirectionRedraw: function(slider, gradientColorsStr) {
this.gradientColorsStr = gradientColorsStr; this.gradientColorsStr = gradientColorsStr;
if (this.mnuDirectionPicker.dataViewItems.length == 1) _.each(this._viewDataLinear, function(item){
this.mnuDirectionPicker.dataViewItems[0].$el.children(0).css({'background': 'radial-gradient(' + gradientColorsStr + ')'}); item.gradientColorsStr = gradientColorsStr;
else });
this.mnuDirectionPicker.dataViewItems.forEach(function (item) { this.mnuDirectionPicker.store.each(function(item){
var type = item.model.get('type') + 90; item.set('gradientColorsStr', gradientColorsStr);
item.$el.children(0).css({'background': 'linear-gradient(' + type + 'deg, ' + gradientColorsStr + ')'}); }, this);
});
if (this.typeGradient == -1) if (this.typeGradient == -1)
this.btnDirection.$icon.css({'background': 'none'}); this.btnDirection.$icon.css({'background': 'none'});

View file

@ -124,7 +124,7 @@ 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 = 90; this.typeGradient = 90;
this.render(); this.render();
@ -461,8 +461,13 @@ define([
rawData = record; rawData = record;
} }
this.typeGradient = rawData.type + 90; if (this.GradFillType === Asc.c_oAscFillGradType.GRAD_LINEAR) {
(this.GradFillType == Asc.c_oAscFillGradType.GRAD_LINEAR) ? this.GradLinearDirectionType = rawData.type : this.GradRadialDirectionIdx = 0; this.GradLinearDirectionType = rawData.type;
this.typeGradient = rawData.type + 90;
} else {
this.GradRadialDirectionIdx = 0;
this.typeGradient = rawData.type;
}
if (this.api) { if (this.api) {
if (this.GradFillType == Asc.c_oAscFillGradType.GRAD_LINEAR) { if (this.GradFillType == Asc.c_oAscFillGradType.GRAD_LINEAR) {
this.numGradientAngle.setValue(rawData.type, true); this.numGradientAngle.setValue(rawData.type, true);
@ -1144,13 +1149,13 @@ define([
btnDirectionRedraw: function(slider, gradientColorsStr) { btnDirectionRedraw: function(slider, gradientColorsStr) {
this.gradientColorsStr = gradientColorsStr; this.gradientColorsStr = gradientColorsStr;
if (this.mnuDirectionPicker.dataViewItems.length == 1) _.each(this._viewDataLinear, function(item){
this.mnuDirectionPicker.dataViewItems[0].$el.children(0).css({'background': 'radial-gradient(' + gradientColorsStr + ')'}); item.gradientColorsStr = gradientColorsStr;
else });
this.mnuDirectionPicker.dataViewItems.forEach(function (item) { this._viewDataRadial.gradientColorsStr = this.gradientColorsStr;
var type = item.model.get('type') + 90; this.mnuDirectionPicker.store.each(function(item){
item.$el.children(0).css({'background': 'linear-gradient(' + type + 'deg, ' + gradientColorsStr + ')'}); item.set('gradientColorsStr', gradientColorsStr);
}); }, this);
if (this.typeGradient == -1) if (this.typeGradient == -1)
this.btnDirection.$icon.css({'background': 'none'}); this.btnDirection.$icon.css({'background': 'none'});
@ -1318,9 +1323,12 @@ define([
{ type:270, subtype:3}, { type:270, subtype:3},
{ type:225, subtype:7} { type:225, subtype:7}
]; ];
_.each(this._viewDataLinear, function(item){
item.gradientColorsStr = me.gradientColorsStr;
});
this._viewDataRadial = [ this._viewDataRadial = [
{ type:2, subtype:5} { type:2, subtype:5, gradientColorsStr: this.gradientColorsStr}
]; ];
this.btnDirection = new Common.UI.Button({ this.btnDirection = new Common.UI.Button({
@ -1344,8 +1352,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,<%= gradientColorsStr %>)'
+' <%} else {%> radial-gradient( #000 , #fff 70%) <%}%>;"></div>') +' <%} else {%> radial-gradient(<%= gradientColorsStr %>) <%}%>;"></div>')
}); });
}); });
this.btnDirection.render($('#shape-button-direction')); this.btnDirection.render($('#shape-button-direction'));