/// <summary> /// Process end resize event. /// </summary> /// <param name="resizable">Resizable component.</param> protected virtual void OnEndResize(Resizable resizable) { var start = RectTransform.localPosition.x; var end = RectTransform.localPosition.x + RectTransform.rect.width; Data.ChangePoints(Owner.Position2Point(start), Owner.Position2Point(end)); }
/// <summary> /// Remove listeners. /// </summary> protected virtual void RemoveListeners() { var click = GetComponent <ClickListener>(); if (click != null) { click.DoubleClickEvent.RemoveListener(OnDoubleClick); } Resizable = GetComponent <Resizable>(); if (Resizable != null) { Resizable.OnEndResize.RemoveListener(OnEndResize); } }
/// <summary> /// Add listeners. /// </summary> protected virtual void AddListeners() { var click = Utilites.GetOrAddComponent <ClickListener>(this); click.DoubleClickEvent.AddListener(OnDoubleClick); Resizable = GetComponent <Resizable>(); if (Resizable != null) { Resizable.ResizeDirections.Top = false; Resizable.ResizeDirections.TopLeft = false; Resizable.ResizeDirections.TopRight = false; Resizable.ResizeDirections.Bottom = false; Resizable.ResizeDirections.BottomLeft = false; Resizable.ResizeDirections.BottomRight = false; Resizable.OnEndResize.AddListener(OnEndResize); } }