wieslawsoltes / PanAndZoom

Pan and zoom control for Avalonia.
http://wieslawsoltes.github.io/PanAndZoom/
MIT License
348 stars 45 forks source link

ScrollViewer's scrollBars not correct when setting when ZoomBorder's child Height is set #70

Closed BobLd closed 1 year ago

BobLd commented 1 year ago

Hi @wieslawsoltes, thanks a lot for your amazing libraries.

It seems there's a bug in the ZoomBorder control when one sets the Height of it's child. The zooming and panning work but the ScrollViewer's scrollBars are not correct.

I'm not sure if this is an actual bug or if I'm doing something wrong, or if the issue is in the ScrollViewer.

One way the reproduce the issue is as follow:

<ScrollViewer Name="MainScrollViewer"
              VerticalScrollBarVisibility="Visible"
              HorizontalScrollBarVisibility="Visible"
              AllowAutoHide="False"
              Background="Aquamarine">

    <paz:ZoomBorder Name="ZoomBorder" Stretch="Uniform" ZoomSpeed="1.2"
                   EnableConstrains="True"
                   Background="BurlyWood" ClipToBounds="True" Focusable="True"
                   VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="5"
                   MinZoomX="0.1" MinZoomY="0.1" MaxZoomX="50" MaxZoomY="50">

            <Canvas Name="MainCanvas" Background="Purple"
                    Height="1000" Margin="5" />

    </paz:ZoomBorder>
</ScrollViewer>

When removing the ZoomBorder control, the ScrollViewer's scrolbars are correct:

<ScrollViewer Name="MainScrollViewer"
              VerticalScrollBarVisibility="Visible"
              HorizontalScrollBarVisibility="Visible"
              AllowAutoHide="False"
              Background="Aquamarine">

        <Canvas Name="MainCanvas" Background="Purple"
                Height="1000" Margin="5" />

</ScrollViewer>
BobLd commented 1 year ago

There is in fact an issue when the Child is bigger than the view, not because the Height is set. I'm closing the issue as I'm now using a LayoutTransformControl to handle zooming

SiMet commented 1 month ago

Hi all,

I'd like to reopen this ticket. Using sample application I changed size of Border in first sample to fixed=1300,1300

I was expecting that scroll will appear. However, it's not visible. image image

I'm not sure if it's issue of the lib or maybe I should do something to handle such cases.

SiMet commented 1 month ago

@wieslawsoltes quick search shows me that method CalculateScrollable does not care about Border size. In my opinion viewport should be a value of this.Border.Size not the _element.Border.Size