use crate::decorations::legend::{Legend, LegendDrawPlan};
use crate::layout::fit::{FitScope, PlanError};
use crate::layout::PixelRect;
use crate::Error;
pub(super) fn measure(
registered: Option<&crate::orchestrator::registration::PlotRegistration<'_>>,
panel: PixelRect,
minimum: f64,
theme: &crate::text::TextRequestContext<'_, '_>,
scope: &FitScope,
content_plot: Option<&crate::spec::PlotMeasureContext<'_, '_>>,
) -> Result<(PixelRect, Legend), PlanError> {
let descriptor = crate::orchestrator::registration::guide_descriptor(registered)?
.ok_or_else(|| Error::Render("native Heatmap guide was not prepared".into()))?;
crate::layout::interior::guide::native_right(
descriptor,
panel,
minimum,
theme,
scope,
content_plot,
)
}
pub(super) fn select(guide: &Legend, body: PixelRect) -> Result<LegendDrawPlan, Error> {
let bounds = guide.box_at(
body.x1 + guide.metrics.outside_gap,
body.y0 + (body.height() - guide.allocation_height()) / 2.0,
);
guide.select(bounds?)
}