Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attract-mode: rotation #191

Closed
daimonnomos opened this issue Mar 1, 2016 · 2 comments
Closed

Attract-mode: rotation #191

daimonnomos opened this issue Mar 1, 2016 · 2 comments

Comments

@daimonnomos
Copy link

possible bug -> preserve_aspect_ratio in combination with rotation.

The following code will give, on my win7 PC, not the expected result.

local snap = fe.add_artwork( "snap", x, y, width, height);
snap.preserve_aspect_ratio=true;
snap.rotation = 180;

Some images (in my case .png, didn't try other formats) will be rotated correct, other images will shift in horizontal- or vertical direction. Assuming the rotation point is top left of the original none rotated image.

@daimonnomos
Copy link
Author

Following workaround will do what I expect:

// possible bug -> preserve_aspect_ratio in combination with rotate.
// workaround -> do your on resizeing and preserve aspect ratio.
snap.preserve_aspect_ratio=false;
fe.add_transition_callback("artwork_transition");
function artwork_transition( ttype, var, ttime )
{
if (( ttype == Transition.FromOldSelection )
|| ( ttype == Transition.ToNewList ))
{
local wf=snap_width/snap2.subimg_width.tofloat();
local hf=snap_height/snap2.subimg_height.tofloat();
if(wf<hf)
{
snap2.width=wf_snap2.subimg_width;
snap2.height=wf_snap2.subimg_height;
}
else
{
snap2.width=hf_snap2.subimg_width;
snap2.height=hf_snap2.subimg_height;
}
local snap_x_offset=(snap_width-snap2.width)/2
local snap_y_offset=(snap_height-snap2.height)/2
snap2.set_pos(fe.layout.width-list_x_offset-snap_x_offset, fe.layout.height-header_height-snap_y_offset);
}
return false;
}

@mickelson
Copy link
Owner

Thanks for the report, this should be fixed now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants