[gegl] bin: add a single touch-point for moving x,y of translate



commit 45f455e23ccb8d0ceee746b2c11c2fefafc13fa5
Author: Øyvind Kolås <pippin gimp org>
Date:   Mon Feb 18 17:15:19 2019 +0100

    bin: add a single touch-point for moving x,y of translate

 bin/lua/gegl_translate.lua | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
---
diff --git a/bin/lua/gegl_translate.lua b/bin/lua/gegl_translate.lua
new file mode 100644
index 000000000..b680ba078
--- /dev/null
+++ b/bin/lua/gegl_translate.lua
@@ -0,0 +1,21 @@
+local x = active:get_property("x").value
+local y = active:get_property("y").value
+
+cr:new_path()
+cr:arc(x, y, dim/2, 0, 3.1415 * 2)
+
+mrg:listen(Mrg.DRAG, function(ev)
+  if ev.type == Mrg.DRAG_MOTION then
+    local x = active:get_property("x").value
+    local y = active:get_property("y").value
+    x = x + ev.delta_x
+    y = y + ev.delta_y
+    active:set_property("y", GObject.Value(GObject.Type.DOUBLE, y))
+    active:set_property("x", GObject.Value(GObject.Type.DOUBLE, x))
+    ev:stop_propagate();
+  end
+end)
+
+cr:set_source_rgba(1,0,0,0.5)
+cr:fill()
+


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]