Commit 82638d8f authored by Oleg Korshul's avatar Oleg Korshul

.

parent ef5dc3ed
...@@ -438,8 +438,10 @@ ...@@ -438,8 +438,10 @@
this.bIsLoadDocumentImagesNoByOrder = true; this.bIsLoadDocumentImagesNoByOrder = true;
this.nNoByOrderCounter = 0; this.nNoByOrderCounter = 0;
this.loadFontCallBack = null; this.loadImageCallBackCounter = 0;
this.loadFontCallBackArgs = null; this.loadImageCallBackCounterMax = 0;
this.loadImageCallBack = null;
this.loadImageCallBackArgs = null;
var oThis = this; var oThis = this;
...@@ -620,37 +622,63 @@ ...@@ -620,37 +622,63 @@
oImage.Image.src = oImage.src; oImage.Image.src = oImage.src;
}; };
this.LoadImageWithCallback = function(src, loadFontCallBack, loadFontCallBackArgs) this.LoadImagesWithCallback = function(arr, loadImageCallBack, loadImageCallBackArgs)
{ {
if (this.map_image_index[src]) var arrAsync = [];
var i = 0;
for (i = 0; i < arr.length; i++)
{ {
loadFontCallBack.call(this.Api, loadFontCallBackArgs); if (this.map_image_index[arr[i]] === undefined)
arrAsync.push(arr[i]);
}
if (arrAsync.length == 0)
{
loadImageCallBack.call(this.Api, loadImageCallBackArgs);
return; return;
} }
this.loadFontCallBack = loadFontCallBack; this.loadImageCallBackCounter = 0;
this.loadFontCallBackArgs = loadFontCallBackArgs; this.loadImageCallBackCounterMax = arrAsync.length;
this.loadImageCallBack = loadImageCallBack;
this.loadImageCallBackArgs = loadImageCallBackArgs;
var oImage = new CImage(src); for (i = 0; i < arrAsync.length; i++)
{
var oImage = new CImage(arrAsync[i]);
oImage.Image = new Image(); oImage.Image = new Image();
oImage.Image.parentImage = oImage;
oImage.Status = ImageLoadStatus.Loading; oImage.Status = ImageLoadStatus.Loading;
this.map_image_index[oImage.src] = oImage; this.map_image_index[oImage.src] = oImage;
oImage.Image.onload = function(){ oImage.Image.onload = function ()
oImage.Status = ImageLoadStatus.Complete; {
oThis.loadFontCallBack.call(oThis.Api, oThis.loadFontCallBackArgs); this.parentImage.Status = ImageLoadStatus.Complete;
oThis.loadFontCallBack = null; oThis.loadImageCallBackCounter++;
oThis.loadFontCallBackArgs = null;
if (oThis.loadImageCallBackCounter == oThis.loadImageCallBackCounterMax)
oThis.LoadImagesWithCallbackEnd();
}; };
oImage.Image.onerror = function(){ oImage.Image.onerror = function ()
oImage.Image = null; {
oImage.Status = ImageLoadStatus.Complete; this.parentImage.Image = null;
oThis.loadFontCallBack.call(oThis.Api, oThis.loadFontCallBackArgs); this.parentImage.Status = ImageLoadStatus.Complete;
oThis.loadFontCallBack = null;
oThis.loadFontCallBackArgs = null; if (oThis.loadImageCallBackCounter == oThis.loadImageCallBackCounterMax)
oThis.LoadImagesWithCallbackEnd();
}; };
//oImage.Image.crossOrigin = 'anonymous'; //oImage.Image.crossOrigin = 'anonymous';
oImage.Image.src = oImage.src; oImage.Image.src = oImage.src;
}
};
this.LoadImagesWithCallbackEnd = function()
{
this.loadImageCallBack.call(this.Api, this.loadImageCallBackArgs);
this.loadImageCallBack = null;
this.loadImageCallBackArgs = null;
this.loadImageCallBackCounterMax = 0;
this.loadImageCallBackCounter = 0;
}; };
} }
......
...@@ -1306,7 +1306,7 @@ ...@@ -1306,7 +1306,7 @@
var _args = [guid(), _obj.asc_getSigner1(), _obj.asc_getSigner2(), _obj.asc_getEmail(), _w, _h, _url]; var _args = [guid(), _obj.asc_getSigner1(), _obj.asc_getSigner2(), _obj.asc_getEmail(), _w, _h, _url];
this.ImageLoader.LoadImageWithCallback(_url, function(_args) { this.ImageLoader.LoadImagesWithCallback([_url], function(_args) {
this.asc_addSignatureLine(_args[0], _args[1], _args[2], _args[3], _args[4], _args[5], _args[6]); this.asc_addSignatureLine(_args[0], _args[1], _args[2], _args[3], _args[4], _args[5], _args[6]);
}, _args); }, _args);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment