public void HandleTranslation(InteractiveImage image, float zoomFactory) { this.hoveredImage = image; hoveredImage.Hovered = true; pts_gathered++; if (isResizing) { return; } var handClosed = handData.FingerCount <= 1; if (isDragging) { hoveredImage.Translate((handData.PalmPoint.Value.X - startDragPoint.X) * zoomFactory, (handData.PalmPoint.Value.Y - startDragPoint.Y) * zoomFactory); } if (handClosed) { //if (pts_gathered % 2 == 0) startDragPoint = new Point(handData.PalmPoint.Value.X, handData.PalmPoint.Value.Y, 0); /*else { startDragPoint.X += handData.PalmPoint.Value.X; startDragPoint.Y += handData.PalmPoint.Value.Y; startDragPoint.X = startDragPoint.X / pts_gathered % 2; startDragPoint.Y = startDragPoint.Y / pts_gathered % 2; }*/ } isDragging = handClosed; }
public void HandleTranslation(InteractiveImage image, float zoomFactory) { this.hoveredImage = image; hoveredImage.Hovered = true; pts_gathered++; if (isResizing) { return; } var handClosed = handData.FingerCount <= 1; if (isDragging) { hoveredImage.Translate((handData.PalmPoint.Value.X - startDragPoint.X) * zoomFactory, (handData.PalmPoint.Value.Y - startDragPoint.Y) * zoomFactory); } if (handClosed) { //if (pts_gathered % 2 == 0) startDragPoint = new Point(handData.PalmPoint.Value.X, handData.PalmPoint.Value.Y, 0); /*else * { * startDragPoint.X += handData.PalmPoint.Value.X; * startDragPoint.Y += handData.PalmPoint.Value.Y; * * startDragPoint.X = startDragPoint.X / pts_gathered % 2; * startDragPoint.Y = startDragPoint.Y / pts_gathered % 2; * }*/ } isDragging = handClosed; }
public void HandleTranslation(InteractiveImage image, float zoomFactory) { this.hoveredImage = image; hoveredImage.Hovered = true; if (isResizing) { return; } var handClosed = handData.FingerCount <= 1; if (isDragging) { //// hoveredImage.Translate((handData.PalmPoint.Value.X - startDragPoint.X) * zoomFactory, (handData.PalmPoint.Value.Y - startDragPoint.Y) * zoomFactory); // //deteremine the direction of translation // float dx = (handData.PalmPoint.Value.X - startDragPoint.X); // float dy = (handData.PalmPoint.Value.Y - startDragPoint.Y); // //move from right to left in x direction ,top to down in y direction // if (dx > 0 && dy > 0) // { // controlModel("translate", "+{LEFT 3}"); // controlModel("translate", "+{DOWN 3}"); // } // else if (dx > 0 && dy <0) // { // controlModel("translate", "+{LEFT 3}"); // controlModel("translate", "+{UP 3}"); // } // else if (dx < 0 && dy < 0) // { // controlModel("translate", "+{RIGHT 3}"); // controlModel("translate", "+{UP 3}"); // } // else // { // controlModel("translate", "+{RIGHT 10}"); // controlModel("translate", "+{DOWN 10}"); // } } if (handClosed) { startDragPoint = new Point(handData.FingerPoints[0].Location.X, handData.FingerPoints[0].Location.Y, 0); TargetsListofPoints.Add(new PointR(handData.FingerPoints[0].X, handData.FingerPoints[0].Y, Environment.TickCount)); } isDragging = handClosed; }
private void AddImage() { FileInfo newestFile = null; foreach (string fileName in Directory.GetFiles(@"Y:\\", "*.jpg")) { FileInfo file = new FileInfo(fileName); if (newestFile == null || file.CreationTime > newestFile.CreationTime) { newestFile = file; } } var newImage = new InteractiveImage((System.Drawing.Bitmap)System.Drawing.Bitmap.FromFile(newestFile.FullName), 100, 100); this.images.Add(newImage); }
public IList<InteractiveImage> LoadImages() { var result = new List<InteractiveImage>(); int x = this.startPositionX, y = this.startPositionY; foreach (var imagePath in Directory.GetFiles(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Images"), "*.jpg")) { var newImage = new InteractiveImage((System.Drawing.Bitmap)System.Drawing.Bitmap.FromFile(imagePath), x, y); result.Add(newImage); x += (int)newImage.Area.Size.Width; if (x + newImage.Area.Size.Width > this.maxWidth) { y += (int)newImage.Area.Size.Height; x = startPositionX; } } return result; }
public IList <InteractiveImage> LoadImages() { var result = new List <InteractiveImage>(); int x = this.startPositionX, y = this.startPositionY; foreach (var imagePath in Directory.GetFiles(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Images"), "*.jpg")) { var newImage = new InteractiveImage((System.Drawing.Bitmap)System.Drawing.Bitmap.FromFile(imagePath), x, y); result.Add(newImage); x += (int)newImage.Area.Size.Width; if (x + newImage.Area.Size.Width > this.maxWidth) { y += (int)newImage.Area.Size.Height; x = startPositionX; } } return(result); }
public void HandleTranslation(InteractiveImage image, float zoomFactory) { this.hoveredImage = image; hoveredImage.Hovered = true; if (isResizing) { return; } var handClosed = handData.FingerCount <= 1; if (isDragging) { hoveredImage.Translate((handData.PalmPoint.Value.X - startDragPoint.X) * zoomFactory, (handData.PalmPoint.Value.Y - startDragPoint.Y) * zoomFactory); } if (handClosed) { startDragPoint = new Point(handData.PalmPoint.Value.X, handData.PalmPoint.Value.Y, 0); } isDragging = handClosed; }
private bool ImageContains(InteractiveImage image, Point center) { return(image.Area.Contains(MapPoint(center, this.handDataSource.Size))); }
private void MoveImageToFront(InteractiveImage image) { this.images.Remove(image); this.images.Add(image); }
private bool ImageContains(InteractiveImage image, Point center) { return image.Area.Contains(MapPoint(center, this.handDataSource.Size)); }
private void AddImage() { FileInfo newestFile = null; foreach (string fileName in Directory.GetFiles(@"Y:\\", "*.jpg")) { FileInfo file = new FileInfo(fileName); if (newestFile == null || file.CreationTime > newestFile.CreationTime) newestFile = file; } var newImage = new InteractiveImage((System.Drawing.Bitmap)System.Drawing.Bitmap.FromFile(newestFile.FullName), 100, 100); this.images.Add(newImage); }