具有不同旋转值的多个文本区域导致边框非常非常错误 [英] Multiple text areas with different rotation values causes borders to be very very wrong

查看:12
本文介绍了具有不同旋转值的多个文本区域导致边框非常非常错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果您有两个文本区域,一个除了 0 之外还有旋转值,另一个没有旋转值或值为 0,并且您将焦点从带旋转的一个标签"到不带旋转的那个.带/外旋转的 textArea 周围的边框将被旋转.如果您将非旋转文本字段的旋转值设置为非零数字,即使是 0.01,也可以解决问题,但这会导致文本渲染中出现大量其他问题,因此这不是解决方案.

If you have two textareas, one has a rotation value besides 0 and the other has no rotation value or a value of 0 and you 'tab' focus from the one w/rotation to the one w/out. The border around the textArea w/out rotation will be rotated. If you set the rotation value of the non-rotated text field to a non-zero number, even 0.01, it fixes the problem, this causes tons of other problems in text rendering though so its not a solution.

我发现将 focusThickness 样式设置为 0 会移除边框,这是一个很好的解决方案,但不是很好的解决方案,有人有更好的解决方案吗?下面是一些示例代码:

I found setting the focusThickness style to 0 removes the border, which is a good solution but not a great one, anybody got a better one? Here is some sample code:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:VBox width="100%" height="100%">
    <mx:TextArea id="source" width="100%" fontWeight="bold" fontSize="20" height="50" rotation="5" />
    <mx:TextArea id="dest" width="100%" height="50" />
</mx:VBox>

这是它的样子:替代文字 http://img.skitch.com/20091105-fftxukst1ncggynekatj6937nn.jpg/p>

推荐答案

这是一个扩展 TextArea 并覆盖 adjustFocusRect 方法以修复此错误的类.

Here is a class that extends TextArea and overrides the adjustFocusRect method to fix this bug.

package
{
    import flash.display.DisplayObject;
    import flash.geom.Point;

    import mx.controls.TextArea;
    import mx.core.IFlexDisplayObject;
    import mx.core.IInvalidating;
    import mx.core.IProgrammaticSkin;
    import mx.core.mx_internal;
    import mx.managers.IFocusManager;
    import mx.styles.IStyleClient;

    use namespace mx_internal;

    public class TextArea2 extends TextArea
    {
        override protected function adjustFocusRect(obj:DisplayObject = null):void
        {
            super.adjustFocusRect(obj);

            var focusObj:IFlexDisplayObject = IFlexDisplayObject(getFocusObject());
            if (focusObj)
            {
                if ( !rotation ) {
                    DisplayObject(focusObj).rotation = 0;
                }
            }
        }
    }
}

这篇关于具有不同旋转值的多个文本区域导致边框非常非常错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆