| 31 | } |
| 32 | |
| 33 | wf::Size ConstrainedBox::ArrangeOverride(wf::Size finalSize) |
| 34 | { |
| 35 | // Even though we requested in measure to be a specific size, that doesn't mean our parent |
| 36 | // panel respected that request. Grid for instance can by default Stretch and if you don't |
| 37 | // set Horizontal/VerticalAlignment on the control it won't constrain as we expect. |
| 38 | // We could also be in a StackPanel/ScrollViewer where it wants to provide as much space as possible. |
| 39 | // However, if we always re-calculate even if we are provided the proper finalSize, this can trigger |
| 40 | // multiple arrange passes and cause a rounding error in layout. Therefore, we only want to |
| 41 | // re-calculate if we think we will have a significant impact. |
| 42 | if (std::abs(finalSize.Width - m_LastMeasuredSize.Width) > CALCULATION_TOLERANCE || |
| 43 | std::abs(finalSize.Height - m_LastMeasuredSize.Height) > CALCULATION_TOLERANCE) |
| 44 | { |
| 45 | // Check if we can re-use our measure calculation if we're given effectively |
| 46 | // the same size as we had in the measure step. |
| 47 | if (std::abs(finalSize.Width - m_OriginalSize.Width) <= CALCULATION_TOLERANCE && |
| 48 | std::abs(finalSize.Height - m_OriginalSize.Height) <= CALCULATION_TOLERANCE) |
| 49 | { |
| 50 | finalSize = m_LastMeasuredSize; |
| 51 | } |
| 52 | else |
| 53 | { |
| 54 | CalculateConstrainedSize(finalSize); |
| 55 | |
| 56 | // Copy again so if Arrange is re-triggered we won't re-re-calculate. |
| 57 | m_LastMeasuredSize = finalSize; |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | return base_type::ArrangeOverride(finalSize); |
| 62 | } |
| 63 | |
| 64 | bool ConstrainedBox::IsPositiveRealNumber(double value) noexcept |
| 65 | { |
nothing calls this directly
no outgoing calls
no test coverage detected