public bool OnMouseLeftDown(Point mouse, Point imageLocation, float imageZoom) { if (metadata == null || screenToolManager == null) { return(false); } // At this point we must know the current timestamp and metadata should be valid. // TODO: Handle magnifier. // TODO: see if this could handle whole image manipulation as well, but at the moment the resizers are stored in the viewport. bool handled = false; ImageToViewportTransformer transformer = new ImageToViewportTransformer(imageLocation, imageZoom); PointF imagePoint = transformer.Untransform(mouse); metadata.AllDrawingTextToNormalMode(); if (screenToolManager.IsUsingHandTool) { // TODO: Change cursor. handled = screenToolManager.HandTool.OnMouseDown(metadata, fixedKeyframe, imagePoint, fixedTimestamp, false); } else { handled = true; CreateNewDrawing(imagePoint, transformer); } return(handled); }
public bool OnMouseLeftMove(Point mouse, Keys modifiers, Point imageLocation, float imageZoom) { if (metadata == null || screenToolManager == null) { return(false); } bool handled = false; ImageToViewportTransformer transformer = new ImageToViewportTransformer(imageLocation, imageZoom); PointF imagePoint = transformer.Untransform(mouse); if (screenToolManager.IsUsingHandTool) { // TODO: handle magnifier. handled = screenToolManager.HandTool.OnMouseMove(metadata, imagePoint, Point.Empty, modifiers); } else { // Setting second point of a drawing. IInitializable drawing = metadata.HitDrawing as IInitializable; if (drawing != null) { drawing.InitializeMove(imagePoint, modifiers); } } return(handled); }
public bool HitTest(Point mouse, Point imageLocation, float imageZoom) { // Note: at the moment this method does not support extra drawings. if (metadata == null) { return(false); } ImageToViewportTransformer transformer = new ImageToViewportTransformer(imageLocation, imageZoom); PointF imagePoint = transformer.Untransform(mouse); int keyframeIndex = 0; return(metadata.IsOnDrawing(keyframeIndex, imagePoint, fixedTimestamp)); }
public void OnMouseUp(Bitmap bitmap, Point mouse, Keys modifiers, Point imageLocation, float imageZoom) { // TODO: Handle magnifier. // TODO: Memorize the action we just finished to enable undo. // TODO: keep tool or change tool. // m_ActiveTool = m_ActiveTool.KeepTool ? m_ActiveTool : m_PointerTool; if (screenToolManager.IsUsingHandTool) { screenToolManager.HandTool.OnMouseUp(); metadata.AllDrawingTextToNormalMode(); metadata.UpdateTrackPoint(bitmap); } ImageToViewportTransformer transformer = new ImageToViewportTransformer(imageLocation, imageZoom); PointF imagePoint = transformer.Untransform(mouse); metadata.InitializeCommit(null, imagePoint); screenToolManager.AfterToolUse(); }