We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi! Is it possible to center an image horizontally in the slide?
The text was updated successfully, but these errors were encountered:
You can use "layout" to get the width and height of slide to center an image.
Although I don't know exactly what the numerical unit in the original setting is, at least I found a constant that can calculate its actual length.
code:
function centerImage(imageRect = {x: 0, y: 0, cx: 10, cy: 10}, direction = 'horizontal', layout = 'LAYOUT_16x9'){ let layouts = { LAYOUT_4x3: { type: 'screen4x3', width: 9144000, height: 6858000 }, LAYOUT_16x9: { type: 'screen16x9', width: 9144000, height: 5143500 }, LAYOUT_16x10: { type: 'screen16x10', width: 9144000, height: 5715000 }, LAYOUT_WIDE: { type: 'custom', width: 12191996, height: 6858000 }, LAYOUT_USER: { type: 'custom', width: 12191996, height: 6858000 }, }; let lengthRatio = 1/1e4/32.24*25.4; let slideWidth = layouts[layout].width*lengthRatio; let slideHeight = layouts[layout].height*lengthRatio; if(['horizontal', 'both'].indexOf(direction) > -1) imageRect.x = (slideWidth - imageRect.cx)/2; if(['vertical', 'both'].indexOf(direction) > -1) imageRect.y = (slideHeight - imageRect.cy)/2; return(imageRect); }
Sorry, something went wrong.
No branches or pull requests
Hi! Is it possible to center an image horizontally in the slide?
The text was updated successfully, but these errors were encountered: