class BBTimelineForegroundCanvas extends BBTimelineCanvas { constructor(parentEl, el) { super(parentEl, el); const a = this; a.initialiseComponents(); } initialiseComponents() { super.initialiseComponents(); const a = this; a.Invalidate(); } Invalidate() { const a = this; const rect = a.Parent.Layer.Background.GraphRectangle; const margin = a.Parent.Layer.Background.Margin; a.Clear(); const startPosY = (rect.Y + a.Parent.Marker.Width); const visibleEvents = a.Parent.FindVisibleEvents(); visibleEvents.forEach(function (e, i) { // Calculate Y position let posY = a.calcMarkerPosition(e.Position.X, startPosY); a.drawVerticalLine(e.Position.X, posY); const markerRectangle = a.drawMarker(e.Position.X, posY, e.BorderColour, e.BackColour); const labelSize = a.drawText((markerRectangle.X + markerRectangle.W + margin), markerRectangle.Y, e.Label, a.Parent.Marker.Font, a.Parent.Marker.ForeColour, "left"); e.Position = { X: e.Position.X, Y: posY }; e.HitBox = { X: markerRectangle.X, Y: markerRectangle.Y, W: (markerRectangle.W + margin + labelSize.Width + a.Parent.Marker.CollisionMargin), H: markerRectangle.H }; if (a.Parent.Debug) a.drawRectangle(e.HitBox, "red"); if (a.Parent.Debug) console.log(e); }); } calcMarkerPosition(x, y) { const a = this; const rect = a.Parent.Layer.Background.GraphRectangle; // Calculate Y position let hasMoved = false; let posY = y; for (let i=0; i