Example #1
0
        public void CreateGlyph(Beat beat)
        {
            if (beat.Voice != Voice)
            {
                return;
            }

            // NOTE: the track order will never change. even if the staff behind the renderer changes, the trackIndex will not.
            // so it's okay to access the staff here while creating the glyphs.
            if (Info.ShouldCreateGlyph(Renderer.Settings, beat) && (!Info.HideOnMultiTrack || Renderer.Staff.TrackIndex == 0))
            {
                IsEmpty = false;
                if (FirstBeat == null || beat.IsBefore(FirstBeat))
                {
                    FirstBeat = beat;
                }
                if (LastBeat == null || beat.IsAfter(LastBeat))
                {
                    LastBeat = beat;

                    // for "toEnd" sizing occupy until next follow-up-beat
                    switch (Info.SizingMode)
                    {
                    case EffectBarGlyphSizing.SingleOnBeatToEnd:
                    case EffectBarGlyphSizing.GroupedOnBeatToEnd:
                        if (LastBeat.NextBeat != null)
                        {
                            LastBeat = LastBeat.NextBeat;
                        }
                        break;
                    }
                }


                var glyph = CreateOrResizeGlyph(Info.SizingMode, beat);
                if (glyph.Height > Height)
                {
                    Height = glyph.Height;
                }
            }
        }