Position of pasted nodes is off on non-default zoom levels
Posted: Thu Nov 23, 2023 2:01 pm
Since many bug reports seem to stay unaddressed due to the efforts (not sufficiently compensated by funding) required to diagnose and fix them, I've decided to try and look into the program myself and find the cause of the problem. I do understand that this is a little against the rules, but I'm only trying to help the people interested in this otherwise great piece of software, and indirectly - to help you (the developers) officially help them with minimum efforts.
Judging from the debugging info (Windows, 6.04), CMapComponent.getViewableArea outputs in logical coordinates, while CMapComponent.getBoundsOfNodes and CMapComponent.getBoundsOfEntitys output in physical coordinates, and this causes (in CMapComponent.pasteFromClipboard) the nudge calculated for CMapComponent.moveGraphicalEntitiesBy to be off by an amount that is dependent on the zoom level, the origin of the copied items and the offset of the viewport. Applying CMapComponent.ComponentToMap to the output of CMapComponent.getViewableArea fixes the problem.
Judging from the debugging info (Windows, 6.04), CMapComponent.getViewableArea outputs in logical coordinates, while CMapComponent.getBoundsOfNodes and CMapComponent.getBoundsOfEntitys output in physical coordinates, and this causes (in CMapComponent.pasteFromClipboard) the nudge calculated for CMapComponent.moveGraphicalEntitiesBy to be off by an amount that is dependent on the zoom level, the origin of the copied items and the offset of the viewport. Applying CMapComponent.ComponentToMap to the output of CMapComponent.getViewableArea fixes the problem.