From dbf1bdea9d74c8f23bfbc926f714f0cf5dee4f0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ritzl?= Date: Fri, 25 May 2018 15:33:51 +0200 Subject: [PATCH] Replay transitions when the layout changes --- monarch/transitions/gui.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/monarch/transitions/gui.lua b/monarch/transitions/gui.lua index 3b279e5..783d93a 100644 --- a/monarch/transitions/gui.lua +++ b/monarch/transitions/gui.lua @@ -96,6 +96,8 @@ function M.create(node) local transitions = {} + local current_transition = nil + local initial_data = {} initial_data.pos = gui.get_position(node) initial_data.scale = gui.get_scale(node) @@ -114,6 +116,7 @@ function M.create(node) local function start_transition(transition, url) table.insert(transition.urls, url) if not transition.in_progress then + current_transition = transition transition.in_progress = true transition.fn(node, initial_data, transition.easing, transition.duration, transition.delay or 0, function() transition.in_progress = false @@ -129,6 +132,12 @@ function M.create(node) function instance.handle(message_id, message, sender) if message_id == LAYOUT_CHANGED then initial_data.pos = gui.get_position(node) + -- replay the current transition if the layout changes + -- this will ensure that things are still hidden if they + -- were transitioned out + if current_transition then + current_transition.fn(node, initial_data, current_transition.easing, 0, 0) + end else local transition = transitions[message_id] if transition then