public void AddCaptured(Manipulator manipulator) { if (!m_CaptureSession.Contains(manipulator)) { m_CaptureSession.Add(manipulator); } }
private void UpdateDragTarget(TimelineClipGUI uiClip, Vector2 point, TimelineWindow.TimelineState state) { List <IBounds> elementsAtPosition = Manipulator.GetElementsAtPosition(state.quadTree, point); TimelineTrackGUI timelineTrackGUI = elementsAtPosition.OfType <TimelineTrackGUI>().FirstOrDefault((TimelineTrackGUI t) => MoveClip.ValidateClipDrag(t.track, uiClip.clip)); this.m_HasValidDropTarget = (timelineTrackGUI != null && timelineTrackGUI.track.IsCompatibleWithItem(uiClip.clip)); if (this.m_HasValidDropTarget) { AnimationTrack animationTrack = timelineTrackGUI.track as AnimationTrack; float start = state.PixelToTime(this.m_PreviewRect.get_x()); float end = state.PixelToTime(this.m_PreviewRect.get_xMax()); bool hasValidDropTarget; if (animationTrack != null && animationTrack.CanConvertToClipMode()) { hasValidDropTarget = ((animationTrack.animClip.get_startTime() < start || animationTrack.animClip.get_stopTime() > end) && (start <animationTrack.animClip.get_startTime() || end> animationTrack.animClip.get_stopTime())); } else { float num = end - start; start = Math.Max(start, 0f); end = start + num; hasValidDropTarget = (!timelineTrackGUI.track.clips.Any((TimelineClip x) => x.start >= (double)start && x.end <= (double)end) && !timelineTrackGUI.track.clips.Any((TimelineClip x) => (double)start >= x.start && (double)end <= x.end)); } this.m_HasValidDropTarget = hasValidDropTarget; } this.m_DropTarget = ((!this.m_HasValidDropTarget) ? null : timelineTrackGUI); }
public MagnetEngine(IAttractable attractable, IAttractionHandler attractionHandler, TimelineWindow.TimelineState state) { this.m_Attractable = attractable; this.m_AttractionHandler = attractionHandler; this.m_State = state; Rect timeAreaBounds = TimelineWindow.instance.timeAreaBounds; timeAreaBounds.set_height(3.40282347E+38f); List <IBounds> elementsInRectangle = Manipulator.GetElementsInRectangle(state.quadTree, timeAreaBounds); IEnumerable <ISnappable> enumerable = elementsInRectangle.OfType <ISnappable>(); this.AddMagnet(0.0, timeAreaBounds, state); this.AddMagnet(state.time, timeAreaBounds, state); this.AddMagnet(state.timeline.get_duration(), timeAreaBounds, state); foreach (ISnappable current in enumerable) { IEnumerable <Edge> enumerable2 = current.SnappableEdgesFor(attractable); foreach (Edge current2 in enumerable2) { this.AddMagnet(current2.time, timeAreaBounds, state); } } }
public override void Init(IControl parent) { parent.MouseDown += delegate(object target, Event evt, TimelineWindow.TimelineState state) { bool result; if (state.IsCurrentEditingASequencerTextField()) { result = base.IgnoreEvent(); } else if (evt.get_button() != 0 && evt.get_button() != 1) { result = base.IgnoreEvent(); } else if (evt.get_modifiers() == 4) { result = base.IgnoreEvent(); } else if (TimelineWindow.instance.sequenceHeaderBounds.Contains(evt.get_mousePosition())) { foreach (TimelineTrackBaseGUI current in TimelineWindow.instance.allTracks) { Rect headerBounds = current.headerBounds; headerBounds.set_y(headerBounds.get_y() + TimelineWindow.instance.treeviewBounds.get_y()); if (headerBounds.Contains(evt.get_mousePosition())) { result = base.IgnoreEvent(); return(result); } } if (evt.get_modifiers() == null) { SelectionManager.Clear(); } result = base.IgnoreEvent(); } else { this.m_ActiveRect = TimelineWindow.instance.clipArea; if (!this.m_ActiveRect.Contains(evt.get_mousePosition())) { result = base.IgnoreEvent(); } else { List <IBounds> elementsAtPosition = Manipulator.GetElementsAtPosition(state.quadTree, evt.get_mousePosition()); bool flag; if (!RectangleSelect.CanStartRectableSelect(evt, elementsAtPosition, out flag)) { if (flag) { RectangleSelect.HandleReselection(elementsAtPosition); } else { RectangleSelect.HandleSingleSelection(evt, state, elementsAtPosition); } result = base.IgnoreEvent(); } else { state.captured.Add(target as IControl); this.m_IsCaptured = true; this.m_Start = evt.get_mousePosition(); this.m_End = evt.get_mousePosition(); if (RectangleSelect.CanClearSelection(evt)) { SelectionManager.Clear(); } result = base.IgnoreEvent(); } } } return(result); }; parent.KeyDown += delegate(object target, Event evt, TimelineWindow.TimelineState state) { bool result; if (this.m_IsCaptured && evt.get_keyCode() == 27) { state.captured.Remove(target as IControl); this.m_IsCaptured = false; result = base.ConsumeEvent(); } else { result = base.IgnoreEvent(); } return(result); }; parent.MouseUp += delegate(object target, Event evt, TimelineWindow.TimelineState state) { bool result; if (!this.m_IsCaptured) { if (evt.get_modifiers() == null && evt.get_button() == 0 && SelectionManager.IsMultiSelect()) { List <IBounds> elementsAtPosition = Manipulator.GetElementsAtPosition(state.quadTree, evt.get_mousePosition()); TimelineItemGUI timelineItemGUI = RectangleSelect.PickItemGUI(elementsAtPosition); if (timelineItemGUI != null && SelectionManager.Contains(timelineItemGUI.item)) { SelectionManager.Clear(); SelectionManager.Add(timelineItemGUI.item); } } result = base.IgnoreEvent(); } else { state.captured.Remove(target as IControl); this.m_IsCaptured = false; Rect r = this.CurrentSelectionRect(); if (r.get_width() < 1f || r.get_height() < 1f) { result = base.IgnoreEvent(); } else { List <IBounds> elementsInRectangle = Manipulator.GetElementsInRectangle(state.quadTree, r); if (elementsInRectangle.Count == 0) { result = base.IgnoreEvent(); } else { if (RectangleSelect.CanClearSelection(evt)) { SelectionManager.Clear(); } foreach (IBounds current in elementsInRectangle) { if (!(current is TimelineGroupGUI)) { if (current is TimelineItemGUI) { SelectionManager.Add(((TimelineItemGUI)current).item); } } } result = base.ConsumeEvent(); } } } return(result); }; parent.MouseDrag += delegate(object target, Event evt, TimelineWindow.TimelineState state) { bool result; if (!this.m_IsCaptured) { result = base.IgnoreEvent(); } else { this.m_End = evt.get_mousePosition(); result = base.ConsumeEvent(); } return(result); }; parent.Overlay += new TimelineUIEvent(this.DrawSelection); }
public void RemoveCaptured(Manipulator manipulator) { m_CaptureSession.Remove(manipulator); }
public void AddManipulator(Manipulator m) { m.Init(this); this.m_Manipulators.Add(m); }
private static TimelineTrackGUI GetDropTargetAt(TimelineWindow.TimelineState state, Vector2 point) { List <IBounds> elementsAtPosition = Manipulator.GetElementsAtPosition(state.quadTree, point); return(elementsAtPosition.OfType <TimelineTrackGUI>().FirstOrDefault <TimelineTrackGUI>()); }
private static bool IsOverAnimEditor(Event evt, TimelineWindow.TimelineState state) { List <IBounds> elementsAtPosition = Manipulator.GetElementsAtPosition(state.quadTree, evt.get_mousePosition()); return(elementsAtPosition.Any((IBounds x) => x is InlineCurveEditor)); }
public void AddManipulator(Manipulator m) { m_Manipulators.Add(m); }
public static List <IBounds> GetElementsAtPosition(QuadTree <IBounds> qtree, Vector2 point) { Rect r = new Rect(point.x, point.y, 1f, 1f); return(Manipulator.GetElementsInRectangle(qtree, r)); }