There is a (somewhat subtle) bug in the previous code. Indeed, drag does work at any scale factor, but you'll see it clearly once you understand what I mean:
- Start the program and add a media item (no scaling!)
- Position pointer in the exact center of the media item, click and drag it somewhere on the stage.
- Notice that when you release the item from drag, the pointer is still located in the exact position of the media item that you initiated drag from. In other words the item is translated exactly 1:1 with the mouse pointer.
- Hit "+" five times.
- Position the pointer in the exact center of media item, and drag it to the far side of the screen. You will notice that, while the item has been dragged, the pointer has offset from the point at which it was located when you first grabbed the item.
Once I understand why, it's completely logical ;-)
Try the updated version below, with good text centering, (visually) correct dragging and possibly other minor experiments.
| [reply] [d/l] |
Yeah, I see it now, it was very subtle. There was some slippage due to the slowness of my computer, and I didn't swing in a wide circle. I was mistaking the slippage as normal, but I can see your bug now. I was also confused because if I added an anchor, not a media, there is no bug !! Oh well, thanks for figuring it out, and will save the correction factor for later reference. Once I understand why, it's completely logical ;-) I'm glad someone knows what they are doing. :-)
| [reply] |