diff --git a/src-tauri/src/ambient_light/publisher.rs b/src-tauri/src/ambient_light/publisher.rs index 2827ad7..f18e5f3 100644 --- a/src-tauri/src/ambient_light/publisher.rs +++ b/src-tauri/src/ambient_light/publisher.rs @@ -57,7 +57,11 @@ impl LedColorsPublisher { let internal_tasks_version = self.inner_tasks_version.clone(); tokio::spawn(async move { - let colors = screenshot_manager::get_display_colors(display_id, &sample_points, bound_scale_factor); + let colors = screenshot_manager::get_display_colors( + display_id, + &sample_points, + bound_scale_factor, + ); if let Err(err) = colors { warn!("Failed to get colors: {}", err); @@ -86,7 +90,11 @@ impl LedColorsPublisher { // log::info!("tick: {}ms", start.elapsed().as_millis()); start = tokio::time::Instant::now(); - let colors = screenshot_manager::get_display_colors(display_id, &sample_points, bound_scale_factor); + let colors = screenshot_manager::get_display_colors( + display_id, + &sample_points, + bound_scale_factor, + ); if let Err(err) = colors { warn!("Failed to get colors: {}", err); @@ -117,14 +125,18 @@ impl LedColorsPublisher { }); } - fn start_all_colors_worker(&self, display_ids: Vec, mappers: Vec, mut display_colors_rx: broadcast::Receiver<(u32, Vec)>) { + fn start_all_colors_worker( + &self, + display_ids: Vec, + mappers: Vec, + mut display_colors_rx: broadcast::Receiver<(u32, Vec)>, + ) { let sorted_colors_tx = self.sorted_colors_tx.clone(); let colors_tx = self.colors_tx.clone(); log::debug!("start all_colors_worker"); tokio::spawn(async move { for _ in 0..10 { - let sorted_colors_tx = sorted_colors_tx.write().await; let colors_tx = colors_tx.write().await; @@ -212,13 +224,12 @@ impl LedColorsPublisher { let configs = configs.unwrap(); - let mut inner_tasks_version = inner_tasks_version.write().await; *inner_tasks_version = inner_tasks_version.overflowing_add(1).0; drop(inner_tasks_version); - - let (display_colors_tx, display_colors_rx) = broadcast::channel::<(u32, Vec)>(8); + let (display_colors_tx, display_colors_rx) = + broadcast::channel::<(u32, Vec)>(8); for sample_point_group in configs.sample_point_groups.clone() { let display_id = sample_point_group.display_id; @@ -343,7 +354,11 @@ impl LedColorsPublisher { let bound_scale_factor = screenshot.bound_scale_factor; - let colors_config = DisplaySamplePointGroup { display_id, points, bound_scale_factor }; + let colors_config = DisplaySamplePointGroup { + display_id, + points, + bound_scale_factor, + }; colors_configs.push(colors_config); } diff --git a/src/App.tsx b/src/App.tsx index f61fe7e..cd629d7 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,5 +1,6 @@ import { Routes, Route } from '@solidjs/router'; import { LedStripConfiguration } from './components/led-strip-configuration/led-strip-configuration'; +import { WhiteBalance } from './components/white-balance/white-balance'; function App() { return ( @@ -10,7 +11,7 @@ function App() { - + ); diff --git a/src/components/white-balance/color-slider.tsx b/src/components/white-balance/color-slider.tsx new file mode 100644 index 0000000..74daec1 --- /dev/null +++ b/src/components/white-balance/color-slider.tsx @@ -0,0 +1,17 @@ +import { Component, JSX } from 'solid-js'; + +type Props = {} & JSX.HTMLAttributes; + +export const ColorSlider: Component = (props) => { + return ( + + ); +}; diff --git a/src/components/white-balance/test-colors-bg.tsx b/src/components/white-balance/test-colors-bg.tsx new file mode 100644 index 0000000..440aad1 --- /dev/null +++ b/src/components/white-balance/test-colors-bg.tsx @@ -0,0 +1,99 @@ +import { Component, createSignal } from 'solid-js'; + +const ColorItem: Component<{ + color: string; + position: [number, number]; + size?: [number, number]; + onClick?: (color: string) => void; +}> = (props) => { + return ( +
{ + props.onClick?.(props.color); + }} + /> + ); +}; + +export const TestColorsBg: Component = () => { + const [singleColor, setSingleColor] = createSignal(null); + + return ( + <> +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ setSingleColor(null)} + /> + setSingleColor(null)} + /> + setSingleColor(null)} + /> + setSingleColor(null)} + /> +
+ + ); +}; diff --git a/src/components/white-balance/white-balance.tsx b/src/components/white-balance/white-balance.tsx new file mode 100644 index 0000000..a853226 --- /dev/null +++ b/src/components/white-balance/white-balance.tsx @@ -0,0 +1,43 @@ +import { ColorSlider } from './color-slider'; +import { TestColorsBg } from './test-colors-bg'; + +export const WhiteBalance = () => { + const exit = () => { + window.history.back(); + }; + + return ( +
+
+ +
+
+ + + + + + +
+
+ ); +};