From a40911c55cf1df23732dce190ba9644635c0a5a4 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 18 Apr 2024 17:00:16 +0300 Subject: [PATCH] Apply first texture when filling shape/slide/textart --- apps/documenteditor/main/app/view/ShapeSettings.js | 13 ++++++++++++- apps/pdfeditor/main/app/view/ShapeSettings.js | 12 +++++++++++- apps/pdfeditor/main/app/view/TextArtSettings.js | 13 ++++++++++++- .../main/app/view/ShapeSettings.js | 12 +++++++++++- .../main/app/view/SlideSettings.js | 12 +++++++++++- .../main/app/view/TextArtSettings.js | 13 ++++++++++++- .../main/app/view/ShapeSettings.js | 13 ++++++++++++- .../main/app/view/TextArtSettings.js | 13 ++++++++++++- 8 files changed, 93 insertions(+), 8 deletions(-) diff --git a/apps/documenteditor/main/app/view/ShapeSettings.js b/apps/documenteditor/main/app/view/ShapeSettings.js index 6aaab84e82..65bc50bd73 100644 --- a/apps/documenteditor/main/app/view/ShapeSettings.js +++ b/apps/documenteditor/main/app/view/ShapeSettings.js @@ -226,7 +226,18 @@ define([ } break; case Asc.c_oAscFill.FILL_TYPE_BLIP: - this._state.FillType = Asc.c_oAscFill.FILL_TYPE_BLIP; + if (this._state.FillType !== Asc.c_oAscFill.FILL_TYPE_BLIP && !this._noApply && this._texturearray && this._texturearray.length>0) { + this._state.FillType = Asc.c_oAscFill.FILL_TYPE_BLIP + var props = new Asc.asc_CShapeProperty(); + var fill = new Asc.asc_CShapeFill(); + fill.put_type(Asc.c_oAscFill.FILL_TYPE_BLIP); + fill.put_fill( new Asc.asc_CFillBlip()); + fill.get_fill().put_type(Asc.c_oAscFillBlipType.TILE); + fill.get_fill().put_texture_id(this._texturearray[0].type); + props.put_fill(fill); + this.imgprops.put_ShapeProperties(props); + this.api.ImgApply(this.imgprops); + } break; case Asc.c_oAscFill.FILL_TYPE_PATT: this._state.FillType = Asc.c_oAscFill.FILL_TYPE_PATT; diff --git a/apps/pdfeditor/main/app/view/ShapeSettings.js b/apps/pdfeditor/main/app/view/ShapeSettings.js index e75738db08..8e493d93aa 100644 --- a/apps/pdfeditor/main/app/view/ShapeSettings.js +++ b/apps/pdfeditor/main/app/view/ShapeSettings.js @@ -214,7 +214,17 @@ define([ } break; case Asc.c_oAscFill.FILL_TYPE_BLIP: - this._state.FillType = Asc.c_oAscFill.FILL_TYPE_BLIP; + if (this._state.FillType !== Asc.c_oAscFill.FILL_TYPE_BLIP && !this._noApply && this._texturearray && this._texturearray.length>0) { + this._state.FillType = Asc.c_oAscFill.FILL_TYPE_BLIP + var props = new Asc.asc_CShapeProperty(); + var fill = new Asc.asc_CShapeFill(); + fill.put_type(Asc.c_oAscFill.FILL_TYPE_BLIP); + fill.put_fill( new Asc.asc_CFillBlip()); + fill.get_fill().put_type(Asc.c_oAscFillBlipType.TILE); + fill.get_fill().put_texture_id(this._texturearray[0].type); + props.put_fill(fill); + this.api.ShapeApply(props); + } break; case Asc.c_oAscFill.FILL_TYPE_PATT: this._state.FillType = Asc.c_oAscFill.FILL_TYPE_PATT; diff --git a/apps/pdfeditor/main/app/view/TextArtSettings.js b/apps/pdfeditor/main/app/view/TextArtSettings.js index f49a361620..40d84cdb82 100644 --- a/apps/pdfeditor/main/app/view/TextArtSettings.js +++ b/apps/pdfeditor/main/app/view/TextArtSettings.js @@ -202,7 +202,18 @@ define([ } break; case Asc.c_oAscFill.FILL_TYPE_BLIP: - this._state.FillType = Asc.c_oAscFill.FILL_TYPE_BLIP; + if (this._state.FillType !== Asc.c_oAscFill.FILL_TYPE_BLIP && !this._noApply && this._texturearray && this._texturearray.length>0) { + this._state.FillType = Asc.c_oAscFill.FILL_TYPE_BLIP + var props = new Asc.asc_TextArtProperties(); + var fill = new Asc.asc_CShapeFill(); + fill.put_type(Asc.c_oAscFill.FILL_TYPE_BLIP); + fill.put_fill( new Asc.asc_CFillBlip()); + fill.get_fill().put_type(Asc.c_oAscFillBlipType.TILE); + fill.get_fill().put_texture_id(this._texturearray[0].type); + props.asc_putFill(fill); + this.shapeprops.put_TextArtProperties(props); + this.api.ShapeApply(this.shapeprops); + } break; case Asc.c_oAscFill.FILL_TYPE_PATT: this._state.FillType = Asc.c_oAscFill.FILL_TYPE_PATT; diff --git a/apps/presentationeditor/main/app/view/ShapeSettings.js b/apps/presentationeditor/main/app/view/ShapeSettings.js index 60eb0c5fbb..5302a10bbe 100644 --- a/apps/presentationeditor/main/app/view/ShapeSettings.js +++ b/apps/presentationeditor/main/app/view/ShapeSettings.js @@ -214,7 +214,17 @@ define([ } break; case Asc.c_oAscFill.FILL_TYPE_BLIP: - this._state.FillType = Asc.c_oAscFill.FILL_TYPE_BLIP; + if (this._state.FillType !== Asc.c_oAscFill.FILL_TYPE_BLIP && !this._noApply && this._texturearray && this._texturearray.length>0) { + this._state.FillType = Asc.c_oAscFill.FILL_TYPE_BLIP + var props = new Asc.asc_CShapeProperty(); + var fill = new Asc.asc_CShapeFill(); + fill.put_type(Asc.c_oAscFill.FILL_TYPE_BLIP); + fill.put_fill( new Asc.asc_CFillBlip()); + fill.get_fill().put_type(Asc.c_oAscFillBlipType.TILE); + fill.get_fill().put_texture_id(this._texturearray[0].type); + props.put_fill(fill); + this.api.ShapeApply(props); + } break; case Asc.c_oAscFill.FILL_TYPE_PATT: this._state.FillType = Asc.c_oAscFill.FILL_TYPE_PATT; diff --git a/apps/presentationeditor/main/app/view/SlideSettings.js b/apps/presentationeditor/main/app/view/SlideSettings.js index af640fa383..73fc431c4b 100644 --- a/apps/presentationeditor/main/app/view/SlideSettings.js +++ b/apps/presentationeditor/main/app/view/SlideSettings.js @@ -313,7 +313,17 @@ define([ } break; case Asc.c_oAscFill.FILL_TYPE_BLIP: - this._state.FillType = Asc.c_oAscFill.FILL_TYPE_BLIP; + if (this._state.FillType !== Asc.c_oAscFill.FILL_TYPE_BLIP && !this._noApply && this._texturearray && this._texturearray.length>0) { + this._state.FillType = Asc.c_oAscFill.FILL_TYPE_BLIP + var props = new Asc.CAscSlideProps(); + var fill = new Asc.asc_CShapeFill(); + fill.put_type(Asc.c_oAscFill.FILL_TYPE_BLIP); + fill.put_fill( new Asc.asc_CFillBlip()); + fill.get_fill().put_type(Asc.c_oAscFillBlipType.TILE); + fill.get_fill().put_texture_id(this._texturearray[0].type); + props.put_background(fill); + this.api.SetSlideProps(props); + } break; case Asc.c_oAscFill.FILL_TYPE_PATT: this._state.FillType = Asc.c_oAscFill.FILL_TYPE_PATT; diff --git a/apps/presentationeditor/main/app/view/TextArtSettings.js b/apps/presentationeditor/main/app/view/TextArtSettings.js index 5ebae663a3..255402a918 100644 --- a/apps/presentationeditor/main/app/view/TextArtSettings.js +++ b/apps/presentationeditor/main/app/view/TextArtSettings.js @@ -202,7 +202,18 @@ define([ } break; case Asc.c_oAscFill.FILL_TYPE_BLIP: - this._state.FillType = Asc.c_oAscFill.FILL_TYPE_BLIP; + if (this._state.FillType !== Asc.c_oAscFill.FILL_TYPE_BLIP && !this._noApply && this._texturearray && this._texturearray.length>0) { + this._state.FillType = Asc.c_oAscFill.FILL_TYPE_BLIP + var props = new Asc.asc_TextArtProperties(); + var fill = new Asc.asc_CShapeFill(); + fill.put_type(Asc.c_oAscFill.FILL_TYPE_BLIP); + fill.put_fill( new Asc.asc_CFillBlip()); + fill.get_fill().put_type(Asc.c_oAscFillBlipType.TILE); + fill.get_fill().put_texture_id(this._texturearray[0].type); + props.asc_putFill(fill); + this.shapeprops.put_TextArtProperties(props); + this.api.ShapeApply(this.shapeprops); + } break; case Asc.c_oAscFill.FILL_TYPE_PATT: this._state.FillType = Asc.c_oAscFill.FILL_TYPE_PATT; diff --git a/apps/spreadsheeteditor/main/app/view/ShapeSettings.js b/apps/spreadsheeteditor/main/app/view/ShapeSettings.js index ac9d1a6692..2ac1536d57 100644 --- a/apps/spreadsheeteditor/main/app/view/ShapeSettings.js +++ b/apps/spreadsheeteditor/main/app/view/ShapeSettings.js @@ -217,7 +217,18 @@ define([ } break; case Asc.c_oAscFill.FILL_TYPE_BLIP: - this._state.FillType = Asc.c_oAscFill.FILL_TYPE_BLIP; + if (this._state.FillType !== Asc.c_oAscFill.FILL_TYPE_BLIP && !this._noApply && this._texturearray && this._texturearray.length>0) { + this._state.FillType = Asc.c_oAscFill.FILL_TYPE_BLIP + var props = new Asc.asc_CShapeProperty(); + var fill = new Asc.asc_CShapeFill(); + fill.asc_putType(Asc.c_oAscFill.FILL_TYPE_BLIP); + fill.asc_putFill( new Asc.asc_CFillBlip()); + fill.asc_getFill().asc_putType(Asc.c_oAscFillBlipType.TILE); + fill.asc_getFill().asc_putTextureId(this._texturearray[0].type); + props.asc_putFill(fill); + this.imgprops.asc_putShapeProperties(props); + this.api.asc_setGraphicObjectProps(this.imgprops); + } break; case Asc.c_oAscFill.FILL_TYPE_PATT: this._state.FillType = Asc.c_oAscFill.FILL_TYPE_PATT; diff --git a/apps/spreadsheeteditor/main/app/view/TextArtSettings.js b/apps/spreadsheeteditor/main/app/view/TextArtSettings.js index 112c2f8b01..ba0aff6844 100644 --- a/apps/spreadsheeteditor/main/app/view/TextArtSettings.js +++ b/apps/spreadsheeteditor/main/app/view/TextArtSettings.js @@ -203,7 +203,18 @@ define([ } break; case Asc.c_oAscFill.FILL_TYPE_BLIP: - this._state.FillType = Asc.c_oAscFill.FILL_TYPE_BLIP; + if (this._state.FillType !== Asc.c_oAscFill.FILL_TYPE_BLIP && !this._noApply && this._texturearray && this._texturearray.length>0) { + this._state.FillType = Asc.c_oAscFill.FILL_TYPE_BLIP + var props = new Asc.asc_TextArtProperties(); + var fill = new Asc.asc_CShapeFill(); + fill.asc_putType(Asc.c_oAscFill.FILL_TYPE_BLIP); + fill.asc_putFill( new Asc.asc_CFillBlip()); + fill.asc_getFill().asc_putType(Asc.c_oAscFillBlipType.TILE); + fill.asc_getFill().asc_putTextureId(this._texturearray[0].type); + props.asc_putFill(fill); + this.shapeprops.put_TextArtProperties(props); + this.api.asc_setGraphicObjectProps(this.imgprops); + } break; case Asc.c_oAscFill.FILL_TYPE_PATT: this._state.FillType = Asc.c_oAscFill.FILL_TYPE_PATT;