GTK4 Gsk.Transform.translate cannot be created, but all other Transforms can
When creating a GskTransform, Gsk.Transform.translate() will appear to work, but does not create a translation.
If you create an Gsk.Transform and apply any other form of transformation they all work as expected, and when allocated apply to the widget as you would expect, but specifically translate and translate3D will not apply to the widget. If you print the list of transformations with Gsk.Transform.to_string(), all other transforms will appear except the translations.
For example, this is an implementation of the SWING_DOWN transformation in gtkrevealer.c:
transform = Gsk.Transform()
transform = transform.translate(Graphene.Point(width / 2, 0))
transform = transform.perspective(2 * (max(width, height)))
transform = transform.rotate_3d(delta * -1,
Graphene.vec3_x_axis())
transform = transform.translate(Graphene.Point((width / 2) * -1, 0))
The above works and can be allocated, but when printed with to_string, you get: perspective(1200) rotate3d(1, 0, 0, 356.528)
, and the translations will not apply.
transform = Gsk.Transform()
transform = transform.translate(Graphene.Point(width / 2, 0))
The above when printed with to_string prints none
.
I also tried creating the transforms in the format transform = Gsk.Transform.translate(transform, Graphene.Point(width / 2, 0))
, but the result is the same.
I tested this with all transformations in Gsk.Transform, and it appears that the only one this occurs with is Gsk.Transform.translate
and Gsk.Transform.translate_3d
.
Finally, I tested applying transforms in CSS with transform: translate(100px, 100px)
, and this works as intended.