41 lines
1.1 KiB
Rust
41 lines
1.1 KiB
Rust
mod imp;
|
|
use crate::coords::{Mapper, Range};
|
|
use femtovg::{renderer::OpenGl, Canvas, Color, Paint, Path};
|
|
use geo_types::{line_string, LineString, Point};
|
|
use glib::subclass::types::ObjectSubclassIsExt;
|
|
use std::cell::Ref;
|
|
|
|
use super::imp::{RenderStatus, RenderConfig};
|
|
|
|
glib::wrapper! {
|
|
pub struct ExteriorWidget(ObjectSubclass<imp::ExteriorWidget>);
|
|
}
|
|
|
|
impl Default for ExteriorWidget {
|
|
fn default() -> Self {
|
|
Self::new()
|
|
}
|
|
}
|
|
|
|
impl ExteriorWidget {
|
|
pub fn new() -> Self {
|
|
let this: Self = glib::Object::new();
|
|
this
|
|
}
|
|
|
|
pub(super) fn draw(&self, canvas: &mut Canvas<OpenGl>, mapper: Ref<'_, Mapper>, status:Ref<'_, RenderStatus>, _c:Ref<'_, RenderConfig>) {
|
|
let imp = self.imp();
|
|
let canvas_width = canvas.width();
|
|
let canvas_height = canvas.height();
|
|
let padding = [30.0,30.0,30.0,30.0];
|
|
|
|
let w = canvas_width - padding[1] - padding[3];
|
|
let h = canvas_height - padding[0] - padding[2];
|
|
|
|
let paint = Paint::color(Color::white());
|
|
let mut path = Path::new();
|
|
path.rect(padding[3], padding[0], w, h);
|
|
canvas.stroke_path(&path, &paint);
|
|
}
|
|
}
|