public static bool AddMarker(this XTrack track, XMarker marker, MarkData data) { if (track.marks != null) { var list = track.marks.ToList(); if (!list.Contains(marker)) { list.Add(marker); list.Sort((x, y) => x.time.CompareTo(y.time)); track.marks = list.ToArray(); var datas = track.data.marks.ToList(); datas.Add(data); track.data.marks = datas.ToArray(); return(true); } } else { track.marks = new XMarker[1]; track.marks[0] = marker; track.data.marks = new[] { data }; } return(false); }
void DeleteRectMark(object arg) { XMarker select = (XMarker)arg; var track = state.seqence.markerTrack; track.RmMarker(select); }
public override void OnInit(XSeqenceObject marker) { this.baseMarker = (XMarker)marker; draging = false; e = Event.current; OnInit(); }
void DrawMarkItem(XMarker mark) { if (IsTimeRange(mark.time)) { float x = TimeToPixel(mark.time); Rect rect = markderRect; rect.x = x - 8; rect.width = markWidth; GUIContent cont = state.config.GetIcon(mark.type); GUI.Box(rect, cont, GUIStyle.none); } }
void _Init() { originMarker = new XMarker(); originMarker.DrawColor = Color.FromArgb(125, Color.Red); aimMarker = new XMarker(); aimMarker.DrawColor = Color.FromArgb(125, Color.Red); spinMarker = new XMarker(); spinMarker.DrawColor = Color.FromArgb(125, Color.Green); //aimTraj = new Trajectory("aimTraj"); //spinTraj = new Trajectory("spinTraj"); aimTraj = new Trajectory("aimTraj"); spinTraj = new Trajectory("spinTraj"); }
public static bool RmMarker(this XTrack track, XMarker marker) { if (track.marks != null) { var list = track.marks.ToList(); if (list.Contains(marker)) { var datas = track.data.marks.ToList(); datas.Remove(marker.Data); track.data.marks = datas.ToArray(); list.Remove(marker); track.marks = list.ToArray(); return(true); } } return(false); }
private void ProcessEvent() { if (e == null) { e = Event.current; } bool inMarkRect = markderRect.Contains(e.mousePosition); switch (e.type) { case (EventType.ContextClick): if (e.button == 1 && inMarkRect) { GenMenu(e); } break; case EventType.MouseDown: if (inMarkRect) { OnMouseDown(e); } break; case EventType.MouseUp: if (draging != null) { var tre = state.seqence.trackTrees; tre[0].SortMark(); } draging = null; break; case EventType.MouseDrag: case EventType.ScrollWheel: OnMarkDrag(e); break; } }
public static XMarker MakeMarker(Type t, float time, XTrack track) { XMarker marker = null; MarkData data = null; if (t == typeof(XJumpMarker)) { data = new JumpMarkData() { time = time }; marker = XSeqenceFactory.GetMarker(track, data); } else if (t == typeof(XSlowMarker)) { data = new SlowMarkData() { time = time, slowRate = 0.5f }; marker = XSeqenceFactory.GetMarker(track, data); } else if (t == typeof(XActiveMark)) { data = new ActiveMarkData() { time = time }; marker = XSeqenceFactory.GetMarker(track, data); } else { Debug.LogError("unknown mark: " + t); } if (marker != null) { track.AddMarker(marker, data); } return(marker); }
void InitializeMarkerHeader() { draging = null; markderRect.width = winArea.width; markderRect.height = WindowConstants.markerRowHeight; }
private void OnMouseDown(Event e) { draging = TrigerMark(e); }