Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flipper applies scale when content size changes #835

Closed
mycroes opened this issue Nov 3, 2017 · 4 comments
Closed

Flipper applies scale when content size changes #835

mycroes opened this issue Nov 3, 2017 · 4 comments
Labels
bug Waiting on feedback Additional information is needed. Stale items with this label may be closed.

Comments

@mycroes
Copy link

mycroes commented Nov 3, 2017

I noticed some awkward behavior with the flipper where it seems to scale if the content shrinks (requires less space than before), in my case when a combobox selection is reset. Luckily I happened to have two identical flippers with identical content:
flipper scale

It seems like a scale transformation is applied on the Viewport2DVisual3D (this is the right flipper):
viewport2dvisual3dright

And here's left for comparison:
viewport2dvisual3dleft

I guess the issue might com from the following piece in Plane3D:

private void Update3D()
        {
            // Use GetDescendantBounds for sizing and centering since DesiredSize includes layout whitespace, whereas GetDescendantBounds 
            // is tighter
            var logicalBounds = VisualTreeHelper.GetDescendantBounds(_logicalChild);
            var w = logicalBounds.Width;
            var h = logicalBounds.Height;
            ...
            _scaleTransform.ScaleX = w;
            _scaleTransform.ScaleY = h;

I'm not sure why this doesn't match the actual content size when it shrinks, (or actually, maybe this isn't called when the content shrinks?) but flipping the card back and forth fixes the scale.

I'm sorry for the huge screenshots, they were taken at 200% scale.

@glen-nicol
Copy link
Contributor

I just noticed this bahavior too. When I have a flipper in a Grid it will shrink when a gridsplitter makes that part of the grid smaller. Also happens when the window size is changed. This makes the Flipper unusable.

I also had the problem of the flipper rendering a little too big when loaded. Meaning the contents of the flipper were rendered larger than the area of the flipper.

<materialDesign:Flipper
    Grid.Row="1"
    Grid.Column="4"
    HorizontalAlignment="Stretch"
    VerticalAlignment="Stretch"
    >

I ended up adding margin to bring it back down to the right size but that is quite annoying. But not as annoying as the incorrect scaling issue which makes the margin problem moot. I tried the card styling too that was way worse.

@CookiesAndCoffee
Copy link
Contributor

Hi i had a similar Problem with a TextBlock that always rerendered, when i clicked on a CheckBox in the same Grid.

On StackOverflow was a similar Problem:
https://stackoverflow.com/questions/6436501/wpf-why-does-text-and-elements-blur-if-i-use-dropshadow-effect-on-a-parent-item

We have a similar case in the Card. The Grid.OpacityMask cause the Content Presenter to render the TextBlock as a Bitmap.

I will setup a merge Request and you can check if that fixes the flipper issue too.

CookiesAndCoffee added a commit to CookiesAndCoffee/MaterialDesignInXamlToolkit that referenced this issue May 28, 2018
Keboo added a commit that referenced this issue Jul 19, 2018
JeffBarnard pushed a commit to JeffBarnard/MaterialDesignInXamlToolkit that referenced this issue Jul 19, 2018
@Keboo Keboo modified the milestone: 2.4.1 Jul 25, 2018
@valimaties
Copy link

I just noticed this bahavior too. When I have a flipper in a Grid it will shrink when a gridsplitter makes that part of the grid smaller. Also happens when the window size is changed. This makes the Flipper unusable.

I also had the problem of the flipper rendering a little too big when loaded. Meaning the contents of the flipper were rendered larger than the area of the flipper.

<materialDesign:Flipper
    Grid.Row="1"
    Grid.Column="4"
    HorizontalAlignment="Stretch"
    VerticalAlignment="Stretch"
    >

I ended up adding margin to bring it back down to the right size but that is quite annoying. But not as annoying as the incorrect scaling issue which makes the margin problem moot. I tried the card styling too that was way worse.

This happened to me couple of days ago.. I didn't know about this problem of Flipper, which after two years seems to be there! This is very annoying and disappointing!

@ElieTaillard
Copy link
Member

@valimaties Do you still have the problem? If so, please provide us a test repo. It will help us to solve the problem more easily.

@ElieTaillard ElieTaillard added bug Waiting on feedback Additional information is needed. Stale items with this label may be closed. labels May 28, 2022
@ElieTaillard ElieTaillard closed this as not planned Won't fix, can't repro, duplicate, stale Aug 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Waiting on feedback Additional information is needed. Stale items with this label may be closed.
Projects
None yet
Development

No branches or pull requests

6 participants