This commit is contained in:
2025-07-08 22:39:59 +02:00
parent e04f735885
commit 4dc76dee16
3 changed files with 5 additions and 10 deletions

View File

@@ -1,5 +1,4 @@
mod polygon_draw; mod polygon_draw;
use iced::widget::text_input::Style;
use polygon_draw::Polygon; use polygon_draw::Polygon;
mod music; mod music;
@@ -10,12 +9,11 @@ use utils::str_to_sec;
use std::fs; use std::fs;
use iced::{Element, window}; use iced::Element;
use iced::{ use iced::{
Font, Font,
font::Family,
widget::{ widget::{
TextInput, column, text, text_input, TextInput, column, text,
text_input::{Icon, Side}, text_input::{Icon, Side},
}, },
}; };
@@ -173,7 +171,7 @@ impl MyApp {
} }
} }
Message::AddPoint => { Message::AddPoint => {
self.music.add_Point(self.current_delta); self.music.add_point(self.current_delta);
} }
} }
} }

View File

@@ -1,6 +1,5 @@
use crate::utils::string_to_polygon; use crate::utils::string_to_polygon;
use crate::{polygon_draw::*, utils::string_to_color}; use crate::{polygon_draw::*, utils::string_to_color};
use iced::Length::Fill;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use kira::{AudioManager, sound::static_sound::StaticSoundData}; use kira::{AudioManager, sound::static_sound::StaticSoundData};
@@ -10,7 +9,6 @@ use iced::widget::canvas;
use iced::widget::canvas::Stroke; use iced::widget::canvas::Stroke;
use iced::widget::canvas::Style; use iced::widget::canvas::Style;
use iced::{Color, Rectangle, Renderer, Theme}; use iced::{Color, Rectangle, Renderer, Theme};
use iced::{Vector, color};
use std::f32::consts::PI; use std::f32::consts::PI;
use std::time::Duration; use std::time::Duration;
#[derive(Serialize, Deserialize)] #[derive(Serialize, Deserialize)]
@@ -113,7 +111,7 @@ impl Music {
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ADD/REMOVE~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ADD/REMOVE~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pub fn add_Point(&mut self, delta: f32) { pub fn add_point(&mut self, delta: f32) {
let pos = self let pos = self
.poly_frame .poly_frame
.binary_search_by(|(d, _)| d.partial_cmp(&delta).unwrap()) .binary_search_by(|(d, _)| d.partial_cmp(&delta).unwrap())
@@ -145,7 +143,6 @@ impl<Message> canvas::Program<Message> for Music {
_cursor: mouse::Cursor, _cursor: mouse::Cursor,
) -> Vec<canvas::Geometry> { ) -> Vec<canvas::Geometry> {
let mut frame = canvas::Frame::new(renderer, bounds.size()); let mut frame = canvas::Frame::new(renderer, bounds.size());
let radius = frame.size().width.min(frame.size().height) / 2.0 - 32.0;
let mut toggle_color = true; let mut toggle_color = true;
let padding = 8.; let padding = 8.;
let w = bounds.width - (padding * 2.); let w = bounds.width - (padding * 2.);

View File

@@ -1,5 +1,5 @@
use crate::Polygon; use crate::Polygon;
use iced::{Color, widget::canvas::path::lyon_path::geom::euclid::num::Floor}; use iced::Color;
use kira::sound::static_sound::StaticSoundData; use kira::sound::static_sound::StaticSoundData;
pub fn string_to_color<S: AsRef<str>>(s: S) -> Color { pub fn string_to_color<S: AsRef<str>>(s: S) -> Color {
match s.as_ref() { match s.as_ref() {