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++)
{
if (this.map_image_index[arr[i]] === undefined)
arrAsync.push(arr[i]);
}
if (arrAsync.length == 0)
{ {
loadFontCallBack.call(this.Api, loadFontCallBackArgs); loadImageCallBack.call(this.Api, loadImageCallBackArgs);
return; return;
} }
this.loadFontCallBack = loadFontCallBack; this.loadImageCallBackCounter = 0;
this.loadFontCallBackArgs = loadFontCallBackArgs; this.loadImageCallBackCounterMax = arrAsync.length;
this.loadImageCallBack = loadImageCallBack;
var oImage = new CImage(src); this.loadImageCallBackArgs = loadImageCallBackArgs;
oImage.Image = new Image();
oImage.Status = ImageLoadStatus.Loading; for (i = 0; i < arrAsync.length; i++)
this.map_image_index[oImage.src] = oImage; {
var oImage = new CImage(arrAsync[i]);
oImage.Image.onload = function(){ oImage.Image = new Image();
oImage.Status = ImageLoadStatus.Complete; oImage.Image.parentImage = oImage;
oThis.loadFontCallBack.call(oThis.Api, oThis.loadFontCallBackArgs); oImage.Status = ImageLoadStatus.Loading;
oThis.loadFontCallBack = null; this.map_image_index[oImage.src] = oImage;
oThis.loadFontCallBackArgs = null;
}; oImage.Image.onload = function ()
oImage.Image.onerror = function(){ {
oImage.Image = null; this.parentImage.Status = ImageLoadStatus.Complete;
oImage.Status = ImageLoadStatus.Complete; oThis.loadImageCallBackCounter++;
oThis.loadFontCallBack.call(oThis.Api, oThis.loadFontCallBackArgs);
oThis.loadFontCallBack = null; if (oThis.loadImageCallBackCounter == oThis.loadImageCallBackCounterMax)
oThis.loadFontCallBackArgs = null; oThis.LoadImagesWithCallbackEnd();
}; };
//oImage.Image.crossOrigin = 'anonymous'; oImage.Image.onerror = function ()
oImage.Image.src = oImage.src; {
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 @@ ...@@ -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