From 8ce16aba6204cb5c02a709cdf79c309f7b7e0196 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 19 Mar 2024 07:13:34 +0100 Subject: Fix redundant import in `window::redraw_request` --- core/src/window/redraw_request.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core/src/window') diff --git a/core/src/window/redraw_request.rs b/core/src/window/redraw_request.rs index 8a59e83c..b0c000d6 100644 --- a/core/src/window/redraw_request.rs +++ b/core/src/window/redraw_request.rs @@ -13,7 +13,7 @@ pub enum RedrawRequest { #[cfg(test)] mod tests { use super::*; - use crate::time::{Duration, Instant}; + use crate::time::Duration; #[test] fn ordering() { -- cgit From bf93c82fac4519e5320f9caee8bde2fdc1c6e41a Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 19 Mar 2024 05:41:56 +0100 Subject: Try to find an `#iced` element by default on Wasm --- core/src/window/settings/wasm.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'core/src/window') diff --git a/core/src/window/settings/wasm.rs b/core/src/window/settings/wasm.rs index 8e0f1bbc..30e60b6a 100644 --- a/core/src/window/settings/wasm.rs +++ b/core/src/window/settings/wasm.rs @@ -1,11 +1,21 @@ //! Platform specific settings for WebAssembly. /// The platform specific window settings of an application. -#[derive(Debug, Clone, PartialEq, Eq, Default)] +#[derive(Debug, Clone, PartialEq, Eq)] pub struct PlatformSpecific { /// The identifier of a DOM element that will be replaced with the /// application. /// /// If set to `None`, the application will be appended to the HTML body. + /// + /// By default, it is set to `"iced"`. pub target: Option, } + +impl Default for PlatformSpecific { + fn default() -> Self { + Self { + target: Some(String::from("iced")), + } + } +} -- cgit From b19e95fa1844ca726aa5761f2d331fd780854bc6 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Fri, 10 May 2024 22:16:35 +0200 Subject: Add `SpecificWith` variant to `window::Position` --- core/src/window/position.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'core/src/window') diff --git a/core/src/window/position.rs b/core/src/window/position.rs index 73391e75..1c8e86b6 100644 --- a/core/src/window/position.rs +++ b/core/src/window/position.rs @@ -1,4 +1,4 @@ -use crate::Point; +use crate::{Point, Size}; /// The position of a window in a given screen. #[derive(Debug, Clone, Copy, PartialEq)] @@ -15,6 +15,12 @@ pub enum Position { /// at (0, 0) you would have to set the position to /// `(PADDING_X, PADDING_Y)`. Specific(Point), + /// Like [`Specific`], but the window is positioned with the specific coordinates returned by the function. + /// + /// The function receives the window size and the monitor's resolution as input. + /// + /// [`Specific`]: Self::Specific + SpecificWith(fn(Size, Size) -> Point), } impl Default for Position { -- cgit