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

.

parent ef5dc3ed
......@@ -438,8 +438,10 @@
this.bIsLoadDocumentImagesNoByOrder = true;
this.nNoByOrderCounter = 0;
this.loadFontCallBack = null;
this.loadFontCallBackArgs = null;
this.loadImageCallBackCounter = 0;
this.loadImageCallBackCounterMax = 0;
this.loadImageCallBack = null;
this.loadImageCallBackArgs = null;
var oThis = this;
......@@ -620,37 +622,63 @@
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;
}
this.loadFontCallBack = loadFontCallBack;
this.loadFontCallBackArgs = loadFontCallBackArgs;
this.loadImageCallBackCounter = 0;
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.parentImage = oImage;
oImage.Status = ImageLoadStatus.Loading;
this.map_image_index[oImage.src] = oImage;
oImage.Image.onload = function(){
oImage.Status = ImageLoadStatus.Complete;
oThis.loadFontCallBack.call(oThis.Api, oThis.loadFontCallBackArgs);
oThis.loadFontCallBack = null;
oThis.loadFontCallBackArgs = null;
oImage.Image.onload = function ()
{
this.parentImage.Status = ImageLoadStatus.Complete;
oThis.loadImageCallBackCounter++;
if (oThis.loadImageCallBackCounter == oThis.loadImageCallBackCounterMax)
oThis.LoadImagesWithCallbackEnd();
};
oImage.Image.onerror = function(){
oImage.Image = null;
oImage.Status = ImageLoadStatus.Complete;
oThis.loadFontCallBack.call(oThis.Api, oThis.loadFontCallBackArgs);
oThis.loadFontCallBack = null;
oThis.loadFontCallBackArgs = null;
oImage.Image.onerror = function ()
{
this.parentImage.Image = null;
this.parentImage.Status = ImageLoadStatus.Complete;
if (oThis.loadImageCallBackCounter == oThis.loadImageCallBackCounterMax)
oThis.LoadImagesWithCallbackEnd();
};
//oImage.Image.crossOrigin = 'anonymous';
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 @@
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]);
}, _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