public override void MoveFrame(System.Windows.Forms.MouseEventArgs e, TimeRuler ruler) { int iMousePosition = ((ruler.Orientation == enumOrientation.orHorizontal) ? e.X : e.Y); long lNewMillisecond = (long)ruler.PixelToScaleValue(iMousePosition); if (lNewMillisecond > ruler.CurrentMillisecond) { int iStartDist = DistanceFromHandle(e, ruler, _StartMillisecond); int iEndDist = DistanceFromHandle(e, ruler, _EndMillisecond); if (iStartDist < iEndDist) { if (_StartMillisecond > ruler.CurrentMillisecond && !ruler.KeyFrames.Overlaps(lNewMillisecond, this._EndMillisecond, this)) { _StartMillisecond = lNewMillisecond; } } else { if (_EndMillisecond > ruler.CurrentMillisecond && !ruler.KeyFrames.Overlaps(this._StartMillisecond, lNewMillisecond, this)) { _EndMillisecond = lNewMillisecond; } } ruler.RedrawBitmap(); } }
public override void MoveFrame(System.Windows.Forms.MouseEventArgs e, TimeRuler ruler) { int iMousePosition = ((ruler.Orientation == enumOrientation.orHorizontal) ? e.X : e.Y); long lNewMillisecond = (long)ruler.PixelToScaleValue(iMousePosition); if (lNewMillisecond < ruler.ActualMillisecond) { _StartMillisecond = lNewMillisecond; _EndMillisecond = _StartMillisecond; ruler.RedrawBitmap(); } }
public override void EndMove(System.Windows.Forms.MouseEventArgs e, TimeRuler ruler) { int iMousePosition = ((ruler.Orientation == enumOrientation.orHorizontal) ? e.X : e.Y); long lNewMillisecond = (long)ruler.PixelToScaleValue(iMousePosition); KeyFrame keyClosest = ruler.KeyFrames.FindClosest(KeyFrame.enumKeyFrameType.Snapshot, lNewMillisecond, true); //If we can not find a single frame close to the current end position that is within the current time zone then move //it back to the currenttime. Otherwise move it to the closest key frame. if (keyClosest != null) { SetTimes(keyClosest.StartMillisecond); ruler.CurrentMillisecond = keyClosest.StartMillisecond; ruler.OnCurrentFrameMoved(keyClosest); } else { SetTimes(ruler.ActualMillisecond); ruler.CurrentMillisecond = ruler.ActualMillisecond; ruler.OnCurrentFrameMoved(null); } ruler.RedrawBitmap(); }