This is the same feature as was discussed here:
I think many serious photographers are using local masks for the levels adjustment layers in photoshop and take advantage that the histogram in the levels adjustment only shows the values for the selected region. E.g. it was one of the main tools for Ben Long in the Lynda.com course on Photography printing: https://www.lynda.com/Photoshop-tutorials/Inkjet-Printing-Photographers/103678-2.html.
Would be great to have it in affinity photo. I actually couldn‘t find any other software for macOS that would implement it, which seems strange, shouldn‘t be too difficult... OpenCV does it, so shouldn‘t be an Adobe patented feature.