From 354dc71b1296ab8e21dd4fef5c110f243e5df9c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ritzl?= Date: Sat, 3 Aug 2019 15:40:06 +0200 Subject: [PATCH] Don't create a transition for a node if one already exists Fixes #50 --- monarch/transitions/gui.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/monarch/transitions/gui.lua b/monarch/transitions/gui.lua index 9ce569d..bbf6606 100644 --- a/monarch/transitions/gui.lua +++ b/monarch/transitions/gui.lua @@ -122,6 +122,19 @@ local function create() local function create_transition(transition_id, node, fn, easing, duration, delay) local t = transitions[transition_id] + -- find if there's already a transition for the node in + -- question and if so update it instead of creating a new + -- transition + for _,transition in ipairs(t) do + if transition.node == node then + transition.fn = fn + transition.easing = easing + transition.duration = duration + transitions.delay = delay + return + end + end + -- create new transition t.transitions[#t.transitions + 1] = { node = node, node_data = {