Created
September 5, 2013 22:43
-
-
Save mattdangerw/6457235 to your computer and use it in GitHub Desktop.
clutter draggable actor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Clutter = imports.gi.Clutter; | |
// Convenience function to parse a clutter color from a string | |
function parse_clutter_color(color_string) { | |
let [res, color] = Clutter.Color.from_string(color_string); | |
return color; | |
} | |
Clutter.init(null, null); | |
let stage = Clutter.Stage.get_default(); | |
// stage.set_layout_manager(new Clutter.BinLayout()); | |
let click_thing = new Clutter.Actor({ | |
"height": 100, | |
"width": 100, | |
"background-color": parse_clutter_color("red"), | |
"reactive": true | |
}); | |
stage.add_child(click_thing); | |
click_thing.connect("button-press-event", function(actor, event) { | |
print("yolo"); | |
}); | |
let action = new Clutter.DragAction(); | |
action.connect("drag-begin", function(action, actor, x, y, mod) {}); | |
action.connect("drag-end", function(action, actor, x, y, mod) {}); | |
click_thing.add_action(action); | |
stage.show(); | |
Clutter.main(); | |
stage.destroy(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment