Yes, I tried to change UIPanel.clipRange with the Set method, but it doesn`t work. Then I tried to change UIPanel.clipRange by creating "new Vector4(x, y, z, w)" and it worked.
Now the size and position of the clipRange is calculated correctly based on the size and position of the background and button shift.
Code:
public class NewsPanelManager : MonoBehaviour
{
public UISlicedSprite stretchedBackground;
public UISlicedSprite expandButtonBackground;
public UIPanel textPanel;
public UILabel textLabel;
private UIDraggablePanel draggableTextPanel;
private Vector3 buttonScale;
void Start()
{
draggableTextPanel = textPanel.GetComponent<UIDraggablePanel>();
buttonScale = expandButtonBackground.transform.localScale;
UpdateLabelCollider();
}
void Update()
{
ResizeClippingArea();
}
private void UpdateLabelCollider()
{
NGUITools.AddWidgetCollider(textLabel.gameObject);
}
private void ResizeClippingArea()
{
Vector3 stretchedScale = stretchedBackground.transform.localScale;
float clippingSizeX = stretchedScale.x - buttonScale.x;
float clippingSizeY = stretchedScale.y;
float clippingCenterX = (stretchedScale.x + buttonScale.x) * 0.5f;
float clippingCenterY = 0f;
Vector4 clipRange
= new Vector4
(clippingCenterX, clippingCenterY, clippingSizeX, clippingSizeY
); textPanel.clipRange = clipRange;
//draggableTextPanel.ResetPosition();
}
}
But now there are questions:
1. In Editor, depending on the angle scene rotation and length of the UILabel text you can see it or not. (Z order of panels?)
2. After I try to drag the label, it disappears sometimes. This is true even if I remove the code above.
3. When I drag the label and update clipRange of the panel (code above), the panel itself begins to shift.
4. What Grid settings (cell width, cell heigth) should be for such a case? Now is default.
See attach.
UPDATE:
1-2. Solved. Uhhhh. Set z to -1 on Clipping Panel.

3. Need help.
4. I think that these settings in this case do not matter.
Thanks!