fix: 渲染元素销毁时不会删除id映射

This commit is contained in:
unanmed 2024-10-04 01:01:31 +08:00
parent 5970c85dff
commit fc8e666c3a
2 changed files with 1 additions and 29 deletions

View File

@ -405,6 +405,7 @@ export abstract class RenderItem<E extends ERenderItemEvent = ERenderItemEvent>
this.remove(); this.remove();
this.emit('destroy'); this.emit('destroy');
this.removeAllListeners(); this.removeAllListeners();
RenderItem.itemMap.delete(this._id);
} }
} }

View File

@ -620,35 +620,6 @@ export function init() {
callback?.(); callback?.();
}, animateTime + 50); }, animateTime + 50);
// time /= Math.max(core.status.replay.speed, 1);
// var per_time = 10,
// step = 0,
// steps = parseInt(time / per_time);
// if (steps <= 0) {
// this.setViewport(32 * x, 32 * y);
// if (callback) callback();
// return;
// }
// var px = core.clamp(32 * x, 0, 32 * core.bigmap.width - core._PX_);
// var py = core.clamp(32 * y, 0, 32 * core.bigmap.height - core._PY_);
// var cx = core.bigmap.offsetX;
// var cy = core.bigmap.offsetY;
// var moveFunc = core.applyEasing(moveMode);
// var animate = window.setInterval(function () {
// step++;
// core.setViewport(
// cx + moveFunc(step / steps) * (px - cx),
// cy + moveFunc(step / steps) * (py - cy)
// );
// if (step == steps) {
// delete core.animateFrame.asyncId[animate];
// clearInterval(animate);
// core.setViewport(px, py);
// if (callback) callback();
// }
// }, per_time);
const id = fallbackIds++; const id = fallbackIds++;
core.animateFrame.lastAsyncId = id; core.animateFrame.lastAsyncId = id;
core.animateFrame.asyncId[id] = () => { core.animateFrame.asyncId[id] = () => {