better view
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
use crate::utils::string_to_color;
|
||||
|
||||
use std::f32::consts::PI;
|
||||
|
||||
use iced::Vector;
|
||||
@@ -55,7 +57,7 @@ impl<Message> canvas::Program<Message> for PolygonFrame {
|
||||
_cursor: mouse::Cursor,
|
||||
) -> Vec<canvas::Geometry> {
|
||||
let mut frame = canvas::Frame::new(renderer, bounds.size());
|
||||
let radius = frame.size().width / 2.0 - 32.0;
|
||||
let radius = frame.size().width.min(frame.size().height) / 2.0 - 32.0;
|
||||
let mut vec = Vector::new(0.0, -radius);
|
||||
let c = frame.center();
|
||||
// Draw Circle
|
||||
@@ -127,14 +129,7 @@ impl Polygon {
|
||||
let path = format!("./assets/{0}", &self.sound_name);
|
||||
eprintln!("path:{path}");
|
||||
self.sound = StaticSoundData::from_file(&path).expect("fail to load the sound");
|
||||
self.color = match self.color_name.as_str() {
|
||||
"Green" => Color::from_rgb(0.0, 1.0, 0.0),
|
||||
"Blue" => Color::from_rgb(0.0, 0.0, 1.0),
|
||||
"Cyan" => Color::from_rgb(0.0, 1.0, 1.0),
|
||||
"Yellow" => Color::from_rgb(1.0, 1.0, 0.0),
|
||||
"Pink" => Color::from_rgb(1.0, 0.0, 1.0),
|
||||
_ => Color::BLACK,
|
||||
};
|
||||
self.color = string_to_color(&self.color_name);
|
||||
}
|
||||
pub fn sound_to_play_btw(&self, before: f32, after: f32) -> Vec<&StaticSoundData> {
|
||||
let mut sound_to_play: Vec<&StaticSoundData> = vec![];
|
||||
|
||||
Reference in New Issue
Block a user