Remove everything marked deprecated
This commit is contained in:
parent
0db74f3000
commit
1fbce6b2c3
24 changed files with 1 additions and 456 deletions
|
@ -143,43 +143,6 @@ impl ComboBox {
|
|||
}
|
||||
}
|
||||
|
||||
/// A drop-down selection menu with a descriptive label.
|
||||
///
|
||||
/// Deprecated! Use [`ComboBox`] instead!
|
||||
///
|
||||
/// Returns `InnerResponse { inner: None }` if the combo box is closed.
|
||||
///
|
||||
/// ```
|
||||
/// # #[derive(Debug, PartialEq)]
|
||||
/// # enum Enum { First, Second, Third }
|
||||
/// # let mut selected = Enum::First;
|
||||
/// # let mut ui = &mut egui::Ui::__test();
|
||||
/// egui::combo_box_with_label(ui, "Select one!", format!("{:?}", selected), |ui| {
|
||||
/// ui.selectable_value(&mut selected, Enum::First, "First");
|
||||
/// ui.selectable_value(&mut selected, Enum::Second, "Second");
|
||||
/// ui.selectable_value(&mut selected, Enum::Third, "Third");
|
||||
/// });
|
||||
/// ```
|
||||
#[deprecated = "Use egui::ComboBox::from_label instead"]
|
||||
pub fn combo_box_with_label<R>(
|
||||
ui: &mut Ui,
|
||||
label: impl Into<Label>,
|
||||
selected: impl ToString,
|
||||
menu_contents: impl FnOnce(&mut Ui) -> R,
|
||||
) -> InnerResponse<Option<R>> {
|
||||
let label = label.into();
|
||||
let button_id = ui.make_persistent_id(label.text());
|
||||
|
||||
ui.horizontal(|ui| {
|
||||
let mut ir = combo_box(ui, button_id, selected, menu_contents);
|
||||
ir.response
|
||||
.widget_info(|| WidgetInfo::labeled(WidgetType::ComboBox, label.text()));
|
||||
ir.response |= ui.add(label);
|
||||
ir
|
||||
})
|
||||
.inner
|
||||
}
|
||||
|
||||
#[allow(clippy::needless_pass_by_value)]
|
||||
fn combo_box<R>(
|
||||
ui: &mut Ui,
|
||||
|
|
|
@ -23,6 +23,3 @@ pub use {
|
|||
scroll_area::ScrollArea,
|
||||
window::Window,
|
||||
};
|
||||
|
||||
#[allow(deprecated)]
|
||||
pub use panel::TopPanel;
|
||||
|
|
|
@ -548,19 +548,6 @@ impl TopBottomPanel {
|
|||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#[deprecated = "Use TopBottomPanel::top instead"]
|
||||
pub struct TopPanel {}
|
||||
|
||||
#[allow(deprecated)]
|
||||
impl TopPanel {
|
||||
#[deprecated = "Use TopBottomPanel::top instead"]
|
||||
pub fn top(id_source: impl std::hash::Hash) -> TopBottomPanel {
|
||||
TopBottomPanel::top(id_source)
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
/// A panel that covers the remainder of the screen,
|
||||
/// i.e. whatever area is left after adding other panels.
|
||||
///
|
||||
|
|
|
@ -362,12 +362,6 @@ impl Clone for Context {
|
|||
}
|
||||
|
||||
impl Context {
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
#[deprecated = "Use CtxRef::default() instead"]
|
||||
pub fn new() -> CtxRef {
|
||||
CtxRef::default()
|
||||
}
|
||||
|
||||
/// How much space is still available after panels has been added.
|
||||
/// This is the "background" area, what egui doesn't cover with panels (but may cover with windows).
|
||||
/// This is also the area to which windows are constrained.
|
||||
|
@ -697,16 +691,6 @@ impl Context {
|
|||
self.memory().interaction.is_using_pointer()
|
||||
}
|
||||
|
||||
#[deprecated = "Renamed wants_pointer_input"]
|
||||
pub fn wants_mouse_input(&self) -> bool {
|
||||
self.wants_pointer_input()
|
||||
}
|
||||
|
||||
#[deprecated = "Renamed is_using_pointer"]
|
||||
pub fn is_using_mouse(&self) -> bool {
|
||||
self.is_using_pointer()
|
||||
}
|
||||
|
||||
/// If `true`, egui is currently listening on text input (e.g. typing text in a [`TextEdit`]).
|
||||
pub fn wants_keyboard_input(&self) -> bool {
|
||||
self.memory().interaction.focus.focused().is_some()
|
||||
|
|
|
@ -21,9 +21,6 @@ pub struct RawInput {
|
|||
/// * `zoom > 1`: pinch spread
|
||||
pub zoom_delta: f32,
|
||||
|
||||
#[deprecated = "Use instead: `screen_rect: Some(Rect::from_pos_size(Default::default(), screen_size))`"]
|
||||
pub screen_size: Vec2,
|
||||
|
||||
/// Position and size of the area that egui should use.
|
||||
/// Usually you would set this to
|
||||
///
|
||||
|
@ -67,11 +64,9 @@ pub struct RawInput {
|
|||
|
||||
impl Default for RawInput {
|
||||
fn default() -> Self {
|
||||
#![allow(deprecated)] // for screen_size
|
||||
Self {
|
||||
scroll_delta: Vec2::ZERO,
|
||||
zoom_delta: 1.0,
|
||||
screen_size: Default::default(),
|
||||
screen_rect: None,
|
||||
pixels_per_point: None,
|
||||
time: None,
|
||||
|
@ -90,13 +85,11 @@ impl RawInput {
|
|||
/// * [`Self::hovered_files`] is cloned.
|
||||
/// * [`Self::dropped_files`] is moved.
|
||||
pub fn take(&mut self) -> RawInput {
|
||||
#![allow(deprecated)] // for screen_size
|
||||
let zoom = self.zoom_delta;
|
||||
self.zoom_delta = 1.0;
|
||||
RawInput {
|
||||
scroll_delta: std::mem::take(&mut self.scroll_delta),
|
||||
zoom_delta: zoom,
|
||||
screen_size: self.screen_size,
|
||||
screen_rect: self.screen_rect.take(),
|
||||
pixels_per_point: self.pixels_per_point.take(),
|
||||
time: self.time.take(),
|
||||
|
@ -321,11 +314,9 @@ pub enum Key {
|
|||
|
||||
impl RawInput {
|
||||
pub fn ui(&self, ui: &mut crate::Ui) {
|
||||
#![allow(deprecated)] // for screen_size
|
||||
let Self {
|
||||
scroll_delta,
|
||||
zoom_delta,
|
||||
screen_size: _,
|
||||
screen_rect,
|
||||
pixels_per_point,
|
||||
time,
|
||||
|
|
|
@ -83,19 +83,11 @@ impl Default for InputState {
|
|||
impl InputState {
|
||||
#[must_use]
|
||||
pub fn begin_frame(mut self, new: RawInput) -> InputState {
|
||||
#![allow(deprecated)] // for screen_size
|
||||
|
||||
let time = new
|
||||
.time
|
||||
.unwrap_or_else(|| self.time + new.predicted_dt as f64);
|
||||
let unstable_dt = (time - self.time) as f32;
|
||||
let screen_rect = new.screen_rect.unwrap_or_else(|| {
|
||||
if new.screen_size != Default::default() {
|
||||
Rect::from_min_size(Default::default(), new.screen_size) // backwards compatibility
|
||||
} else {
|
||||
self.screen_rect
|
||||
}
|
||||
});
|
||||
let screen_rect = new.screen_rect.unwrap_or(self.screen_rect);
|
||||
self.create_touch_states_for_new_devices(&new.events);
|
||||
for touch_state in self.touch_states.values_mut() {
|
||||
touch_state.begin_frame(time, &new, self.pointer.interact_pos);
|
||||
|
|
|
@ -235,16 +235,6 @@ impl Layout {
|
|||
}
|
||||
}
|
||||
|
||||
#[deprecated = "Use `top_down`"]
|
||||
pub fn vertical(cross_align: Align) -> Self {
|
||||
Self::top_down(cross_align)
|
||||
}
|
||||
|
||||
#[deprecated = "Use `left_to_right`"]
|
||||
pub fn horizontal(cross_align: Align) -> Self {
|
||||
Self::left_to_right().with_cross_align(cross_align)
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn with_main_wrap(self, main_wrap: bool) -> Self {
|
||||
Self { main_wrap, ..self }
|
||||
|
|
|
@ -205,11 +205,6 @@ impl Response {
|
|||
self.ctx.memory().lost_focus(self.id)
|
||||
}
|
||||
|
||||
#[deprecated = "Renamed to lost_focus()"]
|
||||
pub fn lost_kb_focus(&self) -> bool {
|
||||
self.lost_focus()
|
||||
}
|
||||
|
||||
/// Request that this widget get keyboard focus.
|
||||
pub fn request_focus(&self) {
|
||||
self.ctx.memory().request_focus(self.id)
|
||||
|
@ -391,11 +386,6 @@ impl Response {
|
|||
})
|
||||
}
|
||||
|
||||
#[deprecated = "Deprecated 2020-10-01: use `on_hover_text` instead."]
|
||||
pub fn tooltip_text(self, text: impl ToString) -> Self {
|
||||
self.on_hover_text(text)
|
||||
}
|
||||
|
||||
/// When hovered, use this icon for the mouse cursor.
|
||||
pub fn on_hover_cursor(self, cursor: CursorIcon) -> Self {
|
||||
if self.hovered() {
|
||||
|
|
|
@ -34,11 +34,6 @@ impl Sense {
|
|||
}
|
||||
}
|
||||
|
||||
#[deprecated = "Use hover()"]
|
||||
pub fn nothing() -> Self {
|
||||
Sense::hover()
|
||||
}
|
||||
|
||||
/// Sense clicks and hover, but not drags.
|
||||
pub fn click() -> Self {
|
||||
Self {
|
||||
|
|
|
@ -575,26 +575,6 @@ impl Ui {
|
|||
pub fn ui_contains_pointer(&self) -> bool {
|
||||
self.rect_contains_pointer(self.min_rect())
|
||||
}
|
||||
|
||||
#[deprecated = "renamed rect_contains_pointer"]
|
||||
pub fn rect_contains_mouse(&self, rect: Rect) -> bool {
|
||||
self.rect_contains_pointer(rect)
|
||||
}
|
||||
|
||||
#[deprecated = "renamed ui_contains_pointer"]
|
||||
pub fn ui_contains_mouse(&self) -> bool {
|
||||
self.ui_contains_pointer()
|
||||
}
|
||||
|
||||
#[deprecated = "Use: interact(rect, id, Sense::hover())"]
|
||||
pub fn interact_hover(&self, rect: Rect) -> Response {
|
||||
self.interact(rect, self.auto_id_with("hover_rect"), Sense::hover())
|
||||
}
|
||||
|
||||
#[deprecated = "Use: rect_contains_pointer()"]
|
||||
pub fn hovered(&self, rect: Rect) -> bool {
|
||||
self.interact(rect, self.id, Sense::hover()).hovered
|
||||
}
|
||||
}
|
||||
|
||||
/// # Allocating space: where do I put my widgets?
|
||||
|
@ -957,11 +937,6 @@ impl Ui {
|
|||
self.placer.advance_cursor(amount);
|
||||
}
|
||||
|
||||
#[deprecated = "Use add_space instead"]
|
||||
pub fn advance_cursor(&mut self, amount: f32) {
|
||||
self.add_space(amount);
|
||||
}
|
||||
|
||||
/// Shortcut for `add(Label::new(text))`
|
||||
///
|
||||
/// See also [`Label`].
|
||||
|
@ -1020,11 +995,6 @@ impl Ui {
|
|||
Hyperlink::new(url).text(label).ui(self)
|
||||
}
|
||||
|
||||
#[deprecated = "Use `text_edit_singleline` or `text_edit_multiline`"]
|
||||
pub fn text_edit(&mut self, text: &mut String) -> Response {
|
||||
self.text_edit_multiline(text)
|
||||
}
|
||||
|
||||
/// No newlines (`\n`) allowed. Pressing enter key will result in the `TextEdit` losing focus (`response.lost_focus`).
|
||||
///
|
||||
/// See also [`TextEdit`].
|
||||
|
@ -1318,11 +1288,6 @@ impl Ui {
|
|||
InnerResponse::new(ret, response)
|
||||
}
|
||||
|
||||
#[deprecated = "Renamed scope()"]
|
||||
pub fn wrap<R>(&mut self, add_contents: impl FnOnce(&mut Ui) -> R) -> InnerResponse<R> {
|
||||
self.scope(add_contents)
|
||||
}
|
||||
|
||||
/// Redirect shapes to another paint layer.
|
||||
pub fn with_layer_id<R>(
|
||||
&mut self,
|
||||
|
@ -1335,15 +1300,6 @@ impl Ui {
|
|||
})
|
||||
}
|
||||
|
||||
#[deprecated = "Use `ui.allocate_ui` instead"]
|
||||
pub fn add_custom_contents(
|
||||
&mut self,
|
||||
desired_size: Vec2,
|
||||
add_contents: impl FnOnce(&mut Ui),
|
||||
) -> Rect {
|
||||
self.allocate_ui(desired_size, add_contents).response.rect
|
||||
}
|
||||
|
||||
/// A [`CollapsingHeader`] that starts out collapsed.
|
||||
pub fn collapsing<R>(
|
||||
&mut self,
|
||||
|
@ -1454,28 +1410,6 @@ impl Ui {
|
|||
self.allocate_ui_with_layout_dyn(initial_size, layout, Box::new(add_contents))
|
||||
}
|
||||
|
||||
/// Like `horizontal`, but will set up the spacing to match that of a normal label.
|
||||
///
|
||||
/// In particular, the space between widgets is the same width as the space character.
|
||||
///
|
||||
/// You can still add any widgets to the layout (not only Labels).
|
||||
#[deprecated = "Use horizontal instead and set the desired spacing manually with `ui.spacing_mut().item_spacing`"]
|
||||
pub fn horizontal_for_text<R>(
|
||||
&mut self,
|
||||
text_style: TextStyle,
|
||||
add_contents: impl FnOnce(&mut Ui) -> R,
|
||||
) -> InnerResponse<R> {
|
||||
self.scope(|ui| {
|
||||
let row_height = ui.fonts().row_height(text_style);
|
||||
let space_width = ui.fonts().glyph_width(text_style, ' ');
|
||||
let spacing = ui.spacing_mut();
|
||||
spacing.interact_size.y = row_height;
|
||||
spacing.item_spacing.x = space_width;
|
||||
spacing.item_spacing.y = 0.0;
|
||||
ui.horizontal(add_contents).inner
|
||||
})
|
||||
}
|
||||
|
||||
/// Start a ui with horizontal layout that wraps to a new row
|
||||
/// when it reaches the right edge of the `max_size`.
|
||||
/// After you have called this, the function registers the contents as any other widget.
|
||||
|
@ -1496,30 +1430,6 @@ impl Ui {
|
|||
self.horizontal_with_main_wrap(true, add_contents)
|
||||
}
|
||||
|
||||
/// Like `horizontal_wrapped`, but will set up the spacing and
|
||||
/// line size to match that of a normal label.
|
||||
///
|
||||
/// In particular, the space between widgets is the same width as the space character
|
||||
/// and the line spacing is the same as that for text.
|
||||
///
|
||||
/// You can still add any widgets to the layout (not only Labels).
|
||||
#[deprecated = "Use horizontal_wrapped instead and set the desired spacing manually with `ui.spacing_mut().item_spacing`"]
|
||||
pub fn horizontal_wrapped_for_text<R>(
|
||||
&mut self,
|
||||
text_style: TextStyle,
|
||||
add_contents: impl FnOnce(&mut Ui) -> R,
|
||||
) -> InnerResponse<R> {
|
||||
self.scope(|ui| {
|
||||
let row_height = ui.fonts().row_height(text_style);
|
||||
let space_width = ui.fonts().glyph_width(text_style, ' ');
|
||||
let spacing = ui.spacing_mut();
|
||||
spacing.interact_size.y = row_height;
|
||||
spacing.item_spacing.x = space_width;
|
||||
spacing.item_spacing.y = 0.0;
|
||||
ui.horizontal_wrapped(add_contents).inner
|
||||
})
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn horizontal_with_main_wrap<R>(
|
||||
&mut self,
|
||||
|
|
|
@ -57,23 +57,6 @@ pub struct DragValue<'a> {
|
|||
max_decimals: Option<usize>,
|
||||
}
|
||||
|
||||
macro_rules! impl_integer_constructor {
|
||||
($int:ident) => {
|
||||
#[deprecated = "Use DragValue::new instead"]
|
||||
pub fn $int(value: &'a mut $int) -> Self {
|
||||
Self::from_get_set(move |v: Option<f64>| {
|
||||
if let Some(v) = v {
|
||||
*value = v.round() as $int;
|
||||
}
|
||||
*value as f64
|
||||
})
|
||||
.max_decimals(0)
|
||||
.clamp_range($int::MIN..=$int::MAX)
|
||||
.speed(0.25)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
impl<'a> DragValue<'a> {
|
||||
pub fn new<Num: emath::Numeric>(value: &'a mut Num) -> Self {
|
||||
let slf = Self::from_get_set(move |v: Option<f64>| {
|
||||
|
@ -92,37 +75,6 @@ impl<'a> DragValue<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
#[deprecated = "Use DragValue::new instead"]
|
||||
pub fn f32(value: &'a mut f32) -> Self {
|
||||
Self::from_get_set(move |v: Option<f64>| {
|
||||
if let Some(v) = v {
|
||||
*value = v as f32
|
||||
}
|
||||
*value as f64
|
||||
})
|
||||
}
|
||||
|
||||
#[deprecated = "Use DragValue::new instead"]
|
||||
pub fn f64(value: &'a mut f64) -> Self {
|
||||
Self::from_get_set(move |v: Option<f64>| {
|
||||
if let Some(v) = v {
|
||||
*value = v
|
||||
}
|
||||
*value
|
||||
})
|
||||
}
|
||||
|
||||
impl_integer_constructor!(i8);
|
||||
impl_integer_constructor!(u8);
|
||||
impl_integer_constructor!(i16);
|
||||
impl_integer_constructor!(u16);
|
||||
impl_integer_constructor!(i32);
|
||||
impl_integer_constructor!(u32);
|
||||
impl_integer_constructor!(i64);
|
||||
impl_integer_constructor!(u64);
|
||||
impl_integer_constructor!(isize);
|
||||
impl_integer_constructor!(usize);
|
||||
|
||||
pub fn from_get_set(get_set_value: impl 'a + FnMut(Option<f64>) -> f64) -> Self {
|
||||
Self {
|
||||
get_set_value: Box::new(get_set_value),
|
||||
|
@ -147,17 +99,6 @@ impl<'a> DragValue<'a> {
|
|||
self
|
||||
}
|
||||
|
||||
#[deprecated = "Use clamp_range"]
|
||||
pub fn clamp_range_f64(mut self, clamp_range: RangeInclusive<f64>) -> Self {
|
||||
self.clamp_range = clamp_range;
|
||||
self
|
||||
}
|
||||
|
||||
#[deprecated = "Renamed clamp_range"]
|
||||
pub fn range(self, clamp_range: RangeInclusive<f32>) -> Self {
|
||||
self.clamp_range(clamp_range)
|
||||
}
|
||||
|
||||
/// Show a prefix before the number, e.g. "x: "
|
||||
pub fn prefix(mut self, prefix: impl ToString) -> Self {
|
||||
self.prefix = prefix.to_string();
|
||||
|
|
|
@ -63,11 +63,6 @@ impl Label {
|
|||
self
|
||||
}
|
||||
|
||||
#[deprecated = "Use Label::wrap instead"]
|
||||
pub fn multiline(self, multiline: bool) -> Self {
|
||||
self.wrap(multiline)
|
||||
}
|
||||
|
||||
/// The default is [`Style::body_text_style`] (generally [`TextStyle::Body`]).
|
||||
pub fn text_style(mut self, text_style: TextStyle) -> Self {
|
||||
self.text_style = Some(text_style);
|
||||
|
|
|
@ -257,18 +257,6 @@ impl Plot {
|
|||
self
|
||||
}
|
||||
|
||||
#[deprecated = "Renamed center_x_axis"]
|
||||
pub fn symmetrical_x_axis(mut self, on: bool) -> Self {
|
||||
self.center_x_axis = on;
|
||||
self
|
||||
}
|
||||
|
||||
#[deprecated = "Renamed center_y_axis"]
|
||||
pub fn symmetrical_y_axis(mut self, on: bool) -> Self {
|
||||
self.center_y_axis = on;
|
||||
self
|
||||
}
|
||||
|
||||
/// Always keep the x-axis centered. Default: `false`.
|
||||
pub fn center_x_axis(mut self, on: bool) -> Self {
|
||||
self.center_x_axis = on;
|
||||
|
@ -307,13 +295,6 @@ impl Plot {
|
|||
self
|
||||
}
|
||||
|
||||
#[deprecated = "Use `Plot::legend` instead"]
|
||||
/// Whether to show a legend including all named items. Default: `true`.
|
||||
pub fn show_legend(mut self, show: bool) -> Self {
|
||||
self.legend_config = show.then(Legend::default);
|
||||
self
|
||||
}
|
||||
|
||||
/// Show a legend including all named items.
|
||||
pub fn legend(mut self, legend: Legend) -> Self {
|
||||
self.legend_config = Some(legend);
|
||||
|
|
|
@ -26,11 +26,6 @@ impl Default for Separator {
|
|||
}
|
||||
|
||||
impl Separator {
|
||||
#[deprecated = "Use Separator::default() instead"]
|
||||
pub fn new() -> Self {
|
||||
Self::default()
|
||||
}
|
||||
|
||||
/// How much space we take up. The line is painted in the middle of this.
|
||||
pub fn spacing(mut self, spacing: f32) -> Self {
|
||||
self.spacing = spacing;
|
||||
|
|
|
@ -66,22 +66,6 @@ pub struct Slider<'a> {
|
|||
max_decimals: Option<usize>,
|
||||
}
|
||||
|
||||
macro_rules! impl_integer_constructor {
|
||||
($int:ident) => {
|
||||
#[deprecated = "Use Slider::new instead"]
|
||||
pub fn $int(value: &'a mut $int, range: RangeInclusive<$int>) -> Self {
|
||||
let range_f64 = (*range.start() as f64)..=(*range.end() as f64);
|
||||
Self::from_get_set(range_f64, move |v: Option<f64>| {
|
||||
if let Some(v) = v {
|
||||
*value = v.round() as $int
|
||||
}
|
||||
*value as f64
|
||||
})
|
||||
.integer()
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
impl<'a> Slider<'a> {
|
||||
pub fn new<Num: emath::Numeric>(value: &'a mut Num, range: RangeInclusive<Num>) -> Self {
|
||||
let range_f64 = range.start().to_f64()..=range.end().to_f64();
|
||||
|
@ -99,38 +83,6 @@ impl<'a> Slider<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
#[deprecated = "Use Slider::new instead"]
|
||||
pub fn f32(value: &'a mut f32, range: RangeInclusive<f32>) -> Self {
|
||||
let range_f64 = (*range.start() as f64)..=(*range.end() as f64);
|
||||
Self::from_get_set(range_f64, move |v: Option<f64>| {
|
||||
if let Some(v) = v {
|
||||
*value = v as f32
|
||||
}
|
||||
*value as f64
|
||||
})
|
||||
}
|
||||
|
||||
#[deprecated = "Use Slider::new instead"]
|
||||
pub fn f64(value: &'a mut f64, range: RangeInclusive<f64>) -> Self {
|
||||
Self::from_get_set(range, move |v: Option<f64>| {
|
||||
if let Some(v) = v {
|
||||
*value = v
|
||||
}
|
||||
*value
|
||||
})
|
||||
}
|
||||
|
||||
impl_integer_constructor!(i8);
|
||||
impl_integer_constructor!(u8);
|
||||
impl_integer_constructor!(i16);
|
||||
impl_integer_constructor!(u16);
|
||||
impl_integer_constructor!(i32);
|
||||
impl_integer_constructor!(u32);
|
||||
impl_integer_constructor!(i64);
|
||||
impl_integer_constructor!(u64);
|
||||
impl_integer_constructor!(isize);
|
||||
impl_integer_constructor!(usize);
|
||||
|
||||
pub fn from_get_set(
|
||||
range: RangeInclusive<f64>,
|
||||
get_set_value: impl 'a + FnMut(Option<f64>) -> f64,
|
||||
|
@ -224,11 +176,6 @@ impl<'a> Slider<'a> {
|
|||
self
|
||||
}
|
||||
|
||||
#[deprecated = "Use fixed_decimals instead"]
|
||||
pub fn precision(self, precision: usize) -> Self {
|
||||
self.max_decimals(precision)
|
||||
}
|
||||
|
||||
// TODO: we should also have a "min precision".
|
||||
/// Set a minimum number of decimals to display.
|
||||
/// Normally you don't need to pick a precision, as the slider will intelligently pick a precision for you.
|
||||
|
|
|
@ -248,11 +248,6 @@ impl<'t, S: TextBuffer> TextEdit<'t, S> {
|
|||
}
|
||||
|
||||
impl<'t, S: TextBuffer> TextEdit<'t, S> {
|
||||
#[deprecated = "Use `TextEdit::singleline` or `TextEdit::multiline` (or the helper `ui.text_edit_singleline`, `ui.text_edit_multiline`) instead"]
|
||||
pub fn new(text: &'t mut S) -> Self {
|
||||
Self::multiline(text)
|
||||
}
|
||||
|
||||
/// No newlines (`\n`) allowed. Pressing enter key will result in the `TextEdit` losing focus (`response.lost_focus`).
|
||||
pub fn singleline(text: &'t mut S) -> Self {
|
||||
TextEdit {
|
||||
|
|
|
@ -27,23 +27,6 @@ impl Align {
|
|||
/// Convenience for [`Self::Max`]
|
||||
pub const BOTTOM: Self = Self::Max;
|
||||
|
||||
#[deprecated = "Use Self::LEFT"]
|
||||
pub fn left() -> Self {
|
||||
Self::LEFT
|
||||
}
|
||||
#[deprecated = "Use Self::RIGHT"]
|
||||
pub fn right() -> Self {
|
||||
Self::RIGHT
|
||||
}
|
||||
#[deprecated = "Use Self::TOP"]
|
||||
pub fn top() -> Self {
|
||||
Self::TOP
|
||||
}
|
||||
#[deprecated = "Use Self::BOTTOM"]
|
||||
pub fn bottom() -> Self {
|
||||
Self::BOTTOM
|
||||
}
|
||||
|
||||
/// Convert `Min => 0.0`, `Center => 0.5` or `Max => 1.0`.
|
||||
#[inline(always)]
|
||||
pub fn to_factor(self) -> f32 {
|
||||
|
|
|
@ -192,24 +192,6 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
/// Returns `range.start()` if `x <= range.start()`,
|
||||
/// returns `range.end()` if `x >= range.end()`
|
||||
/// and returns `x` elsewhen.
|
||||
#[deprecated = "Use f32::clamp instead"]
|
||||
pub fn clamp<T>(x: T, range: RangeInclusive<T>) -> T
|
||||
where
|
||||
T: Copy + PartialOrd,
|
||||
{
|
||||
crate::emath_assert!(range.start() <= range.end());
|
||||
if x <= *range.start() {
|
||||
*range.start()
|
||||
} else if *range.end() <= x {
|
||||
*range.end()
|
||||
} else {
|
||||
x
|
||||
}
|
||||
}
|
||||
|
||||
/// Round a value to the given number of decimal places.
|
||||
pub fn round_to_decimals(value: f64, decimal_places: usize) -> f64 {
|
||||
// This is a stupid way of doing this, but stupid works.
|
||||
|
|
|
@ -109,11 +109,6 @@ impl Pos2 {
|
|||
/// Same as `Pos2::default()`.
|
||||
pub const ZERO: Self = Self { x: 0.0, y: 0.0 };
|
||||
|
||||
#[deprecated = "Use Pos2::ZERO instead"]
|
||||
pub const fn zero() -> Self {
|
||||
Self::ZERO
|
||||
}
|
||||
|
||||
pub const fn new(x: f32, y: f32) -> Self {
|
||||
Self { x, y }
|
||||
}
|
||||
|
|
|
@ -51,29 +51,6 @@ impl Rect {
|
|||
max: pos2(-f32::NAN, -f32::NAN),
|
||||
};
|
||||
|
||||
#[deprecated = "Use Rect::EVERYTHING"]
|
||||
pub fn everything() -> Self {
|
||||
let inf = f32::INFINITY;
|
||||
Self {
|
||||
min: pos2(-inf, -inf),
|
||||
max: pos2(inf, inf),
|
||||
}
|
||||
}
|
||||
|
||||
#[deprecated = "Use Rect::NOTHING"]
|
||||
pub fn nothing() -> Self {
|
||||
let inf = f32::INFINITY;
|
||||
Self {
|
||||
min: pos2(inf, inf),
|
||||
max: pos2(-inf, -inf),
|
||||
}
|
||||
}
|
||||
|
||||
#[deprecated = "Use Rect::NAN"]
|
||||
pub fn invalid() -> Self {
|
||||
Self::NAN
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub const fn from_min_max(min: Pos2, max: Pos2) -> Self {
|
||||
Rect { min, max }
|
||||
|
@ -297,22 +274,12 @@ impl Rect {
|
|||
self.max.y..=self.min.y
|
||||
}
|
||||
|
||||
#[deprecated = "Use is_negative instead"]
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.max.x < self.min.x || self.max.y < self.min.y
|
||||
}
|
||||
|
||||
/// `width < 0 || height < 0`
|
||||
#[inline(always)]
|
||||
pub fn is_negative(&self) -> bool {
|
||||
self.max.x < self.min.x || self.max.y < self.min.y
|
||||
}
|
||||
|
||||
#[deprecated = "Use !is_negative() instead"]
|
||||
pub fn is_non_negative(&self) -> bool {
|
||||
!self.is_negative()
|
||||
}
|
||||
|
||||
/// `width > 0 && height > 0`
|
||||
#[inline(always)]
|
||||
pub fn is_positive(&self) -> bool {
|
||||
|
|
|
@ -33,11 +33,6 @@ impl Rot2 {
|
|||
/// The identity rotation: nothing rotates
|
||||
pub const IDENTITY: Self = Self { s: 0.0, c: 1.0 };
|
||||
|
||||
#[deprecated = "Use Rot2::IDENTITY"]
|
||||
pub fn identity() -> Self {
|
||||
Self::IDENTITY
|
||||
}
|
||||
|
||||
/// A 𝞃/4 = 90° rotation means rotating the X axis to the Y axis.
|
||||
pub fn from_angle(angle: f32) -> Self {
|
||||
let (s, c) = angle.sin_cos();
|
||||
|
|
|
@ -112,16 +112,6 @@ impl Vec2 {
|
|||
pub const ZERO: Self = Self { x: 0.0, y: 0.0 };
|
||||
pub const INFINITY: Self = Self::splat(f32::INFINITY);
|
||||
|
||||
#[deprecated = "Use Vec2::ZERO instead"]
|
||||
pub fn zero() -> Self {
|
||||
Self::ZERO
|
||||
}
|
||||
|
||||
#[deprecated = "Use Vec2::INFINITY instead"]
|
||||
pub fn infinity() -> Self {
|
||||
Self::INFINITY
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub const fn new(x: f32, y: f32) -> Self {
|
||||
Self { x, y }
|
||||
|
|
|
@ -33,11 +33,6 @@ impl std::ops::IndexMut<usize> for Color32 {
|
|||
}
|
||||
}
|
||||
|
||||
#[deprecated = "Replaced by Color32::from_rgb… family of functions."]
|
||||
pub const fn srgba(r: u8, g: u8, b: u8, a: u8) -> Color32 {
|
||||
Color32::from_rgba_premultiplied(r, g, b, a)
|
||||
}
|
||||
|
||||
impl Color32 {
|
||||
pub const TRANSPARENT: Color32 = Color32::from_rgba_premultiplied(0, 0, 0, 0);
|
||||
pub const BLACK: Color32 = Color32::from_rgb(0, 0, 0);
|
||||
|
@ -89,11 +84,6 @@ impl Color32 {
|
|||
}
|
||||
}
|
||||
|
||||
#[deprecated = "Use from_rgb(..), from_rgba_premultiplied(..) or from_srgba_unmultiplied(..)"]
|
||||
pub const fn new(r: u8, g: u8, b: u8, a: u8) -> Self {
|
||||
Self([r, g, b, a])
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub const fn from_gray(l: u8) -> Self {
|
||||
Self([l, l, l, 255])
|
||||
|
|
|
@ -124,11 +124,6 @@ impl Shape {
|
|||
}
|
||||
}
|
||||
|
||||
#[deprecated = "Renamed convex_polygon"]
|
||||
pub fn polygon(points: Vec<Pos2>, fill: impl Into<Color32>, stroke: impl Into<Stroke>) -> Self {
|
||||
Self::convex_polygon(points, fill, stroke)
|
||||
}
|
||||
|
||||
pub fn circle_filled(center: Pos2, radius: f32, fill_color: impl Into<Color32>) -> Self {
|
||||
Self::Circle {
|
||||
center,
|
||||
|
@ -255,11 +250,6 @@ impl Shape {
|
|||
Self::Mesh(mesh)
|
||||
}
|
||||
|
||||
#[deprecated = "Renamed `mesh`"]
|
||||
pub fn triangles(mesh: Mesh) -> Self {
|
||||
Self::mesh(mesh)
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn texture_id(&self) -> super::TextureId {
|
||||
if let Shape::Mesh(mesh) = self {
|
||||
|
|
Loading…
Reference in a new issue