fn paint(&self) {
        let data = self.data.borrow();
        if !data.drawing { return; }

        let local_pos = nwg::GlobalCursor::local_position(&self.canvas, None);

        match data.mode {
            AppMode::Draw => self.canvas.paint(local_pos, [40, 40, 40, 255]),
            AppMode::Erase => self.canvas.paint(local_pos, [255, 255, 255, 255]),
        }

        self.canvas.render();
        self.update_texture();
        self.invalidate_canvas();
        data.sync();
    }
/// Paint with the mouse in the canvas
Paint with the mouse in the canvas
Paint with the mouse in the canvas
fn paint(&self) {
        let data = self.data.borrow();
        if !data.drawing { return; }
        let local_pos = nwg::GlobalCursor::local_position(&self.canvas, None);
        match data.mode {
            AppMode::Draw => self.canvas.paint(local_pos, [40, 40, 40, 255]),
            AppMode::Erase => self.canvas.paint(local_pos, [255, 255, 255, 255]),
        }
        self.canvas.render();
        self.update_texture();
        self.invalidate_canvas();
        data.sync();
    }
fn paint ( & self ) { let data = self . data . borrow ( ) ; if ! data . drawing { return ; } let local_pos = nwg :: GlobalCursor :: local_position ( & self . canvas , None ) ; match data . mode { AppMode :: Draw => self . canvas . paint ( local_pos , [ 40 , 40 , 40 , 255 ] ) , AppMode :: Erase => self . canvas . paint ( local_pos , [ 255 , 255 , 255 , 255 ] ) , } self . canvas . render ( ) ; self . update_texture ( ) ; self . invalidate_canvas ( ) ; data . sync ( ) ; }
Paint with the mouse in the canvas
Paint with the mouse in the canvas
&self