MCPcopy Index your code
hub / github.com/SLiCAP/SLiCAP_python / _counter_transform

Function _counter_transform

SLiCAP/schematic/component_item.py:72–84  ·  view source on GitHub ↗

Return the label counter-transform that exactly cancels the parent component's combined rotate × flip transform, keeping label text upright and unmirrored. The parent's effective linear transform is scale(sx,sy) × rotate(rot). Its inverse is rotate(-rot) × scale(sx,sy) [since scal

(rotation: float, h_flip: bool, v_flip: bool)

Source from the content-addressed store, hash-verified

70
71
72def _counter_transform(rotation: float, h_flip: bool, v_flip: bool) -> "QTransform":
73 """
74 Return the label counter-transform that exactly cancels the parent component's
75 combined rotate × flip transform, keeping label text upright and unmirrored.
76
77 The parent's effective linear transform is scale(sx,sy) × rotate(rot).
78 Its inverse is rotate(-rot) × scale(sx,sy) [since scale is self-inverse here].
79 In Qt's QTransform, .rotate().scale() post-multiplies left-to-right, giving
80 exactly rotate(-rot) × scale(sx,sy) as required.
81 """
82 sx = -1 if h_flip else 1
83 sy = -1 if v_flip else 1
84 return QTransform().rotate(-rotation).scale(sx, sy)
85
86
87_TEXT_RE = re.compile(rb'<text\b([^>]*)>(.*?)</text>', re.S)

Callers 4

draw_subckt_pin_namesFunction · 0.85
draw_symbol_textsFunction · 0.85
update_labelsMethod · 0.85
itemChangeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected