Prevent slide.asy from stretching paths horizontally#599
Draft
thornoar wants to merge 1 commit into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This line in the
slidemodule introduces a transformation that fits the frame of every slide into the square ranging from(-1,-1)to(1,1):At the same time, the picture is sized by
size(pagewidth,pageheight,IgnoreAspect), which means that all paths drawn by the user are stretched horizontally by a factor ofpagewidth/pageheight.I understand the benefit of having "unit coordinates" ranging from
-1to1in bothxandydirections, which makes it easier to place content on the slide, but as soon as the user wants to draw a circle, they have to manually correct it withxscale(pageheight/pagewidth), which leads to other complications, especially if rotation (which does not commute withxscale) is involved.Of course, if only text and external graphics are included in the presentation (like in the example), this stretching is not a concern. But I think that when typesetting presentation slides, the greatest benefit of Asymptote is the total control it gives the user of the canvas, which alternatives like LaTeX or Typst do not provide.
This behavior seems to be fixed if we create a variable like
(from "[w]idth-[h]eight [r]atio") and then use
(-whr, -1)and(whr, 1)in the definition oftinv:This pull request makes this change and adjusts some size checks inside
slide.asyto usewhrinstead of1. I make this a draft because I'm note sure about the preferred naming, and whether pull requests of such nature are approved