From 0193b060108ae69cc84a18616668f56dd4ff538e Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期一, 13 五月 2024 21:14:15 +0800 Subject: [PATCH] 调整标记样式 --- src/utils/map/animation.js | 41 ++++++++++++++++++++++++++++++++++++++--- 1 files changed, 38 insertions(+), 3 deletions(-) diff --git a/src/utils/map/animation.js b/src/utils/map/animation.js index 05c8ba7..ed664c3 100644 --- a/src/utils/map/animation.js +++ b/src/utils/map/animation.js @@ -21,6 +21,7 @@ this._fps = this.frameAnimation.fps; // 缁樺埗鍥惧舰缂撳瓨 this.moveViews = {}; + this.clear = true; } MapAnimation.prototype = { @@ -159,6 +160,15 @@ Layer.drawMesh(d, f); // 椋庡悜椋庨�� sector.drawSectorAna(d, start + index); + // 鎵ц鐩戝惉鍑芥暟 + if (typeof that.OnEachFrameCallback === 'function') { + that.OnEachFrameCallback(d, start + index); + } + // 缁樺埗3D鍥惧舰鏃讹紝鏈�灏戦渶瑕�2涓偣鎵嶅彲缁樺埗鍥惧舰 + // 鍥犳姝ゅ绱㈠紩鍙埌鍊掓暟绗簩涓偣灏辩粨鏉燂紝姝ゆ椂鎵ц杩欐浠诲姟缁撴潫鐨勭洃鍚洖璋� + if (typeof that.OnEachTaskEndCallback === 'function') { + that.OnEachTaskEndCallback(d); + } } var pos = d.lnglats_GD[d.lnglats_GD.length - 1]; @@ -200,9 +210,27 @@ this.start(); }, + /** + * 璁剧疆姣忎竴甯х殑鐩戝惉鍑芥暟 + * @param {Function} callback + */ + setOnEachFrameCallback(callback) { + this.OnEachFrameCallback = callback; + }, + + /** + * 璁剧疆姣忎竴娈典换鍔$粨鏉熺殑鐩戝惉鍑芥暟 + * @param {Function} callback + */ + setOnEachTaskEndCallback(callback) { + this.OnEachTaskEndCallback = callback; + }, + /*******************************鍔ㄧ敾浠诲姟閫昏緫 -start ******************************/ start: function () { - sector.clearSector(); + if (this.frameAnimation.isStop) { + sector.clearSector(); + } this.frameAnimation.start(); }, changeSpeed: function (speed) { @@ -214,12 +242,14 @@ stop: function () { this.factorDatas = undefined; this.frameAnimation.addOnNextTasks(undefined); + // this.OnEachFrameCallback = undefined; + // this.OnEachTaskEndCallback = undefined; this.frameAnimation.stop(); + this._clearMap(); }, setOnStopCallback: function (callback) { this.frameAnimation.setOnStopCallback( function () { - this._clearMap(); callback(); }.bind(this) ); @@ -242,6 +272,8 @@ /*******************************鍔ㄧ敾浠诲姟閫昏緫 -end ******************************/ _clearMap: function () { + if (!this.clear) return; + var list = []; for (const key in this.moveViews) { list.push(this.moveViews[key]); @@ -386,4 +418,7 @@ } }; -export { MapAnimation }; +const realTimeMapAnimation = new MapAnimation(); +// realTimeMapAnimation.clear = false; + +export { realTimeMapAnimation, MapAnimation }; -- Gitblit v1.9.3