From dc2e33d2458249516d3e553257ca814b17173ef6 Mon Sep 17 00:00:00 2001 From: Matthew Hague <matthew.hague@rhul.ac.uk> Date: Mon, 8 Nov 2021 19:09:58 +0000 Subject: [PATCH] Add slide move --- lib/slide_helper.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/slide_helper.rb b/lib/slide_helper.rb index 3ba1b2a..ceccac6 100644 --- a/lib/slide_helper.rb +++ b/lib/slide_helper.rb @@ -28,6 +28,10 @@ # # Move one slide unit left and create a new slide # +# !SLIDE_MOVE x y +# +# Move x units horizontal and y units vertical +# # !SLIDE_RELATIVE rx ry # # Useful for making slides within slides, e.g. @@ -210,6 +214,8 @@ module SlideHelper output += impress_slide_left(args) + "\n" when '!SLIDE_DOWN' output += impress_slide_down(args) + "\n" + when '!SLIDE_MOVE' + output += impress_slide_move(args) + "\n" when '!SLIDE_SCALE_LEFT' output += impress_slide_scale_left(args) + "\n" when '!SLIDE_RELATIVE' @@ -300,6 +306,15 @@ module SlideHelper impress_make_slide(args) end + def impress_slide_move(args) + argv = args.split + rx, ry = argv[0..1].map {|v| v.to_f} + rem_args = argv[2..].join(' ') + @@pos.x += rx * impress_horiz_mov_unit() + @@pos.y += ry * impress_vert_mov_unit() + impress_make_slide(rem_args) + end + def impress_slide_scale_left(args) argv = args.split scale = argv[0].to_f -- GitLab