@@ -7,7 +7,7 @@ use evalexpr::{EvalexprFloat, ExpressionFunction, FlatNode, HashMapContext, IStr
77
88use crate :: color:: { EntryColor , NUM_COLORS } ;
99use crate :: custom_rendering:: fan_fill_renderer:: FillRule ;
10- use crate :: graph :: plot_elements:: PlotElements ;
10+ use crate :: graph_ui :: plot_elements:: RawPlotElements ;
1111
1212mod entry_processing;
1313mod entry_ui;
@@ -20,23 +20,18 @@ pub const MAX_IMPLICIT_RESOLUTION: usize = 500;
2020pub const MIN_IMPLICIT_RESOLUTION : usize = 10 ;
2121
2222pub struct Entry < T : EvalexprFloat > {
23- pub id : u64 ,
24- pub name : String ,
25- pub active : bool ,
26- pub color : EntryColor ,
27- pub ty : EntryType < T > ,
28- pub plot_elements : PlotElements ,
23+ pub id : u64 ,
24+ pub name : String ,
25+ pub active : bool ,
26+ pub color : EntryColor ,
27+ pub ty : EntryType < T > ,
28+ pub raw_plot_elements : RawPlotElements ,
2929}
3030pub struct ClonedEntry < T : EvalexprFloat > {
3131 pub id : u64 ,
32- // pub color: C,
3332 pub ty : EntryType < T > ,
3433}
3534
36- // impl<T: EvalexprFloat, C:Fn(T,T,T)->Result<Color32,String>> ClonedEntry<T,C> {
37- // fn color(&self) -> Color32 { COLORS[self.color % NUM_COLORS] }
38- // }
39-
4035impl < T : EvalexprFloat + core:: fmt:: Debug > core:: fmt:: Debug for Entry < T > {
4136 fn fmt ( & self , f : & mut core:: fmt:: Formatter < ' _ > ) -> core:: fmt:: Result {
4237 f. debug_struct ( "Entry" )
@@ -52,16 +47,17 @@ impl<T: EvalexprFloat + core::fmt::Debug> core::fmt::Debug for Entry<T> {
5247impl < T : EvalexprFloat + Clone > Clone for Entry < T > {
5348 fn clone ( & self ) -> Self {
5449 Self {
55- id : self . id ,
56- name : self . name . clone ( ) ,
57- active : self . active ,
58- color : self . color . clone ( ) ,
59- ty : self . ty . clone ( ) ,
60- plot_elements : PlotElements :: empty ( ) ,
50+ id : self . id ,
51+ name : self . name . clone ( ) ,
52+ active : self . active ,
53+ color : self . color . clone ( ) ,
54+ ty : self . ty . clone ( ) ,
55+ raw_plot_elements : RawPlotElements :: empty ( ) ,
6156 }
6257 }
6358}
6459impl < T : EvalexprFloat > core:: hash:: Hash for Entry < T > {
60+ // Used for drag and drop
6561 fn hash < H : core:: hash:: Hasher > ( & self , state : & mut H ) { self . id . hash ( state) ; }
6662}
6763
@@ -133,8 +129,6 @@ impl<T: EvalexprFloat> Expr<T> {
133129
134130#[ derive( Clone , Copy , Debug , PartialEq ) ]
135131pub enum FunctionType {
136- // ExpressionX,
137- // ExpressionY,
138132 Expression ,
139133 WithCustomParams ,
140134}
@@ -416,7 +410,7 @@ impl<T: EvalexprFloat> Entry<T> {
416410 color : EntryColor :: DefaultColor ( id as usize % NUM_COLORS ) ,
417411 active : true ,
418412 name : String :: new ( ) ,
419- plot_elements : PlotElements :: empty ( ) ,
413+ raw_plot_elements : RawPlotElements :: empty ( ) ,
420414 ty : EntryType :: Function {
421415 identifier : istr_empty ( ) ,
422416 can_be_drawn : true ,
@@ -440,7 +434,7 @@ impl<T: EvalexprFloat> Entry<T> {
440434 color : EntryColor :: DefaultColor ( id as usize % NUM_COLORS ) ,
441435 active : false ,
442436 name : String :: new ( ) ,
443- plot_elements : PlotElements :: empty ( ) ,
437+ raw_plot_elements : RawPlotElements :: empty ( ) ,
444438 ty : EntryType :: Constant {
445439 istr_name : istr_empty ( ) ,
446440 value : T :: ZERO ,
@@ -457,7 +451,7 @@ impl<T: EvalexprFloat> Entry<T> {
457451 color : EntryColor :: DefaultColor ( id as usize % NUM_COLORS ) ,
458452 active : true ,
459453 name : String :: new ( ) ,
460- plot_elements : PlotElements :: empty ( ) ,
454+ raw_plot_elements : RawPlotElements :: empty ( ) ,
461455 ty : EntryType :: Points {
462456 identifier : istr_empty ( ) ,
463457 points_ty : PointsType :: Separate ( vec ! [ PointEntry :: default ( ) ] ) ,
@@ -471,7 +465,7 @@ impl<T: EvalexprFloat> Entry<T> {
471465 color : EntryColor :: CustomColor ( id) ,
472466 active : true ,
473467 name : String :: new ( ) ,
474- plot_elements : PlotElements :: empty ( ) ,
468+ raw_plot_elements : RawPlotElements :: empty ( ) ,
475469 ty : EntryType :: Color ( ColorEntry { expr : Expr :: from_text ( "" ) , ty : ColorEntryType :: default ( ) } ) ,
476470 }
477471 }
@@ -481,7 +475,7 @@ impl<T: EvalexprFloat> Entry<T> {
481475 color : EntryColor :: DefaultColor ( id as usize % NUM_COLORS ) ,
482476 active : true ,
483477 name : String :: new ( ) ,
484- plot_elements : PlotElements :: empty ( ) ,
478+ raw_plot_elements : RawPlotElements :: empty ( ) ,
485479 ty : EntryType :: Folder { entries : Vec :: new ( ) } ,
486480 }
487481 }
@@ -549,10 +543,6 @@ pub enum PointsType<T: EvalexprFloat> {
549543
550544#[ derive( Clone , Debug , Serialize , Deserialize ) ]
551545pub enum ConstantType {
552- // LoopForwardAndBackward { start: f64, end: f64, forward: bool },
553- // LoopForward { start: f64, end: f64 },
554- // PlayOnce { start: f64, end: f64 },
555- // PlayIndefinitely { start: f64 },
556546 LoopForwardAndBackward { forward : bool } ,
557547 LoopForward ,
558548 PlayOnce ,
@@ -610,7 +600,6 @@ impl ConstantType {
610600
611601pub static RESERVED_NAMES : [ & str ; 2 ] = [ "x" , "y" ] ;
612602
613- pub fn f64_to_value < T : EvalexprFloat > ( x : f64 ) -> Value < T > { Value :: < T > :: Float ( T :: from_f64 ( x) ) }
614603// pub fn f64_to_float<T: EvalexprFloat>(x: f64) -> T { T::f64_to_float(x) }
615604
616605#[ derive( Clone , Debug ) ]
0 commit comments