From cbffa458b92bebe1544760647710641b00154654 Mon Sep 17 00:00:00 2001 From: ckcz123 Date: Tue, 18 Dec 2018 15:20:41 +0800 Subject: [PATCH] Async animate callback --- libs/control.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libs/control.js b/libs/control.js index 6646323a..ef7437e4 100644 --- a/libs/control.js +++ b/libs/control.js @@ -133,8 +133,14 @@ control.prototype.setRequestAnimationFrame = function () { var obj = core.status.animateObjs[i]; if (obj.index == obj.animate.frames.length) { // 绘制完毕 - if (core.isset(obj.callback)) obj.callback(); delete core.animateFrame.asyncId[obj.id]; + // 异步执行回调... + (function(callback) { + setTimeout(function() { + if (core.isset(callback)) + callback(); + }); + })(obj.callback); } else { core.maps.drawAnimateFrame(obj.animate, obj.centerX, obj.centerY, obj.index++);