summaryrefslogtreecommitdiffstats
path: root/lib/efl/evas.rb
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2011-05-06 15:45:11 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2011-05-06 15:45:11 +0200
commit9aba5f0bc6594806df6954df88749d1db99dd232 (patch)
tree95c21d35a4c1ff4e1b930d34651276a37692bb7d /lib/efl/evas.rb
parent222486a25ec6b5ea02cca4aafd1336619caffcec (diff)
downloadffi-efl-9aba5f0bc6594806df6954df88749d1db99dd232.zip
ffi-efl-9aba5f0bc6594806df6954df88749d1db99dd232.tar.gz
add REvasObject#center set/get/=
Diffstat (limited to 'lib/efl/evas.rb')
-rw-r--r--lib/efl/evas.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/efl/evas.rb b/lib/efl/evas.rb
index 8ce5369..b706b8b 100644
--- a/lib/efl/evas.rb
+++ b/lib/efl/evas.rb
@@ -168,6 +168,16 @@ module Efl
[ x.read_int, y.read_int, w.read_int, h.read_int ]
end
alias :geometry :geometry_get
+ def center_get
+ g = geometry_get
+ [ g[0]+(g[2]/2.0), g[1]+(g[3]/2.0) ]
+ end
+ alias :center :center_get
+ def center_set x, y
+ g = geometry_get
+ move x-(g[2]/2.0), y-(g[3]/2.0)
+ end
+ alias :center= :center_set
def size
geometry_get[2..-1]
end