Skip to main content

DrawingRenderer

Trait DrawingRenderer 

Source
pub trait DrawingRenderer: Send + Sync {
    // Required methods
    fn render(
        &self,
        drawing: &Drawing,
        painter: &Painter,
        rect: Rect,
        view: &ChartView<'_>,
    );
    fn hit_test(&self, drawing: &Drawing, point: Pos2, tolerance: f32) -> bool;

    // Provided method
    fn settings(&self, _ui: &mut Ui, _settings: &mut Value) -> bool { ... }
}
Expand description

Rendering, picking and settings for a host-defined drawing tool. Anchors are projected by the manager into drawing.points; tool-specific data lives in drawing.custom_settings. Callbacks must tolerate incomplete drawings while the pointer previews their construction.

Required Methods§

Source

fn render( &self, drawing: &Drawing, painter: &Painter, rect: Rect, view: &ChartView<'_>, )

Paints inside the supplied pane clip, using current projected anchors and market data.

Source

fn hit_test(&self, drawing: &Drawing, point: Pos2, tolerance: f32) -> bool

Tests the tool’s geometry in screen points. This result is authoritative, including after painting; returning false keeps custom decorative areas out of selection.

Provided Methods§

Source

fn settings(&self, _ui: &mut Ui, _settings: &mut Value) -> bool

Edits the tool’s settings and returns whether they changed. The manager retains undo, lock checks and persistence notifications. Tools without settings keep the default.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§