@@ -45,8 +45,8 @@ pub struct PaletteEditor {
4545 positions : Vec < f32 > ,
4646 spreads : Vec < f32 > ,
4747 active : Option < usize > ,
48- visible_indices : Option < Vec < usize > > ,
49- label_overrides : Vec < ( usize , & ' static str ) > ,
48+ visible_indices : Option < & ' static [ usize ] > ,
49+ label_overrides : & ' static [ ( usize , & ' static str ) ] ,
5050 show_ramp : bool ,
5151 scroll : ScrollGlow ,
5252}
@@ -59,7 +59,7 @@ impl PaletteEditor {
5959 palette,
6060 active : None ,
6161 visible_indices : None ,
62- label_overrides : Vec :: new ( ) ,
62+ label_overrides : & [ ] ,
6363 show_ramp : false ,
6464 scroll : ScrollGlow :: default ( ) ,
6565 }
@@ -69,16 +69,16 @@ impl PaletteEditor {
6969 self . show_ramp = show;
7070 }
7171
72- pub fn set_visible_indices ( & mut self , indices : Option < Vec < usize > > ) {
72+ pub fn set_visible_indices ( & mut self , indices : Option < & ' static [ usize ] > ) {
7373 self . visible_indices = indices;
74- if let ( Some ( active) , Some ( visible) ) = ( self . active , & self . visible_indices )
74+ if let Some ( ( active, visible) ) = self . active . zip ( self . visible_indices )
7575 && !visible. contains ( & active)
7676 {
7777 self . active = None ;
7878 }
7979 }
8080
81- pub fn set_label_overrides ( & mut self , overrides : Vec < ( usize , & ' static str ) > ) {
81+ pub fn set_label_overrides ( & mut self , overrides : & ' static [ ( usize , & ' static str ) ] ) {
8282 self . label_overrides = overrides;
8383 }
8484
@@ -200,7 +200,7 @@ impl PaletteEditor {
200200 pub fn view ( & self ) -> Element < ' _ , PaletteEvent > {
201201 let colors = self . palette . colors ( ) ;
202202 let mut row = Row :: new ( ) . spacing ( 12.0 ) ;
203- if let Some ( indices) = & self . visible_indices {
203+ if let Some ( indices) = self . visible_indices {
204204 for & i in indices {
205205 if let Some ( & color) = colors. get ( i) {
206206 row = row. push ( self . color_picker ( i, color) ) ;
0 commit comments