File: gegl_rectangle.lua

package info (click to toggle)
gegl 1%3A0.4.66-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 33,032 kB
  • sloc: ansic: 241,723; cpp: 4,529; lisp: 3,614; xml: 2,724; python: 1,208; ruby: 1,205; sh: 182; makefile: 35; javascript: 6
file content (38 lines) | stat: -rw-r--r-- 1,294 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
local x = active:get_property("x").value
local y = active:get_property("y").value
local w = active:get_property("width").value
local h = active:get_property("height").value

touch_point(x,y)
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
    local w = active:get_property("width").value
    local h = active:get_property("height").value
    x = x + ev.delta_x
    y = y + ev.delta_y
    w = w - ev.delta_x
    h = h - ev.delta_y
    active:set_property("y", GObject.Value(GObject.Type.DOUBLE, y))
    active:set_property("x", GObject.Value(GObject.Type.DOUBLE, x))
    active:set_property("width", GObject.Value(GObject.Type.DOUBLE, w))
    active:set_property("height", GObject.Value(GObject.Type.DOUBLE, h))
    ev:stop_propagate();
  end
end)

touch_point(x+w,y+h)
mrg:listen(Mrg.DRAG, function(ev)
  if ev.type == Mrg.DRAG_MOTION then
    local w = active:get_property("width").value
    local h = active:get_property("height").value
    w = w + ev.delta_x
    h = h + ev.delta_y
    active:set_property("width", GObject.Value(GObject.Type.DOUBLE, w))
    active:set_property("height", GObject.Value(GObject.Type.DOUBLE, h))
    ev:stop_propagate();
  end
end)
cr:new_path()