3
0
mirror of https://github.com/britzl/monarch.git synced 2025-06-27 18:37:46 +02:00

Don't create a transition for a node if one already exists

Fixes #50
This commit is contained in:
Björn Ritzl 2019-08-03 15:40:06 +02:00
parent 4691b8d75f
commit 354dc71b12

View File

@ -122,6 +122,19 @@ local function create()
local function create_transition(transition_id, node, fn, easing, duration, delay) local function create_transition(transition_id, node, fn, easing, duration, delay)
local t = transitions[transition_id] 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] = { t.transitions[#t.transitions + 1] = {
node = node, node = node,
node_data = { node_data = {