fn new_select_rect(&mut self, x: i32 , y: i32, color: Color, pattern: i32, window: &mut Window) ->Option<Rect> {
    
         //gets events from orbclient and render helping lines directly into orbclient window 
         let mut orbclient = window.inner.borrow_mut();
         let mut lx = 0;
         let mut ly = 0;
         let mut x = x;
         let mut y = y;
         let mut w = false;
         
        'events: loop{
            for event in orbclient.events() { 
                match event.to_option() {
                   EventOption::Key(key_event) => {println!("{:?}",key_event); break 'events},
                EventOption::Quit(_quit_event) => break 'events,
             EventOption::Scroll(scroll_event) => println!("Scroll not implemented yet..{:?}",scroll_event),
                       EventOption::Mouse(evt) => {
                                                if evt.y < CANVASOFFSET{
                                                    break 'events;
                                                };
                                                if w {
                                                    orbclient.rect_marquee(x,
                                                    y+CANVASOFFSET,
                                                    lx,
                                                    ly+CANVASOFFSET,
                                                    color,
                                                    pattern);
                                                }
                                                w=true;
                                                
                                                orbclient.rect_marquee(x,
                                                y+CANVASOFFSET,
                                                evt.x,
                                                evt.y,
                                                color,
                                                pattern);
                                                lx=evt.x;
                                                ly=evt.y-CANVASOFFSET;
                                                
                                                orbclient.sync();
                                                },
                    EventOption::Button(btn) => {if btn.left {
                                                    
                                                    if lx < x {
                                                        //let tmp =x; x= lx; lx = tmp;
                                                        swap(&mut x, &mut lx);
                                                        
                                                    } 
                                                    
                                                    if ly < y {
                                                        //let tmp = y; y=ly; ly= tmp;
                                                        swap(&mut y, &mut ly);
                                                    }
                                                    
                                                    let dx=lx-x;
                                                    let dy=ly-y;
                                                    //println!("{} {} {} {}",x,y,dx,dy);
                                                    return Some(Rect::new(x,y,dx as u32, dy as u32))
                                                }
                                                if btn.right{
                                                              break 'events;
                                                            //TODO show menu with actions upon selection
                                                }
                                                },
                                event_option => if cfg!(feature = "debug"){
                                                    println!("{:?}", event_option)
                                                }else{}
                }
          }
        }
        None  
    }
/// interactive selection (rectangle) pattern is an integer where 1 means continuuos line , 2 dotted line , 3 dotted line more spaced and so on 
interactive selection (rectangle) pattern is an integer where 1 means continuuos line , 2 dotted line , 3 dotted line more spaced and so on
interactive selection ( rectangle ) pattern is an integer where 1 means continuuos line 2 dotted line 3 dotted line more spaced and so on
fn new_select_rect(&mut self, x: i32 , y: i32, color: Color, pattern: i32, window: &mut Window) ->Option<Rect> {
         //gets events from orbclient and render helping lines directly into orbclient window 
         let mut orbclient = window.inner.borrow_mut();
         let mut lx = 0;
         let mut ly = 0;
         let mut x = x;
         let mut y = y;
         let mut w = false;
        'events: loop{
            for event in orbclient.events() { 
                match event.to_option() {
                   EventOption::Key(key_event) => {println!("{:?}",key_event); break 'events},
                EventOption::Quit(_quit_event) => break 'events,
             EventOption::Scroll(scroll_event) => println!("Scroll not implemented yet..{:?}",scroll_event),
                       EventOption::Mouse(evt) => {
                                                if evt.y < CANVASOFFSET{
                                                    break 'events;
                                                };
                                                if w {
                                                    orbclient.rect_marquee(x,
                                                    y+CANVASOFFSET,
                                                    lx,
                                                    ly+CANVASOFFSET,
                                                    color,
                                                    pattern);
                                                }
                                                w=true;
                                                orbclient.rect_marquee(x,
                                                y+CANVASOFFSET,
                                                evt.x,
                                                evt.y,
                                                color,
                                                pattern);
                                                lx=evt.x;
                                                ly=evt.y-CANVASOFFSET;
                                                orbclient.sync();
                                                },
                    EventOption::Button(btn) => {if btn.left {
                                                    if lx < x {
                                                        //let tmp =x; x= lx; lx = tmp;
                                                        swap(&mut x, &mut lx);
                                                    } 
                                                    if ly < y {
                                                        //let tmp = y; y=ly; ly= tmp;
                                                        swap(&mut y, &mut ly);
                                                    }
                                                    let dx=lx-x;
                                                    let dy=ly-y;
                                                    //println!("{} {} {} {}",x,y,dx,dy);
                                                    return Some(Rect::new(x,y,dx as u32, dy as u32))
                                                }
                                                if btn.right{
                                                              break 'events;
                                                            //TODO show menu with actions upon selection
                                                }
                                                },
                                event_option => if cfg!(feature = "debug"){
                                                    println!("{:?}", event_option)
                                                }else{}
                }
          }
        }
        None  
    }
fn new_select_rect ( & mut self , x : i32 , y : i32 , color : Color , pattern : i32 , window : & mut Window ) -> Option < Rect > { //gets events from orbclient and render helping lines directly into orbclient window  let mut orbclient = window . inner . borrow_mut ( ) ; let mut lx = 0 ; let mut ly = 0 ; let mut x = x ; let mut y = y ; let mut w = false ; ' events : loop { for event in orbclient . events ( ) { match event . to_option ( ) { EventOption :: Key ( key_event ) => { println ! ( " " key_event ) ; break ' events } , EventOption :: Quit ( _quit_event ) => break ' events , EventOption :: Scroll ( scroll_event ) => println ! ( " " scroll_event ) , EventOption :: Mouse ( evt ) => { if evt . y < CANVASOFFSET { break ' events ; } ; if w { orbclient . rect_marquee ( x , y + CANVASOFFSET , lx , ly + CANVASOFFSET , color , pattern ) ; } w = true ; orbclient . rect_marquee ( x , y + CANVASOFFSET , evt . x , evt . y , color , pattern ) ; lx = evt . x ; ly = evt . y - CANVASOFFSET ; orbclient . sync ( ) ; } , EventOption :: Button ( btn ) => { if btn . left { if lx < x { //let tmp =x; x= lx; lx = tmp; swap ( & mut x , & mut lx ) ; } if ly < y { //let tmp = y; y=ly; ly= tmp; swap ( & mut y , & mut ly ) ; } let dx = lx - x ; let dy = ly - y ; //println!("{} {} {} {}",x,y,dx,dy); return Some ( Rect :: new ( x , y , dx as u32 , dy as u32 ) ) } if btn . right { break ' events ; //TODO show menu with actions upon selection } } , event_option => if cfg ! ( feature " " ) { println ! ( " " event_option ) } else { } } } } None }
interactive selection (rectangle) pattern is an integer where 1 means continuuos line , 2 dotted line , 3 dotted line more spaced and so on
interactive selection ( rectangle ) pattern is an integer where 1 means continuuos line 2 dotted line 3 dotted line more spaced and so on
&mut self
x
i32
y
i32
color
Color
pattern
i32
window
&mut Window
&mut self
x
i32
y
i32
color
Color
pattern
i32
window
&mut Window