missionpinball / mpf-monitor

Graphical utilty which connects to MPF to let you visually control, troubleshoot, and see the status of the machine
http://missionpinball.org
MIT License
11 stars 10 forks source link

Bounding rectangle doesn't fit all device types #31

Open kylenahas opened 3 years ago

kylenahas commented 3 years ago

As pointed out by Avery on the Google Groups feedback thread, devices are clipped improperly when the playfield window is not active.

image

I believe the following code to be at fault:

    def boundingRect(self):
        return QRectF(self.device_size / -2, self.device_size / -2,
                      self.device_size, self.device_size)

➔ playfield.py

atummons commented 2 years ago

I agree. I had something kind of working, but it wasn't what I wanted. Setting a bouncing rect is exactly that...a rectangle. So a triangle shape has a clickable area that of a rectangle. That is a bit of an issue there, but that might just be a limitation.

Further when you start changing angles, the rectangle angle doesn't adjust. So you have to import cos and sin to find a bounding rect. We would really want something like this: https://www.mathopenref.com/coordbounds.html where explicit coordinates are given relative to the center point. I will do some more digging on this one.