public void HandlePreviewMouseDown(Point mousePos) { this.isDragging = true; Rect selectionZone = this.Canvas.GetSelectionBounds(); if (selectionZone.Size != Size.Empty) { selectionZone.Inflate(new Size(15, 15)); //To cover the resizing bounds } //if (this.OutilSelectionne == "lasso" && this.StrokeBeingDragged == null) if (this.OutilSelectionne == "lasso" && this.StrokeBeingRotated == null && this.StrokeBeingDragged == null) { foreach (Stroke s in SelectedStrokes.Where(x => (x as Form).Type != "Arrow")) { Point pts = (s as Form).RotatePoint; if (Math.Abs(Point.Subtract(pts, mousePos).Length) < 10 && this.StrokeBeingRotated == null) { this.Canvas.MoveEnabled = false; this.StrokeBeingRotated = s; this.isDragging = false; //this.Canvas.EditingMode = InkCanvasEditingMode.None; } } } if (this.OutilSelectionne == "lasso" && this.StrokeBeingDragged == null && this.StrokeBeingRotated == null) { foreach (Stroke s in SelectedStrokes.Where(x => (x as Form).Type == "Arrow")) { for (int i = 0; i < s.StylusPoints.Count; i++) { Point pts = s.StylusPoints[i].ToPoint(); if (Math.Abs(Point.Subtract(pts, mousePos).Length) < 10 && this.IndexBeingDragged == -1) { this.StrokeBeingDragged = s; this.IndexBeingDragged = i; this.isDragging = false; editeur.ShowEncrage = true; //this.Canvas.EditingMode = InkCanvasEditingMode.None; } } } } if (this.OutilSelectionne == "lasso" && !selectionZone.Contains(mousePos) && this.StrokeBeingDragged == null && this.StrokeBeingRotated == null) { StrokeCollection selection = new StrokeCollection(); for (int i = Traits.Count - 1; i >= 0; i--) { if (Traits[i].GetBounds().Contains(mousePos) && selection.Count == 0) //&& (Traits[i] as Form).Type != "Arrow") { if ((Traits[i] as Form).Type == "Arrow") { if (Traits[i].HitTest(mousePos)) { selection.Add(Traits[i]); } } else { selection.Add(Traits[i]); } } } editeur.HandleChangeSelection(selection); } else { this.isDragging = false; editeur.HandleMouseDown(mousePos); } }