add color picker and better buttons

This commit is contained in:
2025-07-10 15:07:52 +02:00
parent 984cec5741
commit 607cf17888
7 changed files with 314 additions and 241 deletions

View File

@@ -17,6 +17,7 @@ use iced::widget::canvas;
use iced::widget::canvas::Stroke;
use iced::widget::canvas::Style;
use iced::{Color, Rectangle, Renderer, Theme};
use std::env::current_dir;
use std::f32::consts::PI;
use std::mem::swap;
use std::time::Duration;
@@ -125,10 +126,14 @@ impl Music {
self.find_poly_frame(delta).polygons[index].global_teta = teta;
}
pub fn set_color(&mut self, delta: f32, index: usize, color_name: String) {
pub fn set_color(&mut self, delta: f32, index: usize, color: Color) {
let current_frame = self.find_poly_frame(delta);
current_frame.polygons[index].color = string_to_color(&color_name);
current_frame.polygons[index].color_name = color_name;
current_frame.polygons[index].color = color;
}
pub fn set_color_picker(&mut self, delta: f32, i: usize, b: bool) {
let current_frame = self.find_poly_frame(delta);
current_frame.polygons[i].show_color_picker = b;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ADD/REMOVE~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~