private void EndPointerTool()
 {
     if (lastFocusObject != null)
     {
         lastFocusObject.SetState(IdleState.GetState());
         lastFocusObject = null;
     }
     SetPreparedState(IdleState.GetState());
     prepareComposite?.Clear();
     OnCompositeNotReady?.Invoke();
     propertiesPanel.Hide();
 }
 public override void MouseInit(int x, int y)
 {
     deltaX = deltaY = 0;
     lastX  = x;
     lastY  = y;
     if (lastFocusObject != null)
     {
         transResizeIndex = lastFocusObject.GetTransResizeIndex(x, y);
         if (transResizeIndex.X != NO_MATCH_BOUNDRY)
         {
             focusObject = lastFocusObject;
         }
         lastFocusObject.SetState(IdleState.GetState());
     }
     ComputeFocus(x, y);
 }
 public void ExecuteComposite()
 {
     propertiesPanel.Hide();
     if (prepareComposite.Count == 1)
     {
         drawingCanvas.undoRedoController.AddProcess(new DecompositeCommand(drawingCanvas, prepareComposite.First.Value));
     }
     else
     {
         DrawingObject composite = DrawingObject.MakeComposite(drawingCanvas, prepareComposite.ToArray());
         drawingCanvas.undoRedoController.AddProcess(new CompositeCommand(drawingCanvas, composite));
         foreach (DrawingObject prepared in prepareComposite)
         {
             prepared.SetState(IdleState.GetState());
         }
     }
     SetPreparedState(IdleState.GetState());
     prepareComposite.Clear();
     OnCompositeNotReady();
 }
        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();
            }
        }
Esempio n. 5
0
 public override void MouseEnd(int x, int y)
 {
     drawingObject?.SetState(IdleState.GetState());
     drawingObject = null;
 }