remove more commented code
This commit is contained in:
+48
-48
@@ -1,10 +1,10 @@
|
||||
use std::{iter, mem, ops::Range};
|
||||
|
||||
use crate::{
|
||||
black, phi, point, quad, rems, AbsoluteLength, BorrowWindow, Bounds, ContentMask, Corners,
|
||||
CornersRefinement, CursorStyle, DefiniteLength, Edges, EdgesRefinement, Font, FontFeatures,
|
||||
FontStyle, FontWeight, Hsla, Length, Pixels, Point, PointRefinement, Rgba, SharedString, Size,
|
||||
SizeRefinement, Styled, TextRun, WindowContext,
|
||||
black, phi, point, quad, rems, AbsoluteLength, BorrowAppContext, BorrowWindow, Bounds,
|
||||
ContentMask, Corners, CornersRefinement, CursorStyle, DefiniteLength, Edges, EdgesRefinement,
|
||||
Font, FontFeatures, FontStyle, FontWeight, Hsla, Length, Pixels, Point, PointRefinement, Rgba,
|
||||
SharedString, Size, SizeRefinement, Styled, TextRun, WindowContext,
|
||||
};
|
||||
use collections::HashSet;
|
||||
use refineable::{Cascade, Refineable};
|
||||
@@ -308,54 +308,54 @@ impl Style {
|
||||
}
|
||||
}
|
||||
|
||||
// pub fn apply_text_style<C, F, R>(&self, cx: &mut C, f: F) -> R
|
||||
// where
|
||||
// C: BorrowAppContext,
|
||||
// F: FnOnce(&mut C) -> R,
|
||||
// {
|
||||
// if self.text.is_some() {
|
||||
// cx.with_text_style(Some(self.text.clone()), f)
|
||||
// } else {
|
||||
// f(cx)
|
||||
// }
|
||||
// }
|
||||
pub fn apply_text_style<C, F, R>(&self, cx: &mut C, f: F) -> R
|
||||
where
|
||||
C: BorrowAppContext,
|
||||
F: FnOnce(&mut C) -> R,
|
||||
{
|
||||
if self.text.is_some() {
|
||||
cx.with_text_style(Some(self.text.clone()), f)
|
||||
} else {
|
||||
f(cx)
|
||||
}
|
||||
}
|
||||
|
||||
// /// Apply overflow to content mask
|
||||
// pub fn apply_overflow<C, F, R>(&self, bounds: Bounds<Pixels>, cx: &mut C, f: F) -> R
|
||||
// where
|
||||
// C: BorrowWindow,
|
||||
// F: FnOnce(&mut C) -> R,
|
||||
// {
|
||||
// let current_mask = cx.content_mask();
|
||||
/// Apply overflow to content mask
|
||||
pub fn apply_overflow<C, F, R>(&self, bounds: Bounds<Pixels>, cx: &mut C, f: F) -> R
|
||||
where
|
||||
C: BorrowWindow,
|
||||
F: FnOnce(&mut C) -> R,
|
||||
{
|
||||
let current_mask = cx.content_mask();
|
||||
|
||||
// let min = current_mask.bounds.origin;
|
||||
// let max = current_mask.bounds.lower_right();
|
||||
let min = current_mask.bounds.origin;
|
||||
let max = current_mask.bounds.lower_right();
|
||||
|
||||
// let mask_bounds = match (
|
||||
// self.overflow.x == Overflow::Visible,
|
||||
// self.overflow.y == Overflow::Visible,
|
||||
// ) {
|
||||
// // x and y both visible
|
||||
// (true, true) => return f(cx),
|
||||
// // x visible, y hidden
|
||||
// (true, false) => Bounds::from_corners(
|
||||
// point(min.x, bounds.origin.y),
|
||||
// point(max.x, bounds.lower_right().y),
|
||||
// ),
|
||||
// // x hidden, y visible
|
||||
// (false, true) => Bounds::from_corners(
|
||||
// point(bounds.origin.x, min.y),
|
||||
// point(bounds.lower_right().x, max.y),
|
||||
// ),
|
||||
// // both hidden
|
||||
// (false, false) => bounds,
|
||||
// };
|
||||
// let mask = ContentMask {
|
||||
// bounds: mask_bounds,
|
||||
// };
|
||||
let mask_bounds = match (
|
||||
self.overflow.x == Overflow::Visible,
|
||||
self.overflow.y == Overflow::Visible,
|
||||
) {
|
||||
// x and y both visible
|
||||
(true, true) => return f(cx),
|
||||
// x visible, y hidden
|
||||
(true, false) => Bounds::from_corners(
|
||||
point(min.x, bounds.origin.y),
|
||||
point(max.x, bounds.lower_right().y),
|
||||
),
|
||||
// x hidden, y visible
|
||||
(false, true) => Bounds::from_corners(
|
||||
point(bounds.origin.x, min.y),
|
||||
point(bounds.lower_right().x, max.y),
|
||||
),
|
||||
// both hidden
|
||||
(false, false) => bounds,
|
||||
};
|
||||
let mask = ContentMask {
|
||||
bounds: mask_bounds,
|
||||
};
|
||||
|
||||
// cx.with_content_mask(Some(mask), f)
|
||||
// }
|
||||
cx.with_content_mask(Some(mask), f)
|
||||
}
|
||||
|
||||
/// Paints the background of an element styled with this style.
|
||||
pub fn paint(
|
||||
|
||||
@@ -3137,13 +3137,6 @@ impl AnyWindowHandle {
|
||||
}
|
||||
}
|
||||
|
||||
// #[cfg(any(test, feature = "test-support"))]
|
||||
// impl From<SmallVec<[u32; 16]>> for StackingOrder {
|
||||
// fn from(small_vec: SmallVec<[u32; 16]>) -> Self {
|
||||
// StackingOrder(small_vec)
|
||||
// }
|
||||
// }
|
||||
|
||||
/// An identifier for an [`Element`](crate::Element).
|
||||
///
|
||||
/// Can be constructed with a string, a number, or both, as well
|
||||
|
||||
Reference in New Issue
Block a user