[haiku-commits] Re: haiku: hrev54496 - src/kits/interface
- From: John Scipione <jscipione@xxxxxxxxx>
- To: haiku-commits@xxxxxxxxxxxxx
- Date: Tue, 11 Aug 2020 14:59:33 -0400
On Tue, Aug 11, 2020 at 11:14 AM Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
Am 06/08/2020 um 13:51 schrieb Adrien Destugues:
a9b301871d06: IK: align BTextView text rect/fix alignment
The distinction between fTextRect and fAlignedTextRect isn't entirely
clear to me, and why we need them both.
fTextRect is the rect passed in by the user in the constructor or
SetTextRect(). fAlignedRect is a copy of fTextRect that we “align” to
subtract padding From the left and right sides and also expand as the text
We need both rects so that we can reset fAlignedTextRect back to fTextRect
when things change, i.e. when _ResetTextRect() is called. Before we were
resetting fTextRect to BTextView Bounds() in _ResetTextRect() but that
wasn’t right because you can set a text rect in your app that is inside the
bounds of the BTextView and resetting to Bounds() in _ResetTextRect() ruins
that. The passed-in text rect was not preserved before when we called
_ResetTextRect(), now it is.
It might be possible to eliminate the fAlignedTextRect variable, but I
couldn’t figure out how to do it.
Other related posts: