diff --git a/slide/apiBuilder.js b/slide/apiBuilder.js index 4df2a761a7..58fd870e27 100644 --- a/slide/apiBuilder.js +++ b/slide/apiBuilder.js @@ -773,14 +773,15 @@ * @see office-js-api/Examples/{Editor}/Api/Methods/CreateShape.js */ Api.prototype.CreateShape = function(sType, nWidth, nHeight, oFill, oStroke){ - var oCurrentSlide = private_GetCurrentSlide(); + let curSlide = private_GetCurrentSlide(); + let presentation = private_GetPresentation(); sType = sType || "rect"; nWidth = nWidth || 914400; nHeight = nHeight || 914400; - oFill = oFill || editor.CreateNoFill(); - oStroke = oStroke || editor.CreateStroke(0, editor.CreateNoFill()); - var oTheme = oCurrentSlide && oCurrentSlide.Layout && oCurrentSlide.Layout.Master && oCurrentSlide.Layout.Master.Theme; - return new ApiShape(AscFormat.builder_CreateShape(sType, nWidth/36000, nHeight/36000, oFill.UniFill, oStroke.Ln, oCurrentSlide, oTheme, private_GetDrawingDocument(), false)); + oFill = oFill || Asc.editor.CreateNoFill(); + oStroke = oStroke || Asc.editor.CreateStroke(0, Asc.editor.CreateNoFill()); + let theme = presentation.Get_Theme(); + return new ApiShape(AscFormat.builder_CreateShape(sType, nWidth/36000, nHeight/36000, oFill.UniFill, oStroke.Ln, curSlide, theme, private_GetDrawingDocument(), false)); }; @@ -1427,10 +1428,46 @@ { if (AscFormat.isRealNumber(nCount) && nCount > 0) { + let curSlide = this.Presentation.CurPage; nCount = Math.min(nCount, this.GetSlidesCount()); for (var nSlide = 0; nSlide < nCount; nSlide++) this.Presentation.removeSlide(nStart); + if (!this.Presentation.IsMasterMode()) + { + if (this.GetSlidesCount() === 0) + { + curSlide = -1; + } + else + { + if (curSlide < nStart) + { + } + else if (curSlide >= nStart + nCount) + { + curSlide -= nCount; + } + else + { + curSlide = nStart - 1; + } + + if (curSlide < 0) + { + curSlide = 0; + } + if (curSlide >= this.GetSlidesCount()) + { + curSlide = this.GetSlidesCount() - 1; + } + } + if (curSlide !== this.Presentation.CurPage) + { + this.Presentation.CurPage = curSlide; + this.Presentation.bGoToPage = true; + } + } return true; } } @@ -3560,12 +3597,12 @@ if (!this.Slide) return false; - let oPresentation = private_GetPresentation(); + let presentation = private_GetApi().GetPresentation(); let nPosToDelete = this.GetSlideIndex(); if (nPosToDelete > -1) { - oPresentation.removeSlide(nPosToDelete); + presentation.RemoveSlides(nPosToDelete, 1); return true; }