Skip to content

Commit

Permalink
[bug] fix multiple loading smartArt binary file.
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeyLuzyanin committed Sep 20, 2023
1 parent 4f4a309 commit 4f4e0a5
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions common/Charts/charts.js
Original file line number Diff line number Diff line change
Expand Up @@ -685,34 +685,44 @@ ChartPreviewManager.prototype.getChartPreviews = function(chartType, arrId, bEmp
this.index = 0;
this.cache = {};
this.queue = [];
this.typeOfSectionLoad = null;
}
SmartArtPreviewDrawer.prototype = Object.create(AscCommon.CActionOnTimerBase.prototype);
SmartArtPreviewDrawer.prototype.constructor = SmartArtPreviewDrawer;

SmartArtPreviewDrawer.prototype.Begin = function (nTypeOfSectionLoad) {

let oThis = this;
const oApi = Asc.editor || editor;
if(!oApi) {
return;
}

let oThis = this;
let fCallback = function (){
if (AscCommon.g_oBinarySmartArts) {
if (AscFormat.isRealNumber(nTypeOfSectionLoad)) {
const arrPreviewObjects = Asc.c_oAscSmartArtSections[nTypeOfSectionLoad].map(function (nTypeOfSmartArt) {
return new CSmartArtPreviewInfo(nTypeOfSmartArt, nTypeOfSectionLoad);
if (AscFormat.isRealNumber(oThis.typeOfSectionLoad)) {
const arrPreviewObjects = Asc.c_oAscSmartArtSections[oThis.typeOfSectionLoad].map(function (nTypeOfSmartArt) {
return new CSmartArtPreviewInfo(nTypeOfSmartArt, oThis.typeOfSectionLoad);
});
oThis.queue = oThis.queue.concat(arrPreviewObjects);
AscCommon.CActionOnTimerBase.prototype.Begin.call(oThis);
}
}
};
if(!AscCommon.g_oBinarySmartArts) {
AscCommon.loadSmartArtBinary(fCallback, function (err) {
});

if(AscCommon.g_oBinarySmartArts) {
this.typeOfSectionLoad = nTypeOfSectionLoad;
fCallback();
}
else {
fCallback();
if(this.typeOfSectionLoad === null) {
this.typeOfSectionLoad = nTypeOfSectionLoad;
AscCommon.loadSmartArtBinary(fCallback, function (err) {
});
}
else {
this.typeOfSectionLoad = nTypeOfSectionLoad;
}
}
};
SmartArtPreviewDrawer.prototype.OnBegin = function () {
Expand Down

0 comments on commit 4f4e0a5

Please sign in to comment.