-
-
Notifications
You must be signed in to change notification settings - Fork 104
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
Move origin to left-top and draw from top left to bottom right #72
Comments
You can apply ReflectY. |
That doesn't do the trick unfortunately. It does make it draw from top to bottom, but it keeps the 0, 0 point in the lower left corner (rendering everything outside the viewport). I've then tried added Any other ideas? |
There is SetCoordSystem that is supposed to do this (the code is equivalent to what you do, symmetry by the middle of the canvas), but if you say that the text is inverted (and probably the images too in this case, I haven't checked) then may be this should be considered as a bug? |
It looks like that the coordinate transforms here in |
OK, good to know. I'll keep on using the extra calculations I've setup to get everything on the right location… |
There are two transformations though, much like PGF/TikZ. A coordinate transform and a path/image/text transform. You can set the former using Please let me know if setting |
@tdewolff Sorry, I didn't see that |
No worries! You think the |
I know only PGF/TikZ well : there |
I've incorporated implementing |
Looping back to this, in case I am misunderstanding the docs and the discussion, the pieterclaerhout solution of ctx.ReflectY()
ctx.Translate(0, -c.H) is still the only solution that works for me. Other suggested approaches such as ctx.SetCoordSystem(canvas.CartesianIII)
ctx.ReflectY() do not cause the drawing to render within the viewport. |
I think in the second approach you should not call |
I've added a change that adds better support for CartesianIV (i.e. origin is top-left). It differs from CartesianI (i.e. origin is bottom-left) in that it anchors differently to images (anchors top-left vs bottom-left) and that text has always been anchored to the baseline (TextLine) or to top-left (TextBox) and remains so. This means that switching to CartesianIV may change the position of text and images. You can change to CartesianIV using: ctx.SetCoordSystem(canvas.CartesianIV) |
From what I understand, the coordinate system is designed in such a way that the origin is in the lower left corner of canvas and that you draw from left to right and bottom to top, correct?
Is there a way to change it so that the 0,0 point is in the upper left corner (like most design programs do) and draw from left to right and top to bottom?
The text was updated successfully, but these errors were encountered: