View Issue Details

IDProjectCategoryView StatusLast Update
0003247NoesisGUIUnity3Dpublic2024-05-02 11:48
Reportergeorge Assigned Tojsantos  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.2 
Fixed in Version3.2.4 
Summary0003247: Width="auto" property doesnt work in <Expander> component when <UniformGrid> is a child
DescriptionHi,
We are having a wired bug in Noesis, related to Mac with Intel processors.

This bug only happens in MacOS with an Intel processor.
We couldn't generate this bug in Windows or other Apple laptops with new processors.

Here is a small code that we managed to generate the problem.
<Expander Width="Auto" IsExpanded="¨true">
  <UniformGrid Rows="1">
     <..... />
  </UniformGrid>
</Expander>

we found changing the Width to a specific value or deleting UniformGrid makes the Width="Auto" work as it should.
TagsNo tags attached.
PlatformmacOS

Activities

jsantos

jsantos

2024-04-18 15:06

manager   ~0009387

Last edited: 2024-04-18 15:07

Thanks for the report. Could you please attach a full XAML that can be pasted into XamlPlayer or XamlToy to reproduce the issue?
sfernandez

sfernandez

2024-04-19 10:42

manager   ~0009389

Also, if you can post some images with the difference between the expected and unexpected results to better understand what is happening, thank you!
jsantos

jsantos

2024-04-22 15:10

manager   ~0009395

Thanks for the information. I am bit confused with what xamltoy.png is, because I have tried your XAML and I have several errors regarding StaticResource.

Could you please provide a clean XAML that we can use in Xamltoy and XamlPlayer to reproduce the issue?

Thank you!
george

george

2024-04-23 07:31

reporter   ~0009400

Here is the code without any compiling without errors in XamlToy:

<Grid xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Grid.Resources>
        <!-- Define TabBarAnimatedExpanderStyle -->
        <Style x:Key="TabBarAnimatedExpanderStyle" TargetType="{x:Type Expander}">
            <!-- Expander style definition -->
            <Setter Property="UseLayoutRounding" Value="true" />
            <Setter Property="OverridesDefaultStyle" Value="true" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Expander}">
                        <Border Width="Auto" x:Name="OuterBorder" UseLayoutRounding="False" Margin="5,0" HorizontalAlignment="Center">
                            <Grid>
                                <Border Width="Auto" UseLayoutRounding="False" Background="Transparent" BorderThickness="3,3,3,0" BorderBrush="White" CornerRadius="15,15,0,0" />
                                <Grid Margin="3,3,3,0">
                                    <Border Name="Content">
                                        <ContentPresenter x:Name="ExpanderContent" UseLayoutRounding="{TemplateBinding UseLayoutRounding}">
                                            <ContentPresenter.LayoutTransform>
                                            </ContentPresenter.LayoutTransform>
                                        </ContentPresenter>
                                    </Border>
                                </Grid>
                            </Grid>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </Grid.Resources>

    <!-- StackPanel containing Expander -->
    <StackPanel Margin="0,4,0,0" HorizontalAlignment="Center" Orientation="Horizontal">
        <!-- Expander with TabBarAnimatedExpanderStyle applied -->
        <Expander Panel.ZIndex="120" IsEnabled="{Binding ViewSelectorIsEnabled}" x:Name="viewSelectorSmall" Visibility="Visible" IsExpanded="True" Style="{StaticResource TabBarAnimatedExpanderStyle}">
            <!-- Expander content -->
            <UniformGrid Rows="1">
                <!-- Buttons -->
                <Button Content="1st button" Background="Transparent" BorderThickness="0" BorderBrush="Transparent" HorizontalContentAlignment="Center" HorizontalAlignment="Center" Padding="8,0,8,0" Margin="0"/>
                <Button Content="2nd button" Background="Transparent" BorderThickness="0" BorderBrush="Transparent" HorizontalContentAlignment="Center" HorizontalAlignment="Center" Padding="8,0,8,0" Margin="0"/>
                <Button Content="3rd button" Background="Transparent" BorderThickness="0" BorderBrush="Transparent" HorizontalContentAlignment="Center" HorizontalAlignment="Center" Padding="8,0,8,0" Margin="0"/>
            </UniformGrid>
        </Expander>
    </StackPanel>
</Grid>
Screenshot 2024-04-23 073057.png (130,090 bytes)   
Screenshot 2024-04-23 073057.png (130,090 bytes)   
sfernandez

sfernandez

2024-04-23 11:29

manager   ~0009402

This could be related to an incorrect handling of infinite values in UniformGrid that I found, could you please apply the following patch and see if it solves the problems in Intel Macs?

Index: UniformGrid.cpp
===================================================================
--- UniformGrid.cpp	(revision 13788)
+++ UniformGrid.cpp	(working copy)
@@ -65,8 +65,9 @@
 {
     CalculateCells();
 
-    Size childSize(availableSize.width / static_cast<float>(mNumColumns),
-        availableSize.height / static_cast<float>(mNumRows));
+    Size childSize(
+        IsInfinity(availableSize.width) ? FLT_INF : availableSize.width / float(mNumColumns),
+        IsInfinity(availableSize.height) ? FLT_INF : availableSize.height / float(mNumRows));
 
     float maxWidth = 0.0f;
     float maxHeight = 0.0f;
@@ -96,8 +97,7 @@
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 Size UniformGrid::ArrangeOverride(const Size& finalSize)
 {
-    Rect childRect(0.0f, 0.0f, finalSize.width / static_cast<float>(mNumColumns),
-        finalSize.height / static_cast<float>(mNumRows));
+    Rect childRect(Size(finalSize.width / float(mNumColumns), finalSize.height / float(mNumRows)));
     childRect.x += childRect.width * GetFirstColumn();
 
     float lastColumn = finalSize.width - 1.0f;
george

george

2024-04-25 10:27

reporter   ~0009415

Hej,
Not sure what to do with this code or how to add these changes. we are only working with C#.

Do you have any documentation or guide on how to implement this changes? so I can do it and test it on Mac+Intel?
sfernandez

sfernandez

2024-04-25 10:43

manager   ~0009416

Sorry, as your company has access to the source code I thought you were building the runtime library yourselves.
We can generate a patched library for you, could you please indicate what exact version are you using right now?
george

george

2024-04-30 08:14

reporter   ~0009437

We are using v3.2.3
jsantos

jsantos

2024-05-01 01:51

manager   ~0009447

Last edited: 2024-05-01 01:51

Please, download the following hot-fix (you need to replace this new Noesis.dylib with the one you have in your Unity package in /Runtime/Libraries/MacOS)

https://drive.google.com/file/d/11hbmilUTZzEg2db49lG4BhKP2jzkROHl/view?usp=sharing
george

george

2024-05-02 08:39

reporter   ~0009449

Hej,

thank you so much,
I can confirm this fixed the bug. now it looks correct, thank you!

Should I expect this fix on the next release?
sfernandez

sfernandez

2024-05-02 11:48

manager   ~0009450

Sure, we solved it in changeset 13848 and will be fixed in 3.2.4 version

Issue History

Date Modified Username Field Change
2024-04-18 11:17 george New Issue
2024-04-18 15:05 jsantos Assigned To => jsantos
2024-04-18 15:05 jsantos Status new => assigned
2024-04-18 15:06 jsantos Note Added: 0009387
2024-04-18 15:06 jsantos Status assigned => feedback
2024-04-18 15:07 jsantos Note Edited: 0009387
2024-04-19 10:42 sfernandez Note Added: 0009389
2024-04-22 07:54 george Status feedback => assigned
2024-04-22 15:10 jsantos Note Added: 0009395
2024-04-22 15:10 jsantos Status assigned => feedback
2024-04-23 07:31 george Note Added: 0009400
2024-04-23 07:31 george File Added: Screenshot 2024-04-23 073057.png
2024-04-23 07:31 george Status feedback => assigned
2024-04-23 11:29 sfernandez Status assigned => feedback
2024-04-23 11:29 sfernandez Note Added: 0009402
2024-04-25 10:27 george Note Added: 0009415
2024-04-25 10:27 george Status feedback => assigned
2024-04-25 10:43 sfernandez Status assigned => feedback
2024-04-25 10:43 sfernandez Note Added: 0009416
2024-04-30 08:14 george Note Added: 0009437
2024-04-30 08:14 george Status feedback => assigned
2024-05-01 01:51 jsantos Note Added: 0009447
2024-05-01 01:51 jsantos Status assigned => feedback
2024-05-01 01:51 jsantos Note Edited: 0009447
2024-05-02 08:39 george Note Added: 0009449
2024-05-02 08:39 george Status feedback => assigned
2024-05-02 11:48 sfernandez Status assigned => resolved
2024-05-02 11:48 sfernandez Resolution open => fixed
2024-05-02 11:48 sfernandez Fixed in Version => 3.2.4
2024-05-02 11:48 sfernandez Note Added: 0009450