Uno: ViewBox is altering the RenderTransform of its child

Created on 21 Nov 2019  路  3Comments  路  Source: unoplatform/uno

Current behavior

When a UI element in a ViewBox is applied a rotation transform, the transform is overwritten by the ViewBox
When a UI element is applied a rotation transform, for example over a border, the transform moves it across the X and Y , but doesn't rotate it

Expected behavior

It should rotate the control as shown in the image:
image

How to reproduce it (as minimally and precisely as possible)

clone https://github.com/SuperJMN/UnoSimpleCalc/tree/Rotation
checkout the Rotation branch
and see the difference between UWP and WASM

Environment

Affected platform(s):

  • [?] iOS
  • [?] Android
  • [X] WebAssembly
  • [ ] WebAssembly renderers for Xamarin.Forms
  • [ ] Windows
  • [ ] Build tasks
  • [ ] Solution Templates

Visual Studio:

  • [ ] 2017 (version: )
  • [X] 2019 (version: )
  • [ ] for Mac (version: )
kinbug platforandroid platforios platforwasm triaguntriaged

All 3 comments

When I was investigating the pointers issue with the ViewBox, I notice that our current implementation is modifying the RenderTransform of it child, which is probably not valid!

In your sample, if you add an extra border between the ViewBox and the Border with the rotate transform, the rotation applies:

image

Note: I also had to set the RenderTransformOrigin=".5,.5", but it was like UWP.

I update the bug details accordingly.

Also notice that when you rotate a button the clicking area does not rotate

<ItemsControl.ItemTemplate>
    <DataTemplate x:DataType="viewModels:ButtonViewModelBase">
        <Button VerticalAlignment="Stretch" HorizontalAlignment="Stretch"
                Command="{Binding }" Content="{Binding Text}" >
            <Button.RenderTransform>
                <CompositeTransform Rotation="-22.246"/>
            </Button.RenderTransform>
        </Button>
    </DataTemplate>
</ItemsControl.ItemTemplate>

image
So if you click in the corners of the button it doesn't work

Fixed ... commit coming soon

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JanabiSoft picture JanabiSoft  路  3Comments

MartinZikmund picture MartinZikmund  路  3Comments

chrisevans9629 picture chrisevans9629  路  4Comments

SuperJMN picture SuperJMN  路  3Comments

MelbourneDeveloper picture MelbourneDeveloper  路  3Comments