From f9a6117e754adf3115524bb596c58c414212ec55 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 15 May 2022 01:36:43 +0100 Subject: [PATCH] Revert "dice: Get size right in preview by setting bbox, breaking other things" This reverts commit 1df93eed42dc37563a7bf5df825f800cb871396d. --- src/dice.rs | 30 +----------------------------- support/imports.rs | 2 +- 2 files changed, 2 insertions(+), 30 deletions(-) diff --git a/src/dice.rs b/src/dice.rs index 45de14dc..59ec135a 100644 --- a/src/dice.rs +++ b/src/dice.rs @@ -317,37 +317,9 @@ impl OutlineTrait for Die { self.surround_outline.outline_path(1.0)? } - // This is not consistent with the surround_path: the surround_path - // does not include the cooldown circle, but this does. The effecti - // is that if the piece needs to be tiled, there is room for the circle. - // This happens when: - // - // * Pieces are added with the CLI. Presumably not many dice so - // this is probably OK. (Size is also returned via ListPieces.) - // * Library preview. Boxes for dice are big enough for the cooldown - // which is shown in the preview. - // * Hidden tiling etc. Not relevant for dice, which do not Mix - // in occultation. - // * "Organise" function. - // * Finding pieces that have been clicked on in the client. - // - // More places... - // - // bbox is also used with other non-inert pieces, eg, currency - // (are we merging) - // - // Because we don't get auto-rearranged during occultation, - #[throws(IE)] - fn bbox_approx(&self) -> Rect { - let r: Coord = cast(self.cooldown_radius.ceil()) - .ok_or(CoordinateOverflow)?; - let br = PosC::new(r,r); - let tl = (-br)?; - Rect{ corners: [tl,br] } - } - delegate! { to self.surround_outline { + fn bbox_approx(&self) -> Result; fn shape(&self) -> Option; } } diff --git a/support/imports.rs b/support/imports.rs index f244656d..60d03c72 100644 --- a/support/imports.rs +++ b/support/imports.rs @@ -42,7 +42,7 @@ pub use nix::unistd::{self, Uid}; pub use nix::sys::time::TimeSpec; pub use nix::time::clock_gettime; pub use num_derive::{ToPrimitive, FromPrimitive}; -pub use num_traits::{cast, Bounded, FromPrimitive, ToPrimitive}; +pub use num_traits::{Bounded, FromPrimitive, ToPrimitive}; pub use paste::paste; pub use rand::distributions::Alphanumeric; pub use rand::thread_rng; -- 2.30.2