7fc0bd0dd5
Add support for the anchor point inside ClutterScript (#834, David Stanczak) * clutter/clutter-actor.c: (clutter_actor_set_property), (clutter_actor_get_property), (clutter_actor_class_init): Add the :anchor-x and :anchor-y properties to the ClutterActor class. (clutter_actor_set_anchor_point), (clutter_actor_set_anchor_pointu), (clutter_actor_set_anchor_point_from_gravity): Reimplement the pixel based and gravity based API using the units based one. Emit the ::notify signal for the :anchor-x and :anchor-y properties. (parse_units), (clutter_actor_parse_custom_node): Parse the :anchor-x and :anchor-y properties using the custom units format (mm, px, pt and %). * tests/test-script.json: Test the newly added properties.
82 lines
2.1 KiB
JSON
82 lines
2.1 KiB
JSON
{
|
|
"My Scene" : {
|
|
"id" : "main-stage",
|
|
"type" : "ClutterStage",
|
|
"color" : "white",
|
|
"signals" : [
|
|
{ "name" : "key-press-event", "handler" : "clutter_main_quit" }
|
|
],
|
|
"children" : [
|
|
{
|
|
"id" : "red-button",
|
|
"type" : "ClutterRectangle",
|
|
"color" : "#ff0000ff",
|
|
"x" : 50, "y" : 50, "width" : 100, "height" : 100,
|
|
"visible" : true,
|
|
"reactive" : true,
|
|
"rotation" : [
|
|
{ "z-axis" : [ 45.0, [ 75, 75 ] ] }
|
|
],
|
|
"behaviours" : [ "fade-behaviour", "path-behaviour" ],
|
|
},
|
|
{
|
|
"id" : "green-button",
|
|
"type" : "ClutterRectangle",
|
|
"color" : "#00ff00ff",
|
|
"border-width" : 5,
|
|
"border-color" : "#00cc00ff",
|
|
"x" : 200,
|
|
"y" : 50,
|
|
"width" : 100,
|
|
"height" : 100,
|
|
"visible" : true,
|
|
"reactive" : true,
|
|
"signals" : [
|
|
{ "name" : "button-press-event", "handler" : "clutter_main_quit" }
|
|
]
|
|
},
|
|
{
|
|
"id" : "red-hand",
|
|
"type" : "ClutterTexture",
|
|
"pixbuf" : "redhand.png",
|
|
"x" : 100,
|
|
"y" : 100,
|
|
"width" : "20mm",
|
|
"height" : "100px",
|
|
"anchor-x" : "5mm",
|
|
"anchor-y" : "5pt",
|
|
"opacity" : 100,
|
|
"visible" : true,
|
|
"behaviours" : [ "rotate-behaviour", "fade-behaviour" ]
|
|
},
|
|
{
|
|
"id" : "red-hand-clone",
|
|
"type" : "ClutterCloneTexture",
|
|
"parent-texture" : "red-hand",
|
|
"x" : 250,
|
|
"y" : 150,
|
|
"opacity" : 100,
|
|
"visible" : true
|
|
},
|
|
{
|
|
"id" : "label",
|
|
"type" : "ClutterLabel",
|
|
"x" : 50,
|
|
"y" : 200,
|
|
"width" : 400,
|
|
"text" : "Clutter\tScript",
|
|
"font-name" : "Sans 24px",
|
|
"color" : "black",
|
|
"alignment" : "center",
|
|
"wrap" : false,
|
|
"ellipsize" : "none",
|
|
"visible" : true,
|
|
"rotation" : [
|
|
{ "y-axis" : [ 60.0, [ 275, 100 ] ] },
|
|
{ "z-axis" : [ 45.0, [ 75, 75 ] ] }
|
|
]
|
|
},
|
|
"blue-button",
|
|
]
|
|
}
|
|
}
|