private void canvas_MouseDown(object sender, MouseButtonEventArgs e) { if (isSnapShotTaken) { //Debug.WriteLine("canvas_MouseDown"); Point mouseClickPt = e.GetPosition(cameraIMG); RockViewModel rockCorrespondsToCanvasPt = rocksOnWallViewModel.GetRockInListByCanvasPoint(mouseClickPt); if (rockCorrespondsToCanvasPt == null) // new rock { Size newBoulderSizeOnCanvas = GetBoulderSizeOnCanvasFromSliders(); // check rock overlaps if (rocksOnWallViewModel.IsOverlapWithRocksOnWall( mouseClickPt, newBoulderSizeOnCanvas) == false) { CameraSpacePoint csp = jcWall.GetCamSpacePointFromMousePoint(mouseClickPt, _mode); if (!csp.Equals(default(CameraSpacePoint))) { rocksOnWallViewModel.AddRock(csp, newBoulderSizeOnCanvas); } else { UiHelper.NotifyUser(DepthInfoMissingWarningMsg); } } else { UiHelper.NotifyUser(RockOverlapsWarningMsg); } } else // rock already in list { rocksOnWallViewModel.SelectedRock = rockCorrespondsToCanvasPt; boulderWidthSlider.Value = rockCorrespondsToCanvasPt.RockShapeContainer.GetWidth(); boulderHeightSlider.Value = rockCorrespondsToCanvasPt.RockShapeContainer.GetHeight(); // if rock already in list, enable drag drop! rockCorrespondsToCanvasPt.RockShapeContainer.DoDragDrop(); } } else { UiHelper.NotifyUser("Please take snap shot first."); } }
private void canvas_MouseDown(object sender, MouseButtonEventArgs e) { if (isSnapShotTaken) { Point mouseClickPt = e.GetPosition(cameraIMG); //ColorSpacePoint _boulderCSP = new ColorSpacePoint { X = (float)mouseClickPt.X, Y = (float)mouseClickPt.Y }; Boulder rockCorrespondsToCanvasPt = rocksOnWallViewModel.GetRockInListByCanvasPoint(mouseClickPt); if (rockCorrespondsToCanvasPt == null) // new rock { double newBoulderWidthOnCanvas = ConvertSliderValueToSizeOnCanvas(boulderWidthSlider.Value); double newBoulderHeightOnCanvas = ConvertSliderValueToSizeOnCanvas(boulderHeightSlider.Value); // check rock overlaps if (rocksOnWallViewModel.IsOverlapWithRocksOnWall( mouseClickPt, newBoulderWidthOnCanvas, newBoulderHeightOnCanvas) == false) { CameraSpacePoint csp = jcWall.GetCamSpacePointFromMousePoint(mouseClickPt, _mode); if (!csp.Equals(default(CameraSpacePoint))) { rocksOnWallViewModel.AddRock(csp, mouseClickPt, newBoulderWidthOnCanvas, newBoulderHeightOnCanvas); } else { UiHelper.NotifyUser("No depth info is captured for this point!"); } } else { UiHelper.NotifyUser(RockOverlapsWarningMsg); } } else // rock already in list { rocksOnWallViewModel.SelectedRock = rockCorrespondsToCanvasPt; boulderWidthSlider.Value = rockCorrespondsToCanvasPt.BCanvasWidth; boulderHeightSlider.Value = rockCorrespondsToCanvasPt.BCanvasHeight; } } else { UiHelper.NotifyUser("Please take snap shot first."); } }