From 091f77ab08b56212989d46c2b37bf837ebdf83f9 Mon Sep 17 00:00:00 2001 From: Mischa Untaga <99098079+MischaU8@users.noreply.github.com> Date: Mon, 23 Oct 2023 11:48:12 +0200 Subject: remove animation bounce --- play.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/play.js b/play.js index 1dbbf7a..baf1adf 100644 --- a/play.js +++ b/play.js @@ -519,6 +519,8 @@ function update_unit(e, u) { } Node.prototype.appendChildAnimated = function(e) { + if (this.contains(e)) + return const { left: x0, top: y0 } = e.getBoundingClientRect() this.appendChild(e) if (!x0) @@ -575,23 +577,20 @@ function update_map() { if (loc) { if (loc === DEPLOY) { - if (is_gov_unit(u) && !ui.gov_supply.contains(e)) + if (is_gov_unit(u)) ui.gov_supply.appendChildAnimated(e) - if (is_fln_unit(u) && !ui.fln_supply.contains(e)) + if (is_fln_unit(u)) ui.fln_supply.appendChildAnimated(e) } else if (loc === ELIMINATED) { - if (!ui.eliminated.contains(e)) - ui.eliminated.appendChildAnimated(e) + ui.eliminated.appendChildAnimated(e) } else { let box_id = unit_box(u) if (is_area_country(loc)) { // only single box in France, Morocco and Tunisia box_id = 0 } - if (!ui.boxes[loc * 4 + box_id].contains(e)) { - ui.boxes[loc * 4 + box_id].appendChildAnimated(e) - } + ui.boxes[loc * 4 + box_id].appendChildAnimated(e) } update_unit(e, u) } else { -- cgit v1.2.3