4 Replies Latest reply on Nov 11, 2009 8:31 PM by justoliver

    Component Rotation - keep text upright

    justoliver

      Hi

       

      I am using the Rotate effect to rotate a DataGrid, however I would like the text which is within each cell to remain upright.

       

      I have tried setting the rotation of the itemRenderer to be equal to the amount of rotation and this works however the itemRender flips around 0,0, causing a visual offset in the datagrid. Is there a way to prevent this if I am just using the 'rotation' property or do I need to create a separate rotation effect for the item renderer which works in the opposite direction?

       

      Does anyone have any ideas?

       

      Thanks

        • 1. Re: Component Rotation - keep text upright
          susrut316

          How is it possible to show the rotated columns inside a datagrid. It would be nice if you could throw some light on what exactly you want to achieve using a datagrid. May be the same thing can be achieved creating a custom component.

          • 2. Re: Component Rotation - keep text upright
            justoliver Level 1

            It is possible just by adjusting the rotation property of a custom item

            renderer ie. I rotate the datagrid using the Rotate effect and then change

            the rotation of the custom item renderer to be the exact negative of the

            effect rotation. The rotation value of the effect is interfaced through to

            the item renderer.

             

            My current item renderer is just a label, however I am thinking of changing

            this to a VBox with a label and then applying a reverse effect on the VBox -

            I am inclined to believe that this is the only way to do this - I reckon it

            will look pretty cool though, having the cell contents rotating backwards

            while the datagrid rotates forwards.

            • 3. Re: Component Rotation - keep text upright
              injpix Level 3

              Just a thought, did you try to use the owner property in the itemrenderer to retrieve the host component?  If you can do that then, you should be able to retrieve the host's rotation property which then, the itemrenderer can mirror.

              1 person found this helpful
              • 4. Re: Component Rotation - keep text upright
                justoliver Level 1

                Thanks

                 

                That gave me insight into using the owner property.

                 

                I was able to create an itemRenderer with a rotate effect which works. The only thing is that I had to reposition the label for any future updatDisplayList calls - I think this is because the rotation value gets set afetr rotation for the label but when the renderer returns it has no ide of the origin of the rotation (perhaps a bug?)