mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-16 08:38:26 +00:00
fix image modal center
This commit is contained in:
parent
7af94e674d
commit
27ac3d9dc1
3 changed files with 8 additions and 4 deletions
|
|
@ -278,6 +278,10 @@ impl Bitmap {
|
|||
for tile in self.mosaic.as_mut_slice() {
|
||||
tile.translate(offset);
|
||||
}
|
||||
self.bound.tl.x += offset.x;
|
||||
self.bound.tl.y += offset.y;
|
||||
self.bound.br.x += offset.x;
|
||||
self.bound.br.y += offset.y;
|
||||
}
|
||||
|
||||
pub fn rotate90(&mut self) -> Self {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::*;
|
||||
|
||||
pub const IMG_MODAL_HEIGHT: u32 = 300;
|
||||
pub const IMG_MODAL_HEIGHT: u32 = 374;
|
||||
pub const IMG_MODAL_WIDTH: u32 = 296;
|
||||
#[derive(Debug)]
|
||||
pub struct Image {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ use gam::*;
|
|||
use num_traits::*;
|
||||
#[cfg(feature = "ditherpunk")]
|
||||
use std::convert::TryInto;
|
||||
use std::cmp::min;
|
||||
use std::cmp::max;
|
||||
use xous::{send_message, Message, CID};
|
||||
use xous_ipc::Buffer;
|
||||
|
||||
|
|
@ -203,10 +203,10 @@ impl Modals {
|
|||
// center image in modal
|
||||
const BORDER: u32 = 3;
|
||||
let margin = Point::new(
|
||||
(BORDER + min(0,(gam::IMG_MODAL_WIDTH - 2 * BORDER - bm_width) / 2))
|
||||
(BORDER + max(0, (gam::IMG_MODAL_WIDTH - 2 * BORDER - bm_width) / 2))
|
||||
.try_into()
|
||||
.unwrap(),
|
||||
(BORDER + min(0, (gam::IMG_MODAL_HEIGHT - 2 * BORDER - bm_height) / 2))
|
||||
(BORDER + max(0, (gam::IMG_MODAL_HEIGHT - 2 * BORDER - bm_height) / 2))
|
||||
.try_into()
|
||||
.unwrap(),
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in a new issue