Removed pub on some things that should be private

This commit is contained in:
Emil Ernerfeldt 2020-12-27 12:56:16 +01:00
parent 442b876cb5
commit 997103a910
5 changed files with 19 additions and 16 deletions

View file

@ -13,14 +13,14 @@ use super::*;
/// * if the window can be collapsed (minimized) to just the title bar (yes, by default) /// * if the window can be collapsed (minimized) to just the title bar (yes, by default)
/// * if there should be a close button (none by default) /// * if there should be a close button (none by default)
pub struct Window<'open> { pub struct Window<'open> {
pub title_label: Label, title_label: Label,
open: Option<&'open mut bool>, open: Option<&'open mut bool>,
pub area: Area, area: Area,
pub frame: Option<Frame>, frame: Option<Frame>,
pub resize: Resize, resize: Resize,
pub scroll: Option<ScrollArea>, scroll: Option<ScrollArea>,
pub collapsible: bool, collapsible: bool,
pub with_title_bar: bool, with_title_bar: bool,
} }
impl<'open> Window<'open> { impl<'open> Window<'open> {

View file

@ -417,7 +417,7 @@ impl Context {
self.memory.lock() self.memory.lock()
} }
pub fn graphics(&self) -> MutexGuard<'_, GraphicLayers> { pub(crate) fn graphics(&self) -> MutexGuard<'_, GraphicLayers> {
self.graphics.lock() self.graphics.lock()
} }
@ -477,23 +477,23 @@ impl Context {
} }
/// Useful for pixel-perfect rendering /// Useful for pixel-perfect rendering
pub fn round_to_pixel(&self, point: f32) -> f32 { pub(crate) fn round_to_pixel(&self, point: f32) -> f32 {
let pixels_per_point = self.pixels_per_point(); let pixels_per_point = self.pixels_per_point();
(point * pixels_per_point).round() / pixels_per_point (point * pixels_per_point).round() / pixels_per_point
} }
/// Useful for pixel-perfect rendering /// Useful for pixel-perfect rendering
pub fn round_pos_to_pixels(&self, pos: Pos2) -> Pos2 { pub(crate) fn round_pos_to_pixels(&self, pos: Pos2) -> Pos2 {
pos2(self.round_to_pixel(pos.x), self.round_to_pixel(pos.y)) pos2(self.round_to_pixel(pos.x), self.round_to_pixel(pos.y))
} }
/// Useful for pixel-perfect rendering /// Useful for pixel-perfect rendering
pub fn round_vec_to_pixels(&self, vec: Vec2) -> Vec2 { pub(crate) fn round_vec_to_pixels(&self, vec: Vec2) -> Vec2 {
vec2(self.round_to_pixel(vec.x), self.round_to_pixel(vec.y)) vec2(self.round_to_pixel(vec.x), self.round_to_pixel(vec.y))
} }
/// Useful for pixel-perfect rendering /// Useful for pixel-perfect rendering
pub fn round_rect_to_pixels(&self, rect: Rect) -> Rect { pub(crate) fn round_rect_to_pixels(&self, rect: Rect) -> Rect {
Rect { Rect {
min: self.round_pos_to_pixels(rect.min), min: self.round_pos_to_pixels(rect.min),
max: self.round_pos_to_pixels(rect.max), max: self.round_pos_to_pixels(rect.max),

View file

@ -116,7 +116,7 @@ impl PaintList {
} }
#[derive(Clone, Default)] #[derive(Clone, Default)]
pub struct GraphicLayers([AHashMap<Id, PaintList>; Order::COUNT]); pub(crate) struct GraphicLayers([AHashMap<Id, PaintList>; Order::COUNT]);
impl GraphicLayers { impl GraphicLayers {
pub fn list(&mut self, layer_id: LayerId) -> &mut PaintList { pub fn list(&mut self, layer_id: LayerId) -> &mut PaintList {

View file

@ -122,11 +122,14 @@ pub fn round_to_decimals(value: f64, decimal_places: usize) -> f64 {
.unwrap_or(value) .unwrap_or(value)
} }
pub fn format_with_minimum_decimals(value: f64, decimals: usize) -> String { pub(crate) fn format_with_minimum_decimals(value: f64, decimals: usize) -> String {
format_with_decimals_in_range(value, decimals..=6) format_with_decimals_in_range(value, decimals..=6)
} }
pub fn format_with_decimals_in_range(value: f64, decimal_range: RangeInclusive<usize>) -> String { pub(crate) fn format_with_decimals_in_range(
value: f64,
decimal_range: RangeInclusive<usize>,
) -> String {
let min_decimals = *decimal_range.start(); let min_decimals = *decimal_range.start();
let max_decimals = *decimal_range.end(); let max_decimals = *decimal_range.end();
debug_assert!(min_decimals <= max_decimals); debug_assert!(min_decimals <= max_decimals);

View file

@ -263,7 +263,7 @@ pub enum FontSource {
Emoji(usize), Emoji(usize),
} }
pub struct FontImplCache { struct FontImplCache {
atlas: Arc<Mutex<TextureAtlas>>, atlas: Arc<Mutex<TextureAtlas>>,
pixels_per_point: f32, pixels_per_point: f32,
rusttype_fonts: std::collections::BTreeMap<String, Arc<rusttype::Font<'static>>>, rusttype_fonts: std::collections::BTreeMap<String, Arc<rusttype::Font<'static>>>,