Skip to content

ViewBox is altering the RenderTransform of its child #2135

Closed

Description

@paulovila

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
  • WebAssembly
  • WebAssembly renderers for Xamarin.Forms
  • Windows
  • Build tasks
  • Solution Templates

Visual Studio:

  • 2017 (version: )
  • 2019 (version: )
  • for Mac (version: )

Activity

  1. added
    kind/bug
    triage/untriaged
    on Nov 21, 2019
  2. dr1rrb commented on Nov 21, 2019

    @dr1rrb
    Member

    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.

  3. changed the title [-]RenderTransform Rotation doesn't rotate in WASM[/-] [+]ViewBox is altering the RenderTransform of its child[/+] on Nov 21, 2019
  4. added
    platform/android 🤖
    platform/ios 🍎
    platform/wasm 🌐
    on Nov 21, 2019
  5. paulovila commented on Nov 21, 2019

    @paulovila
    Author

    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

  6. self-assigned this
    on Dec 4, 2019
  7. dr1rrb commented on Dec 4, 2019

    @dr1rrb
    Member

    Fixed ... commit coming soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bugplatform/android 🤖platform/ios 🍎platform/wasm 🌐triage/untriaged

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions