public EventMoveCommand(TimelineEvent ev) { _event = ev; initialSpan = _event.Span; initialStickHeight = _event.StickHeight; }
public CreateEventCommand(TimelineEvent ev, bool doCmd) { _event = ev; if (doCmd) ToDone(); }
public PlaylistPlayElement(TimelineEvent play, MediaFileSet fileset = null) { Play = play; Title = play.Name; Rate = play.Rate; CamerasLayout = play.CamerasLayout; CamerasConfig = play.CamerasConfig.Clone (); FileSet = fileset; }
public TimelineEventView(Canvas scene, double timelineBottomY, TimelineEvent te, TimelineView timeline) { InitializeComponent(); _timeline = timeline; _timelineBottomY = timelineBottomY; DataContext = te; te.view = this; AddToScene(); UpdatePositionByModel(te); }
public HamTimelineInstance(string timelinePath, TimelineEvent onTimelineEvent) { this.timeline = HamTimeline.Load(timelinePath); this.currentNodeID = HamTimeline.InvalidID; this.variables = new Dictionary<int, VariableValue>(); this.nodeHistory = new List<int>(); this.currentNodeID = HamTimeline.InvalidID; this.currentCharactersInScene = new List<int>(); InitializeVariables(); this.OnTimelineEvent = onTimelineEvent; }
public ActionResult Create(TimelineEvent timelineEvent) { try { // TODO: Add insert logic here timelineEvent = timelineService.Save(timelineEvent); return RedirectToAction("Index"); } catch(Exception ex) { ModelState.AddModelError("Could not Create", ex); return View(timelineEvent); } }
public TimelineDisplayEvent( TimelineEvent e, TimelineTray tray, TimelineBuilder builder ) { if (e.Link == null) { e.Link = String.Empty; } if (e.Description == null) { e.Description = String.Empty; } m_timelineEvent = e; m_selected = e.Selected; m_timelineEvent.PropertyChanged += OnEventPropertyChanged; if (e.HeightOverride == -1.0) { m_eventDescriptionHeight = tray.MainBand.MaxEventHeight; } else { m_eventDescriptionHeight = e.HeightOverride; } if (e.WidthOverride == -1.0) { m_eventDescriptionWidth = tray.DescriptionWidth; } else { m_eventDescriptionWidth = e.WidthOverride; } if (e.TopOverride != -1) { SetCalculatedTop(e.TopOverride); } TimelineBuilder = builder; TimelineTray = tray; UpdateDisplayEvent(); }
public void GenerateEvents( int amount ) { int daysLater; TimelineEvent e; for (int i = 0; i < amount; i++) { // // one day to three weeks // daysLater = m_rnd.Next(1, 21); m_lastDate = m_lastDate.AddDays(daysLater); e = new TimelineEvent(); e.StartDate = m_lastDate; //This is the line that I meant. Commented out will result in all TimelineEvents on the same row //e.EndDate = m_lastDate; e.IsDuration = false; e.Link = "http://www.google.com"; if (i % 3 == 0) { e.EventBrush = new SolidColorBrush(Colors.Red); } else if (i % 2 == 0) { e.EventBrush = new SolidColorBrush(Colors.Blue); } e.Title = String.Format("{0}", m_lastDate.ToShortDateString()); e.Description = "Test Description."; Events.Add(e); } }
public IEnumerator LoadTimeline_Coroutine() { hometeamname = homename.text.ToString(); awayteamname = awayname.text.ToString(); Debug.Log(hometeamname); string retval = ""; yield return StartCoroutine(apiloader.LoadTimeline(value => retval = value)); Debug.Log(retval); JSONNode timelineJson = JSON.Parse(retval); JSONArray events = timelineJson["timeline"].AsArray; foreach(JSONNode eventJSON in events){ string playername = eventJSON["player"]["name"]; string eventtype = eventJSON["parameter"]; //Debug.Log ("team: " + eventJSON["club"]["name"]); bool ishometeam = hometeamname.Contains(eventJSON["club"]["name"]); int minute = Random.Range(0,90);//eventJSON["minute"].AsInt; string stage = eventJSON["stage"]; TimelineEvent timeline_event = new TimelineEvent(playername,eventtype,ishometeam,minute,stage); Timeline.Add(timeline_event); } Timeline = Timeline.OrderBy(TimelineEvent => TimelineEvent.time).ToList(); foreach(TimelineEvent te in Timeline){ GameObject eventText; if(te.isHome){ eventText = Instantiate(hometext); eventText.transform.SetParent(TextParent); eventText.GetComponent<Text>().text = te.time + "' " + te.Playername + " : " + te.eventname; } else{ eventText = Instantiate(awaytext); eventText.transform.SetParent(TextParent); eventText.GetComponent<Text>().text = te.Playername + " : " + te.eventname + " " + te.time + "'"; } eventText.GetComponent<RectTransform>().localScale = Vector3.one; //Debug.Log(te.Playername + " : " + te.eventname); } }
public ActionResult Edit(TimelineEvent timelineEvent) { try { var file = Request.Files["file"]; if (file != null && file.FileName.EndsWith(".png") || file.FileName.EndsWith(".jpg")) { var fullPath = Server.MapPath("/" + file.FileName); file.SaveAs(fullPath); var config = new Amazon.S3.AmazonS3Config { MaxErrorRetry = 0 }; var client = new Amazon.S3.AmazonS3Client("AKIAJTSDXO36LAHQEOJA", "+HW/vJzJ+XApMYhBzVtAYElxiEZIVw24NXTYBtiG", config); var req = new Amazon.S3.Model.PutObjectRequest { BucketName = "10years-dawitisaak", FilePath = fullPath }; var res = client.PutObject(req); timelineEvent.Image = res.AmazonId2; } // TODO: Add update logic here timelineEvent = timelineService.Save(timelineEvent); return RedirectToAction("Details", new { id = timelineEvent.Id }); } catch(Exception ex) { throw ex; ModelState.AddModelError("Could not Edit", ex); return View(timelineEvent); } }
public void Add (object obj, DateTime timestamp) { TimelineEvent te = new TimelineEvent (obj, timestamp); if (IsToday (te)) today.Add (te); else if (IsYesterday (te)) yesterday.Add (te); else if (IsThisWeek (te)) thisweek.Add (te); else if (IsLastWeek (te)) lastweek.Add (te); else if (IsThisMonth (te)) thismonth.Add (te); else if (IsThisYear (te)) thisyear.Add (te); else older.Add (te); }
private bool IsToday (TimelineEvent e) { if (IsThisYear (e) && e.Timestamp.DayOfYear == DateTime.Today.DayOfYear) return true; return false; }
/// <summary> /// Checks an skill for update /// </summary> /// <param name="exportSnippet">Export Snippet</param> /// <param name="objectId">Object Id</param> /// <param name="timelineEvent">Timeline Event</param> /// <returns>Result of update</returns> private async Task <FlexFieldObject> CheckSkillForUpdate(ObjectExportSnippet exportSnippet, string objectId, TimelineEvent timelineEvent) { EvneSkill skill = await _skillDbAccess.GetFlexFieldObjectById(objectId); if (skill == null) { return(null); } await _timelineService.AddTimelineEntry(timelineEvent, exportSnippet.SnippetName, skill.Name, skill.Id); CompareResult result = await _implementationStatusComparer.CompareSkill(skill.Id, skill); if (result.CompareDifference != null && result.CompareDifference.Count > 0) { skill.IsImplemented = false; await _skillDbAccess.UpdateFlexFieldObject(skill); } return(skill); }
public void LoadPlay(TimelineEvent evt) { timeline.LoadPlay(evt); }
void FillTags(Project project, TimelineEvent evt) { Dictionary <string, List <Tag> > tagsByGroup; SizeGroup sgroup = new SizeGroup(SizeGroupMode.Horizontal); if (evt.EventType is AnalysisEventType) { tagsByGroup = (evt.EventType as AnalysisEventType).TagsByGroup; } else { tagsByGroup = new Dictionary <string, List <Tag> > (); } tagsByGroup = tagsByGroup.Concat(project.Dashboard.CommonTagsByGroup) .ToDictionary(x => x.Key, x => x.Value); tagsvbox.PackStart(new HSeparator()); foreach (string grp in tagsByGroup.Keys) { HBox box = new HBox(); Label label = new Label(String.IsNullOrEmpty(grp) ? Catalog.GetString("Common tags") : grp); List <Tag> tags = tagsByGroup [grp]; Table tagstable = new Table((uint)(tags.Count / TAGS_PER_ROW), TAGS_PER_ROW, true); RadioButton first = null; Tag noneTag = new Tag(Catalog.GetString("None")); label.WidthRequest = 200; if (!String.IsNullOrEmpty(grp)) { tags.Insert(0, noneTag); } for (int i = 0; i < tags.Count; i++) { uint row_top, row_bottom, col_left, col_right; Tag t = tags [i]; CheckButton tb; if (String.IsNullOrEmpty(grp)) { tb = new CheckButton(t.Value); } else { if (first == null) { tb = first = new RadioButton(t.Value); } else { tb = new RadioButton(first, t.Value); } } tb.Active = evt.Tags.Contains(t); tb.Toggled += (sender, e) => { if (tb.Active && t != noneTag) { evt.Tags.Add(t); } else { evt.Tags.Remove(t); } }; row_top = (uint)(i / tagstable.NColumns); row_bottom = (uint)row_top + 1; col_left = (uint)i % tagstable.NColumns; col_right = (uint)col_left + 1; tagstable.Attach(tb, col_left, col_right, row_top, row_bottom); } sgroup.AddWidget(label); box.PackStart(label, false, true, 0); box.PackEnd(tagstable, true, true, 0); box.Spacing = 5; tagsvbox.PackStart(box, false, true, 0); tagsvbox.PackStart(new HSeparator()); } tagsvbox.ShowAll(); }
/// <summary> /// Uploads an image to a flex field object or template /// </summary> /// <param name="dbAccess">Db access to use (tempate or object)</param> /// <param name="timelineEvent">Timeline Event to use</param> /// <param name="id">Id of the flex field object</param> /// <returns>Image Name</returns> private async Task <IActionResult> UploadImage(IFlexFieldObjectDbAccess <T> dbAccess, TimelineEvent timelineEvent, string id) { // Validate Date string validateResult = this.ValidateImageUploadData(); if (validateResult != null) { return(StatusCode((int)HttpStatusCode.BadRequest, _localizer[validateResult])); } IFormFile uploadFile = Request.Form.Files[0]; T targetFlexFieldObject = await dbAccess.GetFlexFieldObjectById(id); if (targetFlexFieldObject == null) { return(StatusCode((int)HttpStatusCode.BadRequest, _localizer["CouldNotUploadImage"])); } // Save Image string objectImageFile = string.Empty; try { using (Stream imageStream = _imageAccess.CreateFlexFieldObjectImage(uploadFile.FileName, out objectImageFile)) { uploadFile.CopyTo(imageStream); } string thumbnailFilename = GenerateThumbnailFilename(objectImageFile); if (!_thumbnailService.GenerateThumbnail(objectImageFile, thumbnailFilename)) { thumbnailFilename = null; } string oldImageFile = targetFlexFieldObject.ImageFile; string oldThumbnailImageFile = targetFlexFieldObject.ThumbnailImageFile; targetFlexFieldObject.ImageFile = objectImageFile; targetFlexFieldObject.ThumbnailImageFile = thumbnailFilename; targetFlexFieldObject.IsImplemented = false; await this.SetModifiedData(_userManager, targetFlexFieldObject); await dbAccess.UpdateFlexFieldObject(targetFlexFieldObject); if (!string.IsNullOrEmpty(oldImageFile)) { _imageAccess.CheckAndDeleteUnusedImage(oldImageFile); } if (!string.IsNullOrEmpty(oldThumbnailImageFile)) { _imageAccess.CheckAndDeleteUnusedImage(oldThumbnailImageFile); } await _timelineService.AddTimelineEntry(timelineEvent, targetFlexFieldObject.Name, targetFlexFieldObject.Id); } catch (Exception ex) { _logger.LogError(ex, "Could not upload image"); return(StatusCode((int)HttpStatusCode.InternalServerError, _localizer["CouldNotUploadImage"])); } return(Ok(objectImageFile)); }
void HandleNewDashboardEvent(NewDashboardEvent e) { sentTimelineEvent = e.TimelineEvent.Model; hasSentDashboardEvent = true; }
public ActionResult Description(string id) { TimelineEvent @event = _repo.GetTimelineEvent(id); return(PartialView("Description", @event)); }
public void RemoveEvent(TimelineEvent ev) { _events.Remove(ev); }
public ActionResult Delete(TimelineEvent timelineEvent) { try { // TODO: Add delete logic here timelineService.Delete(timelineEvent.Id); return RedirectToAction("Index"); } catch(Exception ex) { ModelState.AddModelError("Could not Delete", ex); return View(timelineEvent); } }
//public delegate void MarkerCreatedAction(MarkerCreatedEvent evt); //public static event MarkerCreatedAction OnMarkerCreatedEvent; //public delegate void MarkerDestroyedAction(MarkerDestroyedEvent evt); //public static event MarkerDestroyedAction OnMarkerDestroyedEvent; public static void Publish(TimelineEvent evt) { OnTimelineEvent?.Invoke(evt); }
public void AddPlay(TimelineEvent play) { timeline.AddPlay(play); QueueDraw(); }
private bool IsThisMonth (TimelineEvent e) { if (IsThisYear (e) && e.Timestamp.Month == DateTime.Today.Month) return true; return false; }
void HandlePlayLoaded(TimelineEvent play) { treeview.QueueDraw(); }
public static Project CreateProject(bool withEvents = true) { TimelineEvent pl; Project p = new ProjectDummy(); p.Dashboard = DashboardDummy.Default(); p.FileSet = new MediaFileSet(); p.FileSet.Add(new MediaFile(Path.GetTempFileName(), 34000, 25, true, true, "mp4", "h264", "aac", 320, 240, 1.3, null, "Test asset 1")); p.FileSet.Add(new MediaFile(Path.GetTempFileName(), 34000, 25, true, true, "mp4", "h264", "aac", 320, 240, 1.3, null, "Test asset 2")); p.Periods.Replace(new RangeObservableCollection <Period> { new Period { Name = "First Period", Nodes = new RangeObservableCollection <TimeNode> { new TimeNode { Start = new Time(10), Stop = new Time(50) } } }, new Period { Name = "Second Period", Nodes = new RangeObservableCollection <TimeNode> { new TimeNode { Start = new Time(50), Stop = new Time(90) } } }, }); p.UpdateEventTypesAndTimers(); p.IsLoaded = true; if (withEvents) { AnalysisEventButton b = p.Dashboard.List [0] as AnalysisEventButton; /* No tags, no players */ pl = new TimelineEvent { EventType = b.EventType, Start = new Time(0), Stop = new Time(50), FileSet = p.FileSet }; p.Timeline.Add(pl); /* tags, but no players */ b = p.Dashboard.List [1] as AnalysisEventButton; pl = new TimelineEvent { EventType = b.EventType, Start = new Time(20), Stop = new Time(60), FileSet = p.FileSet }; pl.Tags.Add(b.AnalysisEventType.Tags [0]); p.Timeline.Add(pl); /* tags and players */ b = p.Dashboard.List [2] as AnalysisEventButton; pl = new TimelineEvent { EventType = b.EventType, Start = new Time(70), Stop = new Time(100), FileSet = p.FileSet }; pl.Tags.Add(b.AnalysisEventType.Tags [1]); p.Timeline.Add(pl); } return(p); }
/// <summary> /// Eventhandler, bei Mausbewegung über diesem Control /// </summary> /// <param name="sender">Sender</param> /// <param name="e">Argumente</param> private void TimelineControl_MouseMove(object sender, MouseEventArgs e) { if (howToDrag == DragNDrop.MOVE_TIMELINE_BAR) { timelineBarTime = GetTimeAtControlPosition(e.Location, false); Invalidate(); OnTimelineMoved(); } else if (howToDrag == DragNDrop.MOVE_EVENT) { double time = GetTimeAtControlPosition(new Point(e.Location.X + eventToDragOffset, e.Location.Y), true); selectedEntry.MoveEvent(eventToDrag, time); OnEventChanged(new EventChangedEventArgs(m_selectedEntry, eventToDrag, howToDrag)); Invalidate(); } else if (howToDrag == DragNDrop.MOVE_EVENT_START) { selectedEntry.MoveEventStart(eventToDrag, GetTimeAtControlPosition(e.Location, true)); OnEventChanged(new EventChangedEventArgs(m_selectedEntry, eventToDrag, howToDrag)); Invalidate(); } else if (howToDrag == DragNDrop.MOVE_EVENT_END) { selectedEntry.MoveEventEnd(eventToDrag, GetTimeAtControlPosition(e.Location, true)); OnEventChanged(new EventChangedEventArgs(m_selectedEntry, eventToDrag, howToDrag)); Invalidate(); } else if (howToDrag == DragNDrop.NONE) { TimelineEvent te = GetTimelineEventAtControlPosition(e.Location, false); // Mauszeiger ändern, falls über TimelineBar if (Math.Abs(e.X - GetHorizontalClientPositionAtCurrentTime()) < 2) { this.Cursor = Cursors.SizeWE; } // Mauszeiger ändern, falls über Plus/Minus einer Gruppe else if (e.X < rowHeight && GetGroupAtClientPosition(e.Location, true) != null) { this.Cursor = Cursors.Hand; } // Mauszeiger ändern, falls über den Ecken eines Events des selektierten TimelineEntries else if (te != null) { if (Math.Abs(GetClientPositionForTimelineEvent(te).X - e.Location.X) < 3) { this.Cursor = Cursors.SizeWE; } else if (Math.Abs(GetClientPositionForTimelineEvent(te).X + te.eventLength * zoom - e.Location.X) < 3) { this.Cursor = Cursors.SizeWE; } else { this.Cursor = Cursors.SizeAll; } } // Mauszeiger normal else { this.Cursor = Cursors.Default; } } }
/// <summary> /// Adds a timeline event for an external user /// </summary> /// <param name="projectId">Id of the project to associate, if null the project will be loaded</param> /// <param name="timelineEvent">Timeline Event</param> /// <param name="additionalValues">Additional Values</param> /// <returns>Task</returns> public async Task AddExternalTimelineEntry(string projectId, TimelineEvent timelineEvent, params string[] additionalValues) { await AddTimlineEntry(projectId, "", ExternalUserConstants.ExternalUserLoginName, timelineEvent, additionalValues); }
public TimelineEventObject Load(TimelineEvent evt) { return(nodes.FirstOrDefault(n => (n as TimelineEventObject).Event == evt) as TimelineEventObject); }
public void CreateTimelineEvent(TimelineEvent timelineEvent) { throw new System.NotImplementedException(); }
/// <summary> /// Checks an npc for update /// </summary> /// <param name="exportSnippet">Export Snippet</param> /// <param name="objectId">Object Id</param> /// <param name="timelineEvent">Timeline Event</param> /// <returns>Result of update</returns> private async Task <FlexFieldObject> CheckNpcForUpdate(ObjectExportSnippet exportSnippet, string objectId, TimelineEvent timelineEvent) { KortistoNpc npc = await _npcDbAccess.GetFlexFieldObjectById(objectId); if (npc == null) { return(null); } await _timelineService.AddTimelineEntry(timelineEvent, exportSnippet.SnippetName, npc.Name, npc.Id); CompareResult result = await _implementationStatusComparer.CompareNpc(npc.Id, npc); if (result.CompareDifference != null && result.CompareDifference.Count > 0) { npc.IsImplemented = false; await _npcDbAccess.UpdateFlexFieldObject(npc); } return(npc); }
/// <summary> /// Eventhandler beim Drücken der Maustaste /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void TimelineControl_MouseDown(object sender, MouseEventArgs e) { // wurde der Zeitschieber angeklickt? if ((e.Button == MouseButtons.Left) && (Math.Abs(e.X - GetHorizontalClientPositionAtCurrentTime()) < 2)) { // Drag'n'Drop Modus setzen howToDrag = DragNDrop.MOVE_TIMELINE_BAR; } // wurde ein Plus-/Minussysmbol einer Gruppe angeklickt? else if (e.X < rowHeight && GetGroupAtClientPosition(e.Location, true) != null) { TimelineGroup tg = GetGroupAtClientPosition(e.Location, true); tg.collapsed = !tg.collapsed; } // wurde vielleicht was anderes wichtiges angeklickt? else { TimelineEntry newEntry = GetTimelineEntryAtControlPosition(e.Location); TimelineGroup newGroup = GetGroupAtClientPosition(e.Location, false); if (newEntry != m_selectedEntry || newGroup != m_selectedGroup) { m_selectedGroup = newGroup; m_selectedEntry = newEntry; OnSelectionChanged(); } // wurde ein TimelineEntry angeklickt? if (m_selectedEntry != null) { // gucken, ob es sich bei te um ein TrafficLight handelt TrafficLight tl = m_selectedEntry as TrafficLight; if (tl != null) { switch (e.Button) { case MouseButtons.Left: #region TimelineEvent hinzufügen if ((Control.ModifierKeys & Keys.Control) == Keys.Control) { double time = GetTimeAtControlPosition(e.Location, true); // Event hinzufügen, welches die Ampel umschaltet TimelineEvent eventToAdd = new TimelineEvent(time, Math.Min(1, (m_selectedEntry.GetTimeOfNextEvent(time) - time) / 2), Color.Green, tl.SwitchToGreen, tl.SwitchToRed); m_selectedEntry.AddEvent(eventToAdd, true, false); howToDrag = DragNDrop.MOVE_EVENT_END; eventToDrag = eventToAdd; this.Cursor = Cursors.SizeWE; Invalidate(); } #endregion #region TimelineEntry selektieren else { // Drag'n'Drop für Events initialisieren TimelineEvent theEvent = GetTimelineEventAtControlPosition(e.Location, true); if (theEvent != null) { if (Math.Abs(GetClientPositionForTimelineEvent(theEvent).X - e.Location.X) < 3) { howToDrag = DragNDrop.MOVE_EVENT_START; eventToDrag = theEvent; } else if (Math.Abs(GetClientPositionForTimelineEvent(theEvent).X + theEvent.eventLength * zoom - e.Location.X) < 3) { howToDrag = DragNDrop.MOVE_EVENT_END; eventToDrag = theEvent; } else { mouseDownPosition = e.Location; eventToDragOffset = GetClientPositionForTimelineEvent(theEvent).X - e.Location.X; howToDrag = DragNDrop.MOVE_EVENT; eventToDrag = theEvent; } } } #endregion break; case MouseButtons.Right: #region TimelineEvent entfernen if ((Control.ModifierKeys & Keys.Control) == Keys.Control) { double time = GetTimeAtControlPosition(e.Location, false); TimelineEvent eventToRemove = tl.GetEventAtTime(time); tl.RemoveEvent(eventToRemove); } #endregion break; } } } Invalidate(); } }
public abstract void ExportFrameSeries(TimelineEvent play, string snapshotsDir);
/// <summary> /// Erstellt ein neues SelectionChangedEventArgs /// </summary> /// <param name="te">ausgewähltes TimelineEntry</param> /// <param name="ev">ausgewähltes TimelineEvent</param> /// <param name="dragAction">Art des Drag and Drop-Vorganges</param> public EventChangedEventArgs(TimelineEntry te, TimelineEvent ev, DragNDrop dragAction) { this.m_selectedEntry = te; this.m_handeledEvent = ev; this.m_dragAction = dragAction; }
/// <summary> /// Checks an item for update /// </summary> /// <param name="exportSnippet">Export Snippet</param> /// <param name="objectId">Object Id</param> /// <param name="timelineEvent">Timeline Event</param> /// <returns>Result of update</returns> private async Task <FlexFieldObject> CheckItemForUpdate(ObjectExportSnippet exportSnippet, string objectId, TimelineEvent timelineEvent) { StyrItem item = await _itemDbAccess.GetFlexFieldObjectById(objectId); if (item == null) { return(null); } await _timelineService.AddTimelineEntry(timelineEvent, exportSnippet.SnippetName, item.Name, item.Id); CompareResult result = await _implementationStatusComparer.CompareItem(item.Id, item); if (result.CompareDifference != null && result.CompareDifference.Count > 0) { item.IsImplemented = false; await _itemDbAccess.UpdateFlexFieldObject(item); } return(item); }
protected void AddToTimeline(float time, TimelineEvent timelineEvent) { List<TimelineEvent> actionList; if (!timeline.TryGetValue(time, out actionList)) { timeline[time] = new List<TimelineEvent>(); } timeline[time].Add( timelineEvent ); timelineEvent.timeline = this; }
private bool IsThisWeek (TimelineEvent e) { if (e.Timestamp >= ThisWeekSpan) return true; return false; }
/// <summary> /// Adds a timeline event /// </summary> /// <param name="projectId">Id of the project to associate, if null the project will be loaded</param> /// <param name="timelineEvent">Timeline Event</param> /// <param name="additionalValues">Additional Values</param> /// <returns>Task</returns> public async Task AddTimelineEntry(string projectId, TimelineEvent timelineEvent, params string[] additionalValues) { GoNorthUser currentUser; if (string.IsNullOrEmpty(projectId)) { Task <GoNorthUser> currentUserTask = _userManager.GetUserAsync(_httpContext.HttpContext.User); Task <GoNorthProject> projectTask = _userProjectAccess.GetUserProject(); Task.WaitAll(currentUserTask, projectTask); currentUser = currentUserTask.Result; GoNorthProject project = projectTask.Result; projectId = project != null ? project.Id : string.Empty; } else { currentUser = await _userManager.GetUserAsync(_httpContext.HttpContext.User); } string updateId = null; if (_eventMergeTimeSpan > 0) { DateTimeOffset dateLimit = DateTimeOffset.UtcNow.AddMinutes(-_eventMergeTimeSpan); List <TimelineEntry> timelineEntries = await _timelineDbAccess.GetTimelineEntriesByUserInTimeSpan(projectId, currentUser.UserName, timelineEvent, dateLimit); foreach (TimelineEntry curEntry in timelineEntries) { if (curEntry.AdditionalValues == null && additionalValues == null) { updateId = curEntry.Id; break; } else if (curEntry.AdditionalValues == null || additionalValues == null) { continue; } if (curEntry.AdditionalValues.Length != additionalValues.Length) { continue; } bool isNotValid = false; for (int curAdditionalValue = 0; curAdditionalValue < additionalValues.Length; ++curAdditionalValue) { if (curEntry.AdditionalValues[curAdditionalValue] != additionalValues[curAdditionalValue]) { isNotValid = true; break; } } if (isNotValid) { continue; } updateId = curEntry.Id; break; } } TimelineEntry entry = new TimelineEntry(); entry.ProjectId = projectId; entry.Event = timelineEvent; entry.Timestamp = DateTimeOffset.UtcNow; entry.AdditionalValues = additionalValues; entry.Username = currentUser.UserName; entry.UserDisplayName = currentUser.DisplayName; if (string.IsNullOrEmpty(updateId)) { await _timelineDbAccess.CreateTimelineEntry(entry); } else { entry.Id = updateId; await _timelineDbAccess.UpdateTimelineEntry(entry); } }
private bool IsYesterday (TimelineEvent e) { if (e.Timestamp >= YesterdaySpan) return true; return false; }
protected abstract bool IsVisibleByPlayer(TimelineEvent play);
private bool IsThisYear (TimelineEvent e) { if (e.Timestamp.Year == DateTime.Today.Year) return true; return false; }
protected abstract bool IsVisibleByPeriod(TimelineEvent play);
private bool IsLastWeek (TimelineEvent e) { if (e.Timestamp >= LastWeekSpan && e.Timestamp < ThisWeekSpan) return true; return false; }
public void AddEvent(TimelineEvent ev) { _events.Add(ev); }
public override void AddEvent(TimelineEvent play) { play.FileSet = FileSet; play.Project = this; Timeline.Add(play); }
void HandlePlayLoaded(TimelineEvent play) { timeline.LoadPlay(play); }
/// <summary> /// Adds a timeline event /// </summary> /// <param name="projectId">Id of the project to associate, if null the project will be loaded</param> /// <param name="timelineEvent">Timeline Event</param> /// <param name="additionalValues">Additional Values</param> /// <returns>Task</returns> public async Task AddTimelineEntry(string projectId, TimelineEvent timelineEvent, params string[] additionalValues) { GoNorthUser currentUser = await _userManager.GetUserAsync(_httpContext.HttpContext.User); await AddTimlineEntry(projectId, currentUser.DisplayName, currentUser.UserName, timelineEvent, additionalValues); }
void LoadPlay(TimelineEvent play, Time seekTime, bool playing) { if (play != null && Player != null) { play.Playing = true; Player.LoadEvent ( play, seekTime, playing); if (playing) { Player.Play (); } } }
/// <summary> /// Adds a timeline entry with a user /// </summary> /// <param name="projectId">Id of the project to associate, if null the project will be loaded</param> /// <param name="userDisplayName">User Displayname</param> /// <param name="userLoginName">Userl oginname</param> /// <param name="timelineEvent">Timeline Event</param> /// <param name="additionalValues">Additional Values</param> /// <returns>Task</returns> private async Task AddTimlineEntry(string projectId, string userDisplayName, string userLoginName, TimelineEvent timelineEvent, params string[] additionalValues) { if (string.IsNullOrEmpty(projectId)) { GoNorthProject project = await _userProjectAccess.GetUserProject(); projectId = project != null ? project.Id : string.Empty; } string updateId = null; if (_eventMergeTimeSpan > 0) { DateTimeOffset dateLimit = DateTimeOffset.UtcNow.AddMinutes(-_eventMergeTimeSpan); List <TimelineEntry> timelineEntries = await _timelineDbAccess.GetTimelineEntriesByUserInTimeSpan(projectId, userLoginName, timelineEvent, dateLimit); foreach (TimelineEntry curEntry in timelineEntries) { if (curEntry.AdditionalValues == null && additionalValues == null) { updateId = curEntry.Id; break; } else if (curEntry.AdditionalValues == null || additionalValues == null) { continue; } if (curEntry.AdditionalValues.Length != additionalValues.Length) { continue; } bool isNotValid = false; for (int curAdditionalValue = 0; curAdditionalValue < additionalValues.Length; ++curAdditionalValue) { if (curEntry.AdditionalValues[curAdditionalValue] != additionalValues[curAdditionalValue]) { isNotValid = true; break; } } if (isNotValid) { continue; } updateId = curEntry.Id; break; } } TimelineEntry entry = new TimelineEntry(); entry.ProjectId = projectId; entry.Event = timelineEvent; entry.Timestamp = DateTimeOffset.UtcNow; entry.AdditionalValues = additionalValues; entry.Username = userLoginName; entry.UserDisplayName = userDisplayName; if (string.IsNullOrEmpty(updateId)) { await _timelineDbAccess.CreateTimelineEntry(entry); } else { entry.Id = updateId; await _timelineDbAccess.UpdateTimelineEntry(entry); } }
/// <summary> /// Set initial condition and display it /// </summary> /// <param name="timeoutInSeconds"> Max time </param> /// <param name="eventsList"> Links to objects with TimelineEvent data </param> /// <returns> true - successful, false - wrong params </returns> public bool PrepareTimer(float timeoutInSeconds, TimelineEvent[] eventsList) { // Beqause method may be called after event occur (inside FixedUpdate handler), // to prevent initial data corruption timer data update will be happened only on next FixedUpdate bool res = false; if (timeoutInSeconds > 0f) { ResetTimer(); // Stop counting timeout = timeoutInSeconds; // Update max time preparedLink = eventsList; // Update link to events objects needToUpdate = true; // Set flag for data updating on next FixedUpdate prepared = true; // Timer was prepared for starting res = true; } else { Debug.Log("Timeout must be above zero"); } return res; }
void LoadCameraPlay(TimelineEvent play, Time seekTime, bool playing) { if (play != null && Player != null) { play.Playing = true; (Player as PlayerController)?.LoadCameraEvent ( play, seekTime, playing); if (playing) { Player.Play (); } } }
//Draw the layers void DrawLayers(Rect layerRect, Rect gridRect) { bool contextEnabled = false; Handles.color = customGUISkin.GetStyle("MinorTimestamp").normal.textColor; float startY = layerRect.y + HEADER_SIZE; Vector3 mousePosition = Event.current.mousePosition; bool mouseUpUsed = false; for (int i = 0; i < mLayers.Count; i++) { if (mLayers[i] != null) { float layerHeight = mLayers[i].getHeight(); //Draw labels Rect thisLayerRect = new Rect(0, startY, layerRect.width, layerHeight); bevel(ref thisLayerRect, 2.0f); GUI.Box(thisLayerRect, ""); if (Event.current.type == EventType.mouseDown && thisLayerRect.Contains(mousePosition)) { Selection.activeGameObject = mLayers[i].gameObject; } /*if (mRenamingLayer == i) { mLayers[i].name = GUI.TextField(thisLayerRect, mLayers[i].name); if ((Event.current.type == EventType.MouseUp && !thisLayerRect.Contains(mousePosition)) || (Event.current.type == EventType.KeyUp && Event.current.keyCode == KeyCode.Return)) { resetName(i); this.Repaint(); } } else {*/ mLayers[i].open = EditorGUI.Foldout(thisLayerRect, mLayers[i].open, mLayers[i].name); //} //Draw events for (int j = 0; j < mLayers[i].events.Count; j++) { TimelineEvent tempEvent = mLayers[i].events[j]; if (tempEvent != null) { float startTime = tempEvent.startTime; float length = tempEvent.getLength(); float viewStart = startTime / mDisplayTime - mXScrollMin / (mXScrollMax - mXScrollMin); float percentLength = length / mDisplayTime; //Not visible if (viewStart + percentLength < 0 || viewStart > 1) { continue; } bool isSelected = false; for (int index = 0; index < Selection.gameObjects.Length; index++) { if (Selection.gameObjects[index] == tempEvent.gameObject) { isSelected = true; } } if (viewStart < 0) { percentLength += viewStart; viewStart = 0; } if (viewStart + percentLength > 1) { percentLength = 1 - viewStart; } if (percentLength * gridRect.width < MINIMUM_EVENT_SIZE) { percentLength = MINIMUM_EVENT_SIZE / gridRect.width; } Rect eventRect = new Rect(gridRect.x + viewStart * gridRect.width, thisLayerRect.y - 3, percentLength * gridRect.width, layerHeight); //bevel(ref eventRect, 2.0f); //Draw event context if (Event.current.type == EventType.ContextClick && eventRect.Contains(mousePosition)) { mSelectedEvent = tempEvent; mEventMenu.ShowAsContext(); contextEnabled = true; } //Sperate the event's action rect and display rect Rect actionRect = eventRect; //Add the length slider tabs Rect leftSlider = new Rect(); Rect rightSlider = new Rect(); if (tempEvent.gameObject.active && tempEvent.canModifyLength()) { splitRectHorizontal(actionRect, out leftSlider, out actionRect, SLIDER_SIZE); splitRectHorizontal(actionRect, out actionRect, out rightSlider, actionRect.width - SLIDER_SIZE); if (mDragEvents.Count == 0 && Event.current.type == EventType.MouseDown && leftSlider.Contains(mousePosition)) { mMouseClickPosition = mousePosition; } else if (mDragEvents.Count == 0 && Event.current.type == EventType.MouseDrag && leftSlider.Contains(mMouseClickPosition)) { mDragEvents[tempEvent] = new DraggedEvent(); mDragEventType = DRAG_TYPE.EXPAND_LEFT; Undo.RegisterUndo(EditorUtility.CollectDeepHierarchy(new UnityEngine.Object[] { mActiveTimeline }), "Expand Left"); } if (mDragEvents.Count == 0 && Event.current.type == EventType.MouseDown && rightSlider.Contains(mousePosition)) { mMouseClickPosition = mousePosition; } else if (mDragEvents.Count == 0 && Event.current.type == EventType.MouseDrag && rightSlider.Contains(mMouseClickPosition)) { mDragEvents[tempEvent] = new DraggedEvent(); mDragEventType = DRAG_TYPE.EXPAND_RIGHT; mDragEvents[tempEvent].mDragEventPlaceTime = tempEvent.startTime; Undo.RegisterUndo(EditorUtility.CollectDeepHierarchy(new UnityEngine.Object[] { mActiveTimeline }), "Expand Right"); } } //Inspector if (mDragEvents.Count == 0 && Event.current.type == EventType.MouseUp && actionRect.Contains(mousePosition) && !mDraggingTimer) { if (Event.current.control) { UnityEngine.Object[] tempObjects = new GameObject[Selection.gameObjects.Length + 1]; bool wasInList = false; int index = 0; for (index = 0; index < Selection.gameObjects.Length; index++) { tempObjects[index] = Selection.gameObjects[index]; if (tempObjects[index] == tempEvent) { wasInList = true; break; } } if (!wasInList) { tempObjects[index] = tempEvent.gameObject; Selection.objects = tempObjects; } } else { Selection.activeObject = tempEvent.gameObject; } Repaint(); mouseUpUsed = true; } Vector2 deltaMouse = Vector2.zero; //Drag and drop if (tempEvent.gameObject.active) { if (Event.current.type == EventType.MouseDown)//mDragEvents.Count == 0 && Event.current.type == EventType.MouseDown && actionRect.Contains(mousePosition)) { mMouseClickPosition = mousePosition; } else if (mDragEvents.Count == 0 && Event.current.type == EventType.MouseDrag && actionRect.Contains(mMouseClickPosition)) { if (isSelected && Selection.gameObjects.Length > 1) { for (int k = 0; k < Selection.gameObjects.Length; k++) { TimelineEvent tempSelectionEvent = (TimelineEvent)Selection.gameObjects[k].GetComponent<TimelineEvent>(); if (tempSelectionEvent != null) { mDragEvents[tempSelectionEvent] = new DraggedEvent(); mDragEvents[tempSelectionEvent].mLayerOffset = tempEvent.getLayer().layerNumber - tempSelectionEvent.getLayer().layerNumber; } } } mDragEvents[tempEvent] = new DraggedEvent(); mDragEvents[tempEvent].mLayerOffset = 0; mDragEvents[tempEvent].mIsMainEvent = true; mDragEventStartTime = mMouseTime; mDragEventType = DRAG_TYPE.MOVE; mDragEventLength = tempEvent.getLength(); Undo.RegisterUndo(EditorUtility.CollectDeepHierarchy(new UnityEngine.Object[] { mActiveTimeline }), "Move event"); } else if (mDragEvents.Count > 0) { deltaMouse = mousePosition - mMouseClickPosition; } } //This event is being dragged if (mDragEvents.ContainsKey(tempEvent)) { switch (mDragEventType) { case DRAG_TYPE.EXPAND_RIGHT: if (Event.current.type == EventType.MouseUp || mouseOverWindow != this) { if (!mDragEventInvalidPlacement || !CHECK_VALIDITY) { float endPoint = ((mDragEvents[tempEvent].mDragEventPlaceTime + mDragEventLength) / mDisplayTime - mXScrollMin / (mXScrollMax - mXScrollMin)) * gridRect.width + gridRect.x; tempEvent.length = mDragEventLength; refreshEvents(); } mMouseClickPosition = new Vector2(0, 0); mDragEvents.Clear(); mouseUpUsed = true; } else { float mousePoint = (mMouseTime / mDisplayTime - mXScrollMin / (mXScrollMax - mXScrollMin)) * gridRect.width + gridRect.x; float startPoint = eventRect.x; eventRect.width = mousePoint - eventRect.x; eventRect.y += HEADER_SIZE * 2; float tempLength = eventRect.width / gridRect.width * mDisplayTime; checkEventValidity(i, tempEvent, eventRect.x, tempLength, gridRect, ref eventRect); eventRect.width -= startPoint - eventRect.x; eventRect.x += startPoint - eventRect.x; mDragEvents[tempEvent].mDragEventRect = eventRect; mDragEventLength = Mathf.Max(0, eventRect.width / gridRect.width * mDisplayTime + (Mathf.Max(0, mXScrollMin - tempEvent.startTime)) / (mXScrollMax - mXScrollMin) * mDisplayTime); } break; case DRAG_TYPE.EXPAND_LEFT: if (Event.current.type == EventType.MouseUp || mouseOverWindow != this) { if (!mDragEventInvalidPlacement || !CHECK_VALIDITY) { float delta = tempEvent.startTime - mDragEvents[tempEvent].mDragEventPlaceTime; tempEvent.startTime = mDragEvents[tempEvent].mDragEventPlaceTime; tempEvent.length += delta; refreshEvents(); } mMouseClickPosition = new Vector2(0, 0); mDragEvents.Clear(); mouseUpUsed = true; } else { float startPoint = (mMouseTime / mDisplayTime - mXScrollMin / (mXScrollMax - mXScrollMin)) * gridRect.width + gridRect.x; float delta = eventRect.x - startPoint; float rightPoint = eventRect.x + eventRect.width; eventRect.x = startPoint; eventRect.width += delta; eventRect.y += HEADER_SIZE * 2; float tempLength = eventRect.width / gridRect.width * mDisplayTime; checkEventValidity(i, tempEvent, eventRect.x, tempLength, gridRect, ref eventRect); if (eventRect.x > rightPoint - MINIMUM_EVENT_SIZE) { eventRect.x = rightPoint - MINIMUM_EVENT_SIZE; eventRect.width = MINIMUM_EVENT_SIZE; } else { eventRect.width += startPoint - eventRect.x; } mDragEvents[tempEvent].mDragEventRect = eventRect; mDragEvents[tempEvent].mDragEventPlaceTime = Mathf.Min(tempEvent.startTime + tempEvent.length, ((eventRect.x - gridRect.x) / gridRect.width + mXScrollMin / (mXScrollMax - mXScrollMin)) * mDisplayTime); mDragEventLength = tempEvent.startTime + tempEvent.length - mDragEvents[tempEvent].mDragEventPlaceTime;//Mathf.Max(0, eventRect.width / gridRect.width * mDisplayTime + mXScrollMin / (mXScrollMax - mXScrollMin) * mDisplayTime); } break; case DRAG_TYPE.MOVE: //Find layer int currentLayer = 0; float tempLayerHeight = 0; for (; currentLayer < mLayers.Count - 1; currentLayer++) { if (mousePosition.y < tempLayerHeight + mLayers[currentLayer].getHeight()) { break; } tempLayerHeight += mLayers[currentLayer].getHeight(); } currentLayer -= mDragEvents[tempEvent].mLayerOffset; currentLayer = Mathf.Max(0, Mathf.Min(currentLayer, mLayers.Count - 1)); //Clipping eventRect.x += deltaMouse.x; eventRect.y = mLayerSizes[mLayers[currentLayer]] + HEADER_SIZE * 2 - mLayers[currentLayer].getHeight(); if (eventRect.x < gridRect.x) { eventRect.x = gridRect.x; } if (eventRect.xMax > gridRect.xMax) { eventRect.x = gridRect.xMax - eventRect.width; } mDragEventInvalidPlacement = false; //only snap when it's a single selection if (mDragEvents.Count == 1) { checkEventValidity(currentLayer, tempEvent, eventRect.x, tempEvent.getLength(), gridRect, ref eventRect); } mDragEvents[tempEvent].mDragEventPlaceTime = mMouseTime - mDragEventStartTime + startTime; if (mDragEvents[tempEvent].mDragEventPlaceTime < mXScrollMin * mActiveTimeline.length) { mDragEvents[tempEvent].mDragEventPlaceTime = mXScrollMin * mActiveTimeline.length; } else if (mDragEvents[tempEvent].mDragEventPlaceTime + tempEvent.getLength() > mXScrollMax * mActiveTimeline.length) { mDragEvents[tempEvent].mDragEventPlaceTime = mXScrollMax * mActiveTimeline.length - tempEvent.getLength(); } else { mDragEvents[tempEvent].mDragEventPlaceTime = ((eventRect.x - gridRect.x) / gridRect.width + mXScrollMin / (mXScrollMax - mXScrollMin)) * mDisplayTime; } if (mDragEvents[tempEvent].mIsMainEvent && (Event.current.type == EventType.MouseUp || mouseOverWindow != this)) { mMouseClickPosition = new Vector2(0, 0); if (!mDragEventInvalidPlacement || !CHECK_VALIDITY) { foreach (KeyValuePair<TimelineEvent, DraggedEvent> pair in mDragEvents) { int tempLayer = currentLayer - pair.Value.mLayerOffset; tempLayer = Mathf.Max(0, Mathf.Min(tempLayer, mLayers.Count - 1)); pair.Key.transform.parent = mLayers[tempLayer].transform; pair.Key.startTime = pair.Value.mDragEventPlaceTime; } refreshEvents(); } mDragEvents.Clear(); mouseUpUsed = true; } else { mDragEvents[tempEvent].mDragEventRect = eventRect; } break; } this.Repaint(); } else { Color tempColor = GUI.color; if (isSelected) { tempColor = Color.green; } else if (!tempEvent.gameObject.active) { tempColor = Color.black; } DrawEvent(tempEvent, actionRect, tempEvent.startTime, tempEvent.getLength(), tempColor); if (tempEvent.gameObject.active && tempEvent.canModifyLength()) { GUI.Button(leftSlider, ""); GUI.Button(rightSlider, ""); } } } } //Draw dividing lines Vector3 a = new Vector3(0, startY, 0); Vector3 b = new Vector3(gridRect.xMax, startY, 0); Handles.DrawLine(a, b); startY += layerHeight; if (i == mLayers.Count - 1) { a = new Vector3(0, startY, 0); b = new Vector3(gridRect.xMax, startY, 0); Handles.DrawLine(a, b); } //Draw layer context if (!contextEnabled) { Rect contextRect = thisLayerRect; contextRect.width += gridRect.width; if (Event.current.type == EventType.ContextClick && contextRect.Contains(mousePosition)) { mSelectedLayer = i; mLayerMenu.ShowAsContext(); mContextMenuTime = mMouseTime; contextEnabled = true; } } } } //Draw global context if (!contextEnabled) { if (Event.current.type == EventType.ContextClick) { mGlobalMenu.ShowAsContext(); } } //Clear selection if (!mouseUpUsed && Event.current.type == EventType.MouseUp && !mDraggingTimer) { Selection.activeObject = mActiveTimeline.gameObject; } }
virtual public bool canPlayEvent(Timeline timeline, TimelineEvent thisEvent) { return true; }
protected override bool IsVisibleByPeriod(TimelineEvent play) { return(true); }
public void UpdatePositionByModel(TimelineEvent te) { var totalHeight = te.StickHeight + border.Height; Canvas.SetTop(this, _timelineBottomY - totalHeight); Canvas.SetLeft(this, TimeScale.TimeToPosition(te.Span, _timeline.Zoom)); }
public BaseAttack() { Hitmarker = new TimelineEvent(Colors.Blood, '*'); }
/// <summary> /// Set initial condition, display it and start timer /// </summary> /// <param name="timeoutInSeconds"> Max time </param> /// <param name="eventsList"> Links to objects with TimelineEvent data </param> /// <returns> true - successful, false - wrong params </returns> public bool StartTimer(float timeoutInSeconds, TimelineEvent[] eventsList) { bool res = false; res = PrepareTimer(timeoutInSeconds, eventsList); if (res == true) { StartTimer(); } return res; }
void HandleKeyPressed(object sender, HotKey key) { if (openedProject == null) { return; } if (openedProjectType != ProjectType.CaptureProject && openedProjectType != ProjectType.URICaptureProject && openedProjectType != ProjectType.FakeCaptureProject) { KeyAction action; if (player == null) { return; } try { action = Config.Hotkeys.ActionsHotkeys.GetKeyByValue(key); } catch (Exception ex) { /* The dictionary contains 2 equal values for different keys */ Log.Exception(ex); return; } if (action == KeyAction.None) { return; } switch (action) { case KeyAction.FrameUp: player.SeekToNextFrame(); return; case KeyAction.FrameDown: player.SeekToPreviousFrame(); return; case KeyAction.JumpUp: player.StepForward(); return; case KeyAction.JumpDown: player.StepBackward(); return; case KeyAction.DrawFrame: TimelineEvent evt = loadedPlay; if (evt == null && loadedElement is PlaylistPlayElement) { evt = (loadedElement as PlaylistPlayElement).Play; } if (evt != null) { Config.EventsBroker.EmitDrawFrame(evt, -1, player.CamerasConfig [0], true); } return; case KeyAction.TogglePlay: player.TogglePlay(); return; case KeyAction.SpeedUp: player.FramerateUp(); return; case KeyAction.SpeedDown: player.FramerateDown(); return; case KeyAction.CloseEvent: Config.EventsBroker.EmitLoadEvent(null); return; case KeyAction.Prev: HandlePrev(loadedPlaylist); return; case KeyAction.Next: HandleNext(loadedPlaylist); return; } } else { //if (Capturer == null) // return; } }
/// /// <summary> /// Sort function for events by startdate</summary> /// private static int CompareEvents( TimelineEvent a, TimelineEvent b ) { int ret; Debug.Assert(a != null); Debug.Assert(b != null); if (a.StartDate == b.StartDate) { ret = 0; } else if (a.StartDate < b.StartDate) { ret = -1; } else { ret = 1; } return ret; }
void checkEventValidity(int currentLayer, TimelineEvent tempEvent, float draggedStartPoint, float eventLength, Rect gridRect, ref Rect eventRect) { //Snap to other events int snapRange = 0; if (mSnapEnabled) { snapRange = 10; } //Convert to grid space draggedStartPoint -= gridRect.x; mDragEventInvalidPlacement = false; float percentLength = eventLength / mDisplayTime; List<TimelineEvent> tempEvents = mLayers[currentLayer].events; for (int k = 0; k < tempEvents.Count; k++) { if (tempEvents[k] != tempEvent) { float otherViewStart = tempEvents[k].startTime / mDisplayTime - mXScrollMin / (mXScrollMax - mXScrollMin); float otherPercentLength = tempEvents[k].getLength() / mDisplayTime; float distance = draggedStartPoint - (otherViewStart + otherPercentLength) * gridRect.width; float leftDistance = (otherViewStart) * gridRect.width - (draggedStartPoint + percentLength * gridRect.width); if (mSnapEnabled) { if (distance < snapRange && distance > -25) { eventRect.x -= distance; draggedStartPoint -= distance; } if (leftDistance < snapRange && leftDistance > -25) { eventRect.x += leftDistance; draggedStartPoint += leftDistance; } } if (distance > -25 || leftDistance > -25) { mDragEventInvalidPlacement = mDragEventInvalidPlacement || false; } else { mDragEventInvalidPlacement = mDragEventInvalidPlacement || true; } } } }