Length tool - How the image coordinates remain consistent even if the image is zoomed or if the viewport size differs

When I try to draw a line using the length tool, I want to know how the points are marked and how it remains consistent even if the viewport size changes. Please let me know where can i find this code in the OHIF folder structure.