attractplus icon indicating copy to clipboard operation
attractplus copied to clipboard

Anchor and Rotation_Origin fail on un-scaled images

Open Chadnaut opened this issue 1 year ago • 1 comments

Anchor and Rotation_Origin require width and height to be explicitly set before they take effect. Since the image defaults to using the texture size (or when zeroed), you would expect these to do the same.

Pretty sure you already know about this one, but I just came across it. Adding this ticket so it doesn't fall off the radar.

local flw = ::fe.layout.width;
local flh = ::fe.layout.height;
local art = ::fe.add_artwork("snap", flw * 0.5, flh * 0.5);
art.video_flags = Vid.ImagesOnly;

art.anchor = Anchor.Centre;
art.rotation_origin = Origin.Centre;

// The size must be set for the above origins to work
// art.width = 200;
// art.height = 200;

::fe.add_ticks_callback("on_tick");
function on_tick(ttime) {
    art.rotation += 1;
}

Chadnaut avatar Nov 21 '24 14:11 Chadnaut

Anchor is also not working properly with art.preserve_aspect_ratio = true

local flw = fe.layout.width
local flh = fe.layout.height

local snap = fe.add_artwork( "snap" , flw/2, flh/2, flw/2, flh/2 )
snap.video_flags = Vid.ImagesOnly
snap.preserve_aspect_ratio = true
snap.anchor = Anchor.Bottom

oomek avatar Jan 05 '25 15:01 oomek

Fixed in d1c3c945897cd8ecd2ab76e1070c52a39f27d83e

Chadnaut avatar Jul 03 '25 23:07 Chadnaut