File tree Expand file tree Collapse file tree 4 files changed +8
-5
lines changed
Expand file tree Collapse file tree 4 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -110,7 +110,7 @@ impl PlayButtonShape {
110110 PlayButtonAction :: SetBegin |
111111 PlayButtonAction :: SetEnd |
112112 PlayButtonAction :: Clear =>
113- theme. colors . ui . of_button ( self . begin_bar_ordinal != 0 || self . end_bar_ordinal != self . bars ) ,
113+ theme. colors . ui . of_button ( self . begin_bar_ordinal != 0 || self . end_bar_ordinal + 1 != self . bars ) ,
114114 }
115115 }
116116}
@@ -164,7 +164,7 @@ impl PlayButton {
164164 should_loop : settings. should_loop ,
165165 bars : tab. bars . len ( ) ,
166166 begin_bar_ordinal : 0 ,
167- end_bar_ordinal : tab. bars . len ( ) ,
167+ end_bar_ordinal : if tab. bars . len ( ) > 0 { tab . bars . len ( ) - 1 } else { 0 } ,
168168 } ;
169169 button_shape. create ( commands, theme, button_entity) ;
170170 button_entity
Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ impl TabState {
6060 self . play_control . is_bar_in_range ( bar_ordinal)
6161 }
6262 pub fn is_bar_selected ( & self , bar_ordinal : usize ) -> bool {
63- if self . play_control . begin_bar_ordinal != 0 || self . play_control . end_bar_ordinal != self . tab . bars . len ( ) {
63+ if self . play_control . begin_bar_ordinal != 0 || self . play_control . end_bar_ordinal + 1 != self . tab . bars . len ( ) {
6464 self . play_control . is_bar_in_range ( bar_ordinal)
6565 } else {
6666 false
Original file line number Diff line number Diff line change @@ -179,8 +179,8 @@ impl ControlView {
179179 midi_state : & mut MidiState ,
180180 play_control_evts : & mut EventWriter < PlayControlEvent > ,
181181 ) {
182- midi_state. play_control . begin_bar_ordinal = 1 ;
183- midi_state. play_control . end_bar_ordinal = midi_state. play_control . bars ;
182+ midi_state. play_control . begin_bar_ordinal = 0 ;
183+ midi_state. play_control . end_bar_ordinal = midi_state. play_control . get_last_car_ordinal ( ) ;
184184 Self :: send_begin_end_evt ( midi_state, play_control_evts) ;
185185 }
186186 pub fn set_begin_bar_ordinal (
Original file line number Diff line number Diff line change @@ -90,6 +90,9 @@ impl PlayControl {
9090 play_speed : PlaySpeed :: new ( tab_meta) ,
9191 }
9292 }
93+ pub fn get_last_car_ordinal ( & self ) -> usize {
94+ if self . bars > 0 { self . bars - 1 } else { 0 }
95+ }
9396 pub fn new ( tab : & Tab ) -> Self {
9497 Self :: _new ( & tab. meta , tab. bars . len ( ) )
9598 }
You can’t perform that action at this time.
0 commit comments