You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pos.Align pushes the envelope on being the most sophisticated Pos/Dim object. The fact that it has multiple configuration properties and the use-cases mean there are interesting cases where a dev will want to modify a PosAlign object.
For example, if X is Pos.Align, a dev may want to posAlign.AlignmentModes &= ^AlignmentMode.AddSpaces without creating a new instance an assinging it to X. If they do that, there's no way for View to know it the state was changed to force a layout.
View.LayoutSubviews is (rightly, IMO) internal so a dev has really no way to indicate a layout is needed other than forcing View.X to be set with a new instance of PosAlign.
This is actually not a common case, so I'm not going to fix it now. However, thinking through how it would work made me realize that if Pos and Dim supported IPropertyNotify (or similar), and on set_X we subscribed, View would always just know layout was needed. There would be no need to ever explicitly call SetLayoutNeeded and would radically remove the times where calling LayoutSubviews was need.
This could be a big perf win (I have not measured the # of times layout happens unnecessarily in a long time, but I did it ages ago and it's an issue). It could also be a correctness win.
Not high pri by any means, but something to noodle on.
The text was updated successfully, but these errors were encountered:
Pos.Align
pushes the envelope on being the most sophisticatedPos
/Dim
object. The fact that it has multiple configuration properties and the use-cases mean there are interesting cases where a dev will want to modify aPosAlign
object.For example, if
X
isPos.Align
, a dev may want toposAlign.AlignmentModes &= ^AlignmentMode.AddSpaces
without creating a new instance an assinging it to X. If they do that, there's no way forView
to know it the state was changed to force a layout.View.LayoutSubviews
is (rightly, IMO)internal
so a dev has really no way to indicate a layout is needed other than forcingView.X
to be set with a new instance ofPosAlign
.This is actually not a common case, so I'm not going to fix it now. However, thinking through how it would work made me realize that if
Pos
andDim
supportedIPropertyNotify
(or similar), and onset_X
we subscribed,View
would always just know layout was needed. There would be no need to ever explicitly callSetLayoutNeeded
and would radically remove the times where callingLayoutSubviews
was need.This could be a big perf win (I have not measured the # of times layout happens unnecessarily in a long time, but I did it ages ago and it's an issue). It could also be a correctness win.
Not high pri by any means, but something to noodle on.
The text was updated successfully, but these errors were encountered: