Ejemplo n.º 1
0
        private bool DrawingHitTest(Metadata metadata, int keyFrameIndex, PointF mouseCoordinates, long currentTimeStamp, DistortionHelper distorter, CoordinateSystem transformer)
        {
            bool isOnDrawing    = false;
            int  hitResult      = -1;
            int  currentDrawing = 0;

            Keyframe kf = metadata.Keyframes[keyFrameIndex];

            while (hitResult < 0 && currentDrawing < kf.Drawings.Count)
            {
                hitResult = kf.Drawings[currentDrawing].HitTest(mouseCoordinates, currentTimeStamp, distorter, transformer, transformer.Zooming);

                if (hitResult < 0)
                {
                    currentDrawing++;
                    continue;
                }

                isOnDrawing        = true;
                selectedObjectType = SelectedObjectType.Drawing;
                metadata.SelectDrawing(kf.Drawings[currentDrawing]);
                metadata.SelectKeyframe(kf);

                if (hitResult > 0)
                {
                    manipulationType = ManipulationType.Resize;
                    resizingHandle   = hitResult;
                }
                else
                {
                    manipulationType = ManipulationType.Move;
                }
            }

            return(isOnDrawing);
        }