Vidka.Core.EditorLogic.MouseDragStart C# (CSharp) Метод

MouseDragStart() публичный Метод

public MouseDragStart ( MouseButtons button, int x, int y, int w, int h ) : void
button MouseButtons
x int
y int
w int
h int
Результат void
        public void MouseDragStart(MouseButtons button, int x, int y, int w, int h)
        {
            mouseX = x; // prob not needed, since it is always set in mouseMove, but whatever

            ___UiTransactionBegin();
            if (CurEditOp == null || CurEditOp.DoesNewMouseDragCancelMe)
            {
                bool anotherClipWasSetFromOriginalTimeline = false;

                // unless we have an active op that requests this drag action,
                // use the mouse press to calculate click collision
                var timeline = Dimdim.collision_whatTimeline(y, h);
                UiObjects.SetTimelineHover(timeline);
                switch (timeline) {
                    case ProjectDimensionsTimelineType.Main:
                        var clip = Dimdim.collision_main(x);
                        UiObjects.SetActiveVideo(clip, Proj);
                        break;
                    case ProjectDimensionsTimelineType.MainEases:
                        var clipEase = Dimdim.collision_mainEases(x);
                        UiObjects.SetActiveVideo(clipEase, Proj);
                        break;
                    case ProjectDimensionsTimelineType.Original:
                        if (UiObjects.CurrentVideoClipHover != null && UiObjects.CurrentVideoClipHover != UiObjects.CurrentClip)
                        {
                            UiObjects.SetActiveVideo(UiObjects.CurrentVideoClipHover, Proj);
                            SetFrameMarker_ShowFrameInPlayer(UiObjects.CurrentClipFrameAbsPos ?? UiObjects.CurrentMarkerFrame);
                            anotherClipWasSetFromOriginalTimeline = true;
                        }
                        if (UiObjects.CurrentAudioClipHover != null && UiObjects.CurrentAudioClipHover != UiObjects.CurrentClip)
                        {
                            UiObjects.SetActiveAudio(UiObjects.CurrentAudioClipHover);
                            SetFrameMarker_ShowFrameInPlayer(UiObjects.CurrentClipFrameAbsPos ?? UiObjects.CurrentMarkerFrame);
                            anotherClipWasSetFromOriginalTimeline = true;
                        }
                        break;
                    case ProjectDimensionsTimelineType.Audios:
                        var aclip = Dimdim.collision_audio(x);
                        UiObjects.SetActiveAudio(aclip);
                        break;
                    default:
                        UiObjects.SetActiveVideo(null, Proj);
                        break;
                }

                ActivateCorrectOp((op) => {
                    return op.TriggerBy_MouseDragStart(button, x, y);
                });

                // update current frame marker on left click press
                if (button == MouseButtons.Left && !previewLauncher.IsPlaying && !anotherClipWasSetFromOriginalTimeline)
                {
                    if (timeline == ProjectDimensionsTimelineType.Original && UiObjects.CurrentClip != null)
                    {
                        var clip = UiObjects.CurrentClip;
                        var cursorFrame = Dimdim.convert_ScreenX2Frame_OriginalTimeline(x, clip.FileLengthFrames, w);
                        if (cursorFrame < 0)
                            cursorFrame = 0;
                        if (cursorFrame >= clip.FrameStartNoEase && cursorFrame < clip.FrameEndNoEase)
                        {
                            UiObjects.SetOriginalTimelinePlaybackMode(false);
                            SetFrameMarker_ShowFrameInPlayer(cursorFrame + (UiObjects.CurrentClipFrameAbsPos ?? 0) - UiObjects.CurrentClip.FrameStartNoEase);
                        }
                        else {
                            // we are outside the clip bounds on the original timeline,
                            // so I assume user wants to view some external segment on original
                            // and I will switch to OriginalTimelinePlayback
                            printFrameToConsole(cursorFrame);
                            UiObjects.SetOriginalTimelinePlaybackMode(true);
                            UiObjects.SetCurrentMarkerFrame(cursorFrame);
                            // show in video player
                            var secOffset = Proj.FrameToSec(cursorFrame);
                            videoPlayer.SetStillFrame(clip.FileName, secOffset);
                        }
                    }
                    else
                    {
                        UiObjects.SetOriginalTimelinePlaybackMode(false);
                        var cursorFrame = Dimdim.convert_ScreenX2Frame(x);
                        if (cursorFrame < 0)
                            cursorFrame = 0;
                        SetFrameMarker_ShowFrameInPlayer(cursorFrame);
                    }
                        // ? (UiObjects.CurrentClipFrameAbsPos ?? 0) - UiObjects.CurrentClip.FrameStart + UiObjects.CurrentClip.FileLengthFrames * x / w
                        // : Dimdim.convert_ScreenX2Frame(x);
                    // NOTE: if you want for negative frames to show original clip's thumb in player, remove this first
                }
            }
            if (CurEditOp != null)
                CurEditOp.MouseDragStart(x, y, w, h);
            ___UiTransactionEnd();
        }
EditorLogic