I am getting quite a strange behaviour when preselecting combined constraints:
Some groups of constraints get an "offset preselection" while others do not get a preselection at all.
I wanted to ask if this statement in the source is true or not:
basically, is "iconCoords", which is obtained from the path really the center of the icon coordinates?
Code: Select all
SbVec2f iconCoords = viewer->screenCoordsOfPath(path); // Coordinates of the mouse cursor on the icon, origin at top-left for Qt // but bottom-left for OIV. // The coordinates are needed in Qt format, i.e. from top to bottom. int iconX = cursorPos - iconCoords + iconSize/2, iconY = cursorPos - iconCoords - iconSize/2; iconY = iconSize - iconY;
If this statement were true, I think that the iconY calculation is wrong and should be:
the reason is that if (cursorPos - iconCoords) is the vector defining the deviation of the position of the cursor from the center of the icon, the coordinates from the bottom-left (inventor) should be iconsize.y/2 larger, which in the next line gets transformed to qt format (left-top), by substracting the calculated value from the iconsize.y.iconY = cursorPos - iconCoords + iconSize/2;
This is the relevant line in the code:
https://github.com/FreeCAD/FreeCAD/blob ... .cpp#L1670
In any case, this does not solve the problem. I am beginning to think that "path" is not providing the center of the combined icon. But I have a very poor knowledge of Coin3d. That's the reason for my question...