I’m writing a slate widget that needs to plot points and lines in Cartesian space. I use
FGeometry::MakeChild to create a geometry representing the mapping between local widget space and Cartesian space. My datapoints are specified in Cartesian space. I then call
FSlateDrawElement::MakeLines, passing in an
FPaintGeometry from my Cartesian child geometry, the datapoints, and the clip rect from the
The mapping is set up correctly, everything is drawn in the correct place, but the clipping is erratic. Parts of the lines will get clipped, sometimes abruptly sometimes smoothly, as I drag my widget around the canvas in the widget blueprint designer, or zoom in and out.
If I instead transform all points by the Cartesian geometry’s
LocalToAbsolute and then
AbsoluteToLocal of my local geometry, and pass the local geometry into
MakeLines, it all works fine.
I suspect this is related to my Cartesian mapping having a render transform component (not just layout transform), but I still would like to know if it is intended behaviour. Since the clip rect is apparently specified in absolute coordinates, and the elements are drawn in the correct location (within that clip rect), I don’t see why they should ever get clipped.
I’ve read everything I could find relating to this, including the transform calculus on the wiki, but it’s still taken me days of fighting with it to get to a point where it just about works, and I still don’t really understand it. Any insight would be really helpful (as would a bit more documentation!).