From fcd12ad2428c6e4ffe9029ac46defa4b85cbfff8 Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Fri, 10 Jul 2020 18:21:45 +0300 Subject: [PATCH] [DE][PE][SSE] Fix gradient position change --- apps/documenteditor/main/app/view/ShapeSettings.js | 12 +++++++++++- apps/documenteditor/main/app/view/TextArtSettings.js | 12 +++++++++++- .../main/app/view/ShapeSettings.js | 12 +++++++++++- .../main/app/view/SlideSettings.js | 12 +++++++++++- .../main/app/view/TextArtSettings.js | 12 +++++++++++- apps/spreadsheeteditor/main/app/view/CellSettings.js | 12 +++++++++++- .../spreadsheeteditor/main/app/view/ShapeSettings.js | 12 +++++++++++- .../main/app/view/TextArtSettings.js | 11 ++++++++++- 8 files changed, 87 insertions(+), 8 deletions(-) diff --git a/apps/documenteditor/main/app/view/ShapeSettings.js b/apps/documenteditor/main/app/view/ShapeSettings.js index d86b105434..33349941d0 100644 --- a/apps/documenteditor/main/app/view/ShapeSettings.js +++ b/apps/documenteditor/main/app/view/ShapeSettings.js @@ -513,6 +513,7 @@ define([ onGradientChange: function(slider, newValue, oldValue){ this.GradColor.values = slider.getValues(); + this.spnGradPosition.setValue(this.GradColor.values[this.GradColor.currentIdx], true); this._sliderChanged = true; if (this.api && !this._noApply) { if (this._sendUndoPoint) { @@ -1856,7 +1857,10 @@ define([ }, onPositionChange: function(btn) { - var pos = btn.getNumberValue(); + var pos = btn.getNumberValue(), + minValue = (this.GradColor.currentIdx-1<0) ? 0 : this.GradColor.values[this.GradColor.currentIdx-1], + maxValue = (this.GradColor.currentIdx+1 maxValue; if (this.api) { this.GradColor.values[this.GradColor.currentIdx] = pos; var props = new Asc.asc_CShapeProperty(); @@ -1872,6 +1876,12 @@ define([ props.asc_putFill(fill); this.imgprops.put_ShapeProperties(props); this.api.ImgApply(this.imgprops); + + if (needSort) { + this.sldrGradient.sortThumbs(); + this.sldrGradient.trigger('change', this.sldrGradient); + this.sldrGradient.trigger('changecomplete', this.sldrGradient); + } } }, diff --git a/apps/documenteditor/main/app/view/TextArtSettings.js b/apps/documenteditor/main/app/view/TextArtSettings.js index e6b03bcbbe..853a168867 100644 --- a/apps/documenteditor/main/app/view/TextArtSettings.js +++ b/apps/documenteditor/main/app/view/TextArtSettings.js @@ -378,6 +378,7 @@ define([ onGradientChange: function(slider, newValue, oldValue){ this.GradColor.values = slider.getValues(); + this.spnGradPosition.setValue(this.GradColor.values[this.GradColor.currentIdx], true); this._sliderChanged = true; if (this.api && !this._noApply) { if (this._sendUndoPoint) { @@ -1190,7 +1191,10 @@ define([ }, onPositionChange: function(btn) { - var pos = btn.getNumberValue(); + var pos = btn.getNumberValue(), + minValue = (this.GradColor.currentIdx-1<0) ? 0 : this.GradColor.values[this.GradColor.currentIdx-1], + maxValue = (this.GradColor.currentIdx+1 maxValue; if (this.api) { this.GradColor.values[this.GradColor.currentIdx] = pos; var props = new Asc.asc_TextArtProperties(); @@ -1206,6 +1210,12 @@ define([ props.asc_putFill(fill); this.shapeprops.put_TextArtProperties(props); this.api.ImgApply(this.imgprops); + + if (needSort) { + this.sldrGradient.sortThumbs(); + this.sldrGradient.trigger('change', this.sldrGradient); + this.sldrGradient.trigger('changecomplete', this.sldrGradient); + } } }, diff --git a/apps/presentationeditor/main/app/view/ShapeSettings.js b/apps/presentationeditor/main/app/view/ShapeSettings.js index b5d58f9dd7..d0f90602ac 100644 --- a/apps/presentationeditor/main/app/view/ShapeSettings.js +++ b/apps/presentationeditor/main/app/view/ShapeSettings.js @@ -494,6 +494,7 @@ define([ onGradientChange: function(slider, newValue, oldValue){ this.GradColor.values = slider.getValues(); + this.spnGradPosition.setValue(this.GradColor.values[this.GradColor.currentIdx], true); this._sliderChanged = true; if (this.api && !this._noApply) { if (this._sendUndoPoint) { @@ -1728,7 +1729,10 @@ define([ }, onPositionChange: function(btn) { - var pos = btn.getNumberValue(); + var pos = btn.getNumberValue(), + minValue = (this.GradColor.currentIdx-1<0) ? 0 : this.GradColor.values[this.GradColor.currentIdx-1], + maxValue = (this.GradColor.currentIdx+1 maxValue; if (this.api) { this.GradColor.values[this.GradColor.currentIdx] = pos; var props = new Asc.asc_CShapeProperty(); @@ -1743,6 +1747,12 @@ define([ fill.get_fill().put_positions(arr); props.put_fill(fill); this.api.ShapeApply(props); + + if (needSort) { + this.sldrGradient.sortThumbs(); + this.sldrGradient.trigger('change', this.sldrGradient); + this.sldrGradient.trigger('changecomplete', this.sldrGradient); + } } }, diff --git a/apps/presentationeditor/main/app/view/SlideSettings.js b/apps/presentationeditor/main/app/view/SlideSettings.js index e2aa20265c..ba1a31eed5 100644 --- a/apps/presentationeditor/main/app/view/SlideSettings.js +++ b/apps/presentationeditor/main/app/view/SlideSettings.js @@ -595,6 +595,7 @@ define([ onGradientChange: function(slider, newValue, oldValue){ this.GradColor.values = slider.getValues(); + this.spnGradPosition.setValue(this.GradColor.values[this.GradColor.currentIdx], true); this._sliderChanged = true; if (this.api && !this._noApply) { if (this._sendUndoPoint) { @@ -1528,7 +1529,10 @@ define([ }, onPositionChange: function(btn) { - var pos = btn.getNumberValue(); + var pos = btn.getNumberValue(), + minValue = (this.GradColor.currentIdx-1<0) ? 0 : this.GradColor.values[this.GradColor.currentIdx-1], + maxValue = (this.GradColor.currentIdx+1 maxValue; if (this.api) { this.GradColor.values[this.GradColor.currentIdx] = pos; var props = new Asc.CAscSlideProps(); @@ -1543,6 +1547,12 @@ define([ fill.get_fill().put_positions(arr); props.put_background(fill); this.api.SetSlideProps(props); + + if (needSort) { + this.sldrGradient.sortThumbs(); + this.sldrGradient.trigger('change', this.sldrGradient); + this.sldrGradient.trigger('changecomplete', this.sldrGradient); + } } }, diff --git a/apps/presentationeditor/main/app/view/TextArtSettings.js b/apps/presentationeditor/main/app/view/TextArtSettings.js index 54750c87b5..be2c498072 100644 --- a/apps/presentationeditor/main/app/view/TextArtSettings.js +++ b/apps/presentationeditor/main/app/view/TextArtSettings.js @@ -498,6 +498,7 @@ define([ onGradientChange: function(slider, newValue, oldValue){ this.GradColor.values = slider.getValues(); + this.spnGradPosition.setValue(this.GradColor.values[this.GradColor.currentIdx], true); this._sliderChanged = true; if (this.api && !this._noApply) { if (this._sendUndoPoint) { @@ -1621,7 +1622,10 @@ define([ }, onPositionChange: function(btn) { - var pos = btn.getNumberValue(); + var pos = btn.getNumberValue(), + minValue = (this.GradColor.currentIdx-1<0) ? 0 : this.GradColor.values[this.GradColor.currentIdx-1], + maxValue = (this.GradColor.currentIdx+1 maxValue; if (this.api) { this.GradColor.values[this.GradColor.currentIdx] = pos; var props = new Asc.asc_TextArtProperties(); @@ -1637,6 +1641,12 @@ define([ props.asc_putFill(fill); this.shapeprops.put_TextArtProperties(props); this.api.ShapeApply(this.shapeprops); + + if (needSort) { + this.sldrGradient.sortThumbs(); + this.sldrGradient.trigger('change', this.sldrGradient); + this.sldrGradient.trigger('changecomplete', this.sldrGradient); + } } }, diff --git a/apps/spreadsheeteditor/main/app/view/CellSettings.js b/apps/spreadsheeteditor/main/app/view/CellSettings.js index 206f923495..998627e17c 100644 --- a/apps/spreadsheeteditor/main/app/view/CellSettings.js +++ b/apps/spreadsheeteditor/main/app/view/CellSettings.js @@ -1111,6 +1111,7 @@ define([ onGradientChange: function(slider, newValue, oldValue) { this.GradColor.values = slider.getValues(); + this.spnGradPosition.setValue(this.GradColor.values[this.GradColor.currentIdx], true); this._sliderChanged = true; if (this.api && !this._noApply) { if (this._sendUndoPoint) { @@ -1212,7 +1213,10 @@ define([ onPositionChange: function(btn) { var me = this, - pos = btn.getNumberValue(); + pos = btn.getNumberValue(), + minValue = (this.GradColor.currentIdx-1<0) ? 0 : this.GradColor.values[this.GradColor.currentIdx-1], + maxValue = (this.GradColor.currentIdx+1 maxValue; if (this.api) { this.GradColor.values[this.GradColor.currentIdx] = pos; if (this.gradient == null) { @@ -1230,6 +1234,12 @@ define([ this.fill.asc_setGradientFill(this.gradient); this.api.asc_setCellFill(this.fill); + + if (needSort) { + this.sldrGradient.sortThumbs(); + this.sldrGradient.trigger('change', this.sldrGradient); + this.sldrGradient.trigger('changecomplete', this.sldrGradient); + } } }, diff --git a/apps/spreadsheeteditor/main/app/view/ShapeSettings.js b/apps/spreadsheeteditor/main/app/view/ShapeSettings.js index 045dfe57e0..75822f0fd6 100644 --- a/apps/spreadsheeteditor/main/app/view/ShapeSettings.js +++ b/apps/spreadsheeteditor/main/app/view/ShapeSettings.js @@ -509,6 +509,7 @@ define([ onGradientChange: function(slider, newValue, oldValue){ this.GradColor.values = slider.getValues(); + this.spnGradPosition.setValue(this.GradColor.values[this.GradColor.currentIdx], true); this._sliderChanged = true; if (this.api && !this._noApply) { if (this._sendUndoPoint) { @@ -1758,7 +1759,10 @@ define([ }, onPositionChange: function(btn) { - var pos = btn.getNumberValue(); + var pos = btn.getNumberValue(), + minValue = (this.GradColor.currentIdx-1<0) ? 0 : this.GradColor.values[this.GradColor.currentIdx-1], + maxValue = (this.GradColor.currentIdx+1 maxValue; if (this.api) { this.GradColor.values[this.GradColor.currentIdx] = pos; var props = new Asc.asc_CShapeProperty(); @@ -1774,6 +1778,12 @@ define([ props.asc_putFill(fill); this.imgprops.asc_putShapeProperties(props); this.api.asc_setGraphicObjectProps(this.imgprops); + + if (needSort) { + this.sldrGradient.sortThumbs(); + this.sldrGradient.trigger('change', this.sldrGradient); + this.sldrGradient.trigger('changecomplete', this.sldrGradient); + } } }, diff --git a/apps/spreadsheeteditor/main/app/view/TextArtSettings.js b/apps/spreadsheeteditor/main/app/view/TextArtSettings.js index cb59f693b6..dd00417c20 100644 --- a/apps/spreadsheeteditor/main/app/view/TextArtSettings.js +++ b/apps/spreadsheeteditor/main/app/view/TextArtSettings.js @@ -499,6 +499,7 @@ define([ onGradientChange: function(slider, newValue, oldValue){ this.GradColor.values = slider.getValues(); + this.spnGradPosition.setValue(this.GradColor.values[this.GradColor.currentIdx], true); this._sliderChanged = true; if (this.api && !this._noApply) { if (this._sendUndoPoint) { @@ -1625,7 +1626,10 @@ define([ }, onPositionChange: function(btn) { - var pos = btn.getNumberValue(); + var pos = btn.getNumberValue(), + minValue = (this.GradColor.currentIdx-1<0) ? 0 : this.GradColor.values[this.GradColor.currentIdx-1], + maxValue = (this.GradColor.currentIdx+1 maxValue; if (this.api) { this.GradColor.values[this.GradColor.currentIdx] = pos; var props = new Asc.asc_TextArtProperties(); @@ -1641,6 +1645,11 @@ define([ props.asc_putFill(fill); this.shapeprops.put_TextArtProperties(props); this.api.asc_setGraphicObjectProps(this.imgprops); + if (needSort) { + this.sldrGradient.sortThumbs(); + this.sldrGradient.trigger('change', this.sldrGradient); + this.sldrGradient.trigger('changecomplete', this.sldrGradient); + } } },