rerun-io / rerun

Visualize streams of multimodal data. Fast, easy to use, and simple to integrate. Built in Rust using egui.
https://rerun.io/
Apache License 2.0
6.33k stars 302 forks source link

Spatial2D: allow setting data range / clip rectangle via blueprint & ui #6247

Open Wumpf opened 5 months ago

Wumpf commented 5 months ago

@jleibs and @Wumpf came up with this design for the blueprint interface, comments meant to be ready as-is:

/// Controls the valid range of data for a 2D view.
///
/// Data outside of this range will not be shown.
/// This acts as a maximum outer clipping rectangle for this view.
/// For controlling panning & zoom of a 2D view, see [`VisualBounds`].
///
/// If no data range is set, it will be determined automatically,
/// based on the bounding-box of the data or other camera information present in the view.
table DataRange (
    "attr.rerun.scope": "blueprint",
    "attr.rust.derive": "Copy"
) {
    /// Controls the valid range of data for a 2D view.
    ///
    /// Use this to control the clipping of the view.
    // TODO(jleibs): start out with a 2D range, but make this 3D in the future and use it also on the 3d view?
    range: rerun.components.DataRange ("attr.rerun.component_required", nullable, order: 1000);
}

/// Controls the visual bounds of a 2D view.
///
/// Everything within these bounds are guaranteed to be visible.
/// Somethings outside of these bounds may also be visible due to letterboxing.
/// For controlling the clipping of a 2D view, see [`DataRange`].
///
/// If no visual bounds are set, they default to the [`DataRange`].
/// Note, that if no [`DataRange`] is set, it will be determined automatically,
/// based on the bounding-box of the data or other camera information present in the view.
table VisualBounds2D (
    "attr.rerun.scope": "blueprint",
    "attr.rust.derive": "Copy"
) {
    /// Controls the visible range of a 2D view.
    ///
    /// Use this to control pan & zoom of the view.
    range: rerun.components.VisualBounds2D ("attr.rerun.component_required", nullable, order: 1000);
}
Wumpf commented 5 months ago

For 0.16 we should at least make sure that visual bounds don't change api wise. Implementing DataRange is secondary