diagrams / diagrams-rasterific

Rasterific backend for diagrams
Other
15 stars 12 forks source link

Returned transformation from adjustDia doesn't map (0,0) to any of the diagrams bounding corners #44

Open ocharles opened 6 years ago

ocharles commented 6 years ago

See this IRC transcript:

ocharles: Can anyone make any sense of this? https://gist.github.com/ocharles/2c36ebc4eadae5602479ead97cb9917e I'm translating pixel coordinates back into diagram space, but ending up with a flipped y

ocharles: in that paste, see the "traceShowM" lines where I show the bounding box of my diagram, and then apparently map the (0,0) pixel of the rendered diagram to something completely outside that bounding box

ocharles: I see this in the rasterific backend: "adjustDia c opts d = adjustDia2D sizeSpec c opts (d # reflectY)" I wonder if that has something to do with it

ocharles: As a work around, I'm currently flipping the y axis on the result of calls to papply atm and then things do line up correctly

byorgey: ocharles: yeah, it probably has to do with the reflectY in the backend, which is done since many backends have the positive y-axis pointing downwards, but diagrams has it pointing upwards

byorgey commented 6 years ago

@ocharles I'm trying to figure out whether this is a bug in diagrams or in your intuition. Do you have reason to believe that the origin should be included in the envelope of the diagram you are rendering?

Also, note that the flipped y is expected: pixel coordinates have the positive y axis pointing downwards, but diagrams coordinates have it pointing upwards.