This is a quick and fairly lightweight abstraction to get the mouse coordinates on click and drag motion. Three different modes determine the behavior for when the mouse leaves the click area. It works in Pure Data vanilla without any external.
Download: xy.zip

Usage:
Type [xy 500 300 1] to create a 500 x 300 pixel area in mode 1. See help file for details.
How it works:
A rectangle scalar of the size of the click area, a one pixel scalar and two graphical arrays are placed on top of each other. The second array has an inverted y-range. Both arrays are set to zero. On click both arrays jump to the respective y-value at x-position. When the rectangle scalar receives the click, it reads the x and y values from the first array. If y is zero, it takes the x value from the second array. Now we have x and y for the click.
The arrays are immediately reset to zero and the pixel scalar is placed to where the mouse is, so that it gets the grab. From there on x and y positions are read from the pixel scalar when its struct sends a change event. That's it.
Some more tricks where necessary to create everything dynamically and make it nice.
Have fun! 
Update 2022-01-17: Finally fixed the bug that broke the patch when dragging near the bottom left corner. Everything should work now! 
As they apparently cannot be turned off, i needed invisible names instead that would still contain $0 to be unique across different instances. So the idea was to take $0, combine it with a number for each array and convert it to binary, but with spaces instead of 0 and 1. i found this

i think its (not yet) possible to sequence through the painted dots (in the order of creation).