예제 #1
0
 public static EditState GetState()
 {
     if (state == null)
     {
         state = new EditState();
     }
     return(state);
 }
        private void ComputeFocus(int x, int y)
        {
            focusObject = (focusObject == null) ? drawingCanvas.GetLastIntersection(x, y) : focusObject;

            if (focusObject != null)
            {
                if (lastFocusObject == null || focusObject == lastFocusObject && prepareComposite.Count < 2)
                {
                    propertiesPanel.SetDrawable(focusObject);
                    focusObject.SetState(EditState.GetState());
                    if (focusObject.ChildCount > 0)
                    {
                        OnCompositeReady();
                    }
                }
                else
                {
                    lastFocusObject?.SetState(ActiveState.GetState());
                }
                if (!prepareComposite.Contains(focusObject))
                {
                    prepareComposite.AddLast(focusObject);
                    if (prepareComposite.Count > 1)
                    {
                        propertiesPanel.Hide();
                        OnCompositeReady();
                        focusObject.SetState(ActiveState.GetState());
                    }
                }
            }
            else
            {
                propertiesPanel.Hide();
                SetPreparedState(IdleState.GetState());
                prepareComposite.Clear();
                OnCompositeNotReady?.Invoke();
            }
        }