多个文本区域具有不同的旋转值使边界是非常非常错误的多个、边界、文本、区域

2023-09-08 15:35:24 作者:站好你的位置说你该说的话

如果你有两个文本域,一个人除了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消除边界,这是一个很好的解决方案,但不是一个伟大的,任何人都得到了一个更好的?下面是一些示例code:

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>

下面是什么样子:

Here is what it looks like:

推荐答案

下面是一个扩展文本区并覆盖adjustFocusRect方法来修复这个bug的类。

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;
    			}
    		}
    	}
    }
}