Make the design tabs able to shrink

This commit is contained in:
LarsBrubaker 2020-05-30 16:50:36 -07:00
parent 04b29f8fd9
commit 3d6fe51e32
5 changed files with 48 additions and 11 deletions

View file

@ -125,8 +125,7 @@ namespace Markdig.Renderers.Agg.Inlines
{
WebCache.RetrieveImageSquenceAsync(imageSequence, ImageUrl, () =>
{
MinimumSize = new Vector2(Math.Max(20 * DeviceScale, MinimumSize.X), MinimumSize.Y);
MaximumSize = new Vector2(imageSequence.Width, imageSequence.Height);
this.MinStretchOrFitHorizontal(20, imageSequence.Width);
UiThread.RunOnIdle(() =>
{
if (aggRenderer.RootWidget.Parents<MarkdownWidget>().FirstOrDefault() is MarkdownWidget markdownWidget)
@ -143,6 +142,21 @@ namespace Markdig.Renderers.Agg.Inlines
base.OnDraw(graphics2D);
}
/// <summary>
/// Sets this control to Stretch and all direct parent FlowLayoutWidgets to Stretch, it then ensures
/// this and all direct parent FlowLayouts have a max width of the contents of this.
/// </summary>
/// <param name="absoluteMinWidth">The minimum size will be set to the larger of the existing minimum size or this value.</param>
/// <param name="absoluteMaxWidth">The maximum size will be set to this value.</param>
private void MinStretchOrFitHorizontal(double absoluteMinWidth, double absoluteMaxWidth)
{
this.HAnchor = HAnchor.Stretch;
MinimumSize = new Vector2(Math.Max(absoluteMinWidth * DeviceScale, MinimumSize.X), MinimumSize.Y);
MaximumSize = new Vector2(absoluteMaxWidth, MaximumSize.Y);
}
public string ImageUrl { get; }
private string LinkUrl { get; }