mirror of
https://github.com/ONLYOFFICE/sdkjs.git
synced 2026-02-10 18:15:19 +08:00
fix slide deleting
This commit is contained in:
@ -773,14 +773,15 @@
|
|||||||
* @see office-js-api/Examples/{Editor}/Api/Methods/CreateShape.js
|
* @see office-js-api/Examples/{Editor}/Api/Methods/CreateShape.js
|
||||||
*/
|
*/
|
||||||
Api.prototype.CreateShape = function(sType, nWidth, nHeight, oFill, oStroke){
|
Api.prototype.CreateShape = function(sType, nWidth, nHeight, oFill, oStroke){
|
||||||
var oCurrentSlide = private_GetCurrentSlide();
|
let curSlide = private_GetCurrentSlide();
|
||||||
|
let presentation = private_GetPresentation();
|
||||||
sType = sType || "rect";
|
sType = sType || "rect";
|
||||||
nWidth = nWidth || 914400;
|
nWidth = nWidth || 914400;
|
||||||
nHeight = nHeight || 914400;
|
nHeight = nHeight || 914400;
|
||||||
oFill = oFill || editor.CreateNoFill();
|
oFill = oFill || Asc.editor.CreateNoFill();
|
||||||
oStroke = oStroke || editor.CreateStroke(0, editor.CreateNoFill());
|
oStroke = oStroke || Asc.editor.CreateStroke(0, Asc.editor.CreateNoFill());
|
||||||
var oTheme = oCurrentSlide && oCurrentSlide.Layout && oCurrentSlide.Layout.Master && oCurrentSlide.Layout.Master.Theme;
|
let theme = presentation.Get_Theme();
|
||||||
return new ApiShape(AscFormat.builder_CreateShape(sType, nWidth/36000, nHeight/36000, oFill.UniFill, oStroke.Ln, oCurrentSlide, oTheme, private_GetDrawingDocument(), false));
|
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)
|
if (AscFormat.isRealNumber(nCount) && nCount > 0)
|
||||||
{
|
{
|
||||||
|
let curSlide = this.Presentation.CurPage;
|
||||||
nCount = Math.min(nCount, this.GetSlidesCount());
|
nCount = Math.min(nCount, this.GetSlidesCount());
|
||||||
for (var nSlide = 0; nSlide < nCount; nSlide++)
|
for (var nSlide = 0; nSlide < nCount; nSlide++)
|
||||||
this.Presentation.removeSlide(nStart);
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3560,12 +3597,12 @@
|
|||||||
if (!this.Slide)
|
if (!this.Slide)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
let oPresentation = private_GetPresentation();
|
let presentation = private_GetApi().GetPresentation();
|
||||||
let nPosToDelete = this.GetSlideIndex();
|
let nPosToDelete = this.GetSlideIndex();
|
||||||
|
|
||||||
if (nPosToDelete > -1)
|
if (nPosToDelete > -1)
|
||||||
{
|
{
|
||||||
oPresentation.removeSlide(nPosToDelete);
|
presentation.RemoveSlides(nPosToDelete, 1);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user