|
|
|
|
|
|
using System.Collections; |
|
|
|
using System; |
|
|
|
using System.Collections; |
|
|
|
using System.Collections.Generic; |
|
|
|
using UnityEngine; |
|
|
|
using UnityEngine.Experimental.UIElements; |
|
|
|
|
|
|
public class ResizeBorderFrame : VisualElement |
|
|
|
{ |
|
|
|
public Action OnResizeFinished; |
|
|
|
|
|
|
|
public ResizeBorderFrame(VisualElement target) |
|
|
|
{ |
|
|
|
pickingMode = PickingMode.Ignore; |
|
|
|
|
|
|
Add(new ResizeSideHandle(target, ResizeHandleAnchor.TopLeft)); |
|
|
|
Add(new ResizeSideHandle(target, ResizeHandleAnchor.Top)); |
|
|
|
Add(new ResizeSideHandle(target, ResizeHandleAnchor.TopRight)); |
|
|
|
Add(new ResizeSideHandle(target, ResizeHandleAnchor.Right)); |
|
|
|
Add(new ResizeSideHandle(target, ResizeHandleAnchor.BottomRight)); |
|
|
|
Add(new ResizeSideHandle(target, ResizeHandleAnchor.Bottom)); |
|
|
|
Add(new ResizeSideHandle(target, ResizeHandleAnchor.BottomLeft)); |
|
|
|
Add(new ResizeSideHandle(target, ResizeHandleAnchor.Left)); |
|
|
|
ResizeSideHandle topLeft = new ResizeSideHandle(target, ResizeHandleAnchor.TopLeft); |
|
|
|
ResizeSideHandle top = new ResizeSideHandle(target, ResizeHandleAnchor.Top); |
|
|
|
ResizeSideHandle topRight = new ResizeSideHandle(target, ResizeHandleAnchor.TopRight); |
|
|
|
ResizeSideHandle right = new ResizeSideHandle(target, ResizeHandleAnchor.Right); |
|
|
|
ResizeSideHandle bottomRight = new ResizeSideHandle(target, ResizeHandleAnchor.BottomRight); |
|
|
|
ResizeSideHandle bottom = new ResizeSideHandle(target, ResizeHandleAnchor.Bottom); |
|
|
|
ResizeSideHandle bottomLeft = new ResizeSideHandle(target, ResizeHandleAnchor.BottomLeft); |
|
|
|
ResizeSideHandle left = new ResizeSideHandle(target, ResizeHandleAnchor.Left); |
|
|
|
|
|
|
|
topLeft.OnResizeFinished += HandleResizefinished; |
|
|
|
top.OnResizeFinished += HandleResizefinished; |
|
|
|
topRight.OnResizeFinished += HandleResizefinished; |
|
|
|
right.OnResizeFinished += HandleResizefinished; |
|
|
|
bottomRight.OnResizeFinished += HandleResizefinished; |
|
|
|
bottom.OnResizeFinished += HandleResizefinished; |
|
|
|
bottomLeft.OnResizeFinished += HandleResizefinished; |
|
|
|
left.OnResizeFinished += HandleResizefinished; |
|
|
|
|
|
|
|
Add(topLeft); |
|
|
|
Add(top); |
|
|
|
Add(topRight); |
|
|
|
Add(right); |
|
|
|
Add(bottomRight); |
|
|
|
Add(bottom); |
|
|
|
Add(bottomLeft); |
|
|
|
Add(left); |
|
|
|
} |
|
|
|
|
|
|
|
void HandleResizefinished() |
|
|
|
{ |
|
|
|
if (OnResizeFinished != null) |
|
|
|
{ |
|
|
|
OnResizeFinished(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |