mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-09-30 14:54:13 +02:00
bdc1d5878d
The text properties showed and edited the top-left corner of a text, whatever its alignment, and changing the alignment did not move the text. A right-aligned label next to a symbol therefore needed a different X for every text length to keep the same gap (#1155). Position X/Y is now the anchor point: the point of the text chosen by the alignment (right edge for "right", middle for "centre"...). Typing a position puts that point there, and changing the alignment moves the text so that the new anchor point is on the same X/Y. It is the same point that already stays fixed when the text changes. Applies to the element text properties on a folio and to the text field properties in the symbol editor. The saved x/y is still the top-left corner, so projects and symbols load and save unchanged and look the same; only the numbers shown for texts that are not top-left aligned change. The geometry is in textanchor.h, shared by DiagramTextItem and PartDynamicTextField, and tested in tst_textanchor. Not changed: static texts of the symbol editor (PartText), whose position is tied to the font baseline; texts inside a text group, which have no position or alignment of their own; rotation still pivots on the top-left corner (or the centre), not on the anchor. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>