Ejemplo n.º 1
0
 private void Canvas_MouseUp(object sender, MouseButtonEventArgs e)
 {
     if (step != null)
     {
         var page = strokes_page_all[pagenum];
         if (page != null)
         {
             step.lines_curr.Add(m_canvas.Strokes);
             page.lines.Add(step);
             step = null;
         }
     }
 }
Ejemplo n.º 2
0
        private void Strokes_StrokesChanged(object sender, StrokeCollectionChangedEventArgs e)
        {
            if (undoOrRedo > 0)
            {
                undoOrRedo -= 1;
                return;
            }

            if (step == null)
            {
                step = new ZBBPageStep();
            }

            // 笔模式
            if (e.Added.Count > 0 && e.Removed.Count == 0)
            {
                step.lines_add.Add(e.Added);
            }
            // 橡皮模式 会多次进入回掉
            else if (e.Removed.Count > 0)
            {
                step.lines_add.Add(e.Added);
                for (int i = 0; i < e.Removed.Count; i++)
                {
                    var removeItem = e.Removed[i];
                    if (step.lines_add.Contains(removeItem))
                    {
                        step.lines_add.Remove(removeItem);
                    }
                    else
                    {
                        step.lines_remove.Add(removeItem);
                    }
                }
            }
        }