From db27e0972ebd02f685ab9688c05198fbe8977d5c Mon Sep 17 00:00:00 2001 From: Thomas Geymayer Date: Mon, 30 Jun 2014 23:18:48 +0200 Subject: [PATCH] canvas.Window: move/setSize/setPosition: support coords as vector. --- Nasal/canvas/gui.nas | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/Nasal/canvas/gui.nas b/Nasal/canvas/gui.nas index c1f0cf5a4..e86bcca2d 100644 --- a/Nasal/canvas/gui.nas +++ b/Nasal/canvas/gui.nas @@ -209,13 +209,21 @@ var Window = { gui.focused_window = nil; return me; }, - setPosition: func(x, y) + setPosition: func { + if( size(arg) == 1 ) + var arg = arg[0]; + var (x, y) = arg; + me.setInt("tf/t[0]", x); me.setInt("tf/t[1]", y); }, - setSize: func(w, h) + setSize: func { + if( size(arg) == 1 ) + var arg = arg[0]; + var (w, h) = arg; + me.set("content-size[0]", w); me.set("content-size[1]", h); @@ -224,8 +232,12 @@ var Window = { return me; }, - move: func(x, y) + move: func { + if( size(arg) == 1 ) + var arg = arg[0]; + var (x, y) = arg; + me.setInt("tf/t[0]", me.get("tf/t[0]", 10) + x); me.setInt("tf/t[1]", me.get("tf/t[1]", 30) + y); },