From 004b96667ee5b034b467bc11aef5d45df5fa45e6 Mon Sep 17 00:00:00 2001 From: Bart Brouns Date: Tue, 9 Apr 2024 01:08:56 +0200 Subject: [PATCH] wip automatic height for graph --- src/editor.rs | 88 +++++++++++++++++++++++++++++++++------------------ src/style.css | 1 + 2 files changed, 58 insertions(+), 31 deletions(-) diff --git a/src/editor.rs b/src/editor.rs index d3b21b5..770ae5a 100644 --- a/src/editor.rs +++ b/src/editor.rs @@ -51,9 +51,9 @@ pub(crate) fn create( // everything VStack::new(cx, |cx| { - // parameters + graph + // titel, input gain, zoom HStack::new(cx, |cx| { - // parameters + // blank, input gain VStack::new(cx, |cx| { Label::new(cx, "") // spacer // Label::new(cx, "lamb") // title @@ -62,6 +62,32 @@ pub(crate) fn create( Label::new(cx, "input gain").class("fader-label"); ParamSlider::new(cx, LambData::params, |params| ¶ms.input_gain) .bottom(Pixels(6.0)); + }) // blank, input gain + .height(Auto) + .right(Percentage(2.5)) + .class("center"); + // titel, zoom + VStack::new(cx, |cx| { + Label::new(cx, "lamb") // title + .class("plugin-name") + .left(Stretch(1.0)) + .right(Pixels(0.0)); + Label::new(cx, "zoom mode").class("fader-label"); + ParamSlider::new(cx, LambData::params, |params| ¶ms.zoom_mode) + .set_style(ParamSliderStyle::CurrentStepLabeled { even: true }) + .bottom(Pixels(6.0)); + Label::new(cx, "").class("fader-label"); // spacer + }) // lamb + zoom + .height(Auto) + .class("center"); + }) // titel, input gain, zoom + .height(Auto) + .width(Percentage(100.0)); + + // parameters & graph + HStack::new(cx, |cx| { + // level , time, output gain, + VStack::new(cx, |cx| { // level + time HStack::new(cx, |cx| { // level @@ -124,36 +150,36 @@ pub(crate) fn create( .class("center") .left(Percentage(2.5)); }) - // .height(Percentage(100.0)) .height(Auto) .width(Percentage(100.0)); // level + time Label::new(cx, "output gain").class("fader-label"); ParamSlider::new(cx, LambData::params, |params| ¶ms.output_gain) .bottom(Pixels(6.0)); - }) // parameters - .height(Auto) - .right(Percentage(2.5)) - .class("center"); - // graph + zoom + }) // level , time, output gain, + .background_color(Color::yellow()) + .height(Auto) + .right(Percentage(2.5)) + .class("center"); + // spacer + graph VStack::new(cx, |cx| { - // Label::new(cx, ""); // spacer - Label::new(cx, "lamb") // title - .class("plugin-name") - .left(Stretch(1.0)) - .right(Pixels(0.0)); - Label::new(cx, "zoom mode").class("fader-label"); - ParamSlider::new(cx, LambData::params, |params| ¶ms.zoom_mode) - .set_style(ParamSliderStyle::CurrentStepLabeled { even: true }) - .bottom(Pixels(6.0)); Label::new(cx, "").class("fader-label"); // spacer - AttackReleaseGraph::new(cx, LambData::params).height(Pixels(317.0)); - }) // graph + zoom + AttackReleaseGraph::new(cx, LambData::params) + .height(Pixels(317.0)) + // .height(Percentage(100.0)) + // .height(Stretch(1.0)) + ; + }) // spacer + graph + .background_color(Color::green()) + // .height(Percentage(100.0)) + // .height(Stretch(1.0)) + .height(Auto) + .class("center") + ; + }) // parameters & graph + .width(Percentage(100.0)) .height(Auto) - .class("center"); - }) // parameters + graph - .height(Auto) - .width(Percentage(100.0)); + ; // meters VStack::new(cx, |cx| { @@ -171,7 +197,7 @@ pub(crate) fn create( .map(|gain_reduction_left| gain_reduction_left.load(Ordering::Relaxed)), Some(Duration::from_millis(600)), ) - .width(Percentage(100.0)); + .width(Percentage(100.0)); Label::new(cx, "gain reduction right").class("fader-label"); GainReductionMeter::new( cx, @@ -179,19 +205,19 @@ pub(crate) fn create( .map(|gain_reduction_right| gain_reduction_right.load(Ordering::Relaxed)), Some(Duration::from_millis(600)), ) - .width(Percentage(100.0)); + .width(Percentage(100.0)); }) // meters - .width(Percentage(100.0)) + .width(Percentage(100.0)) // .height(Percentage(100.0)) .height(Auto) .class("center"); // meters }) // everything - .width(Percentage(95.0)) + .width(Percentage(95.0)) // .height(Percentage(95.0)) - .height(Auto) - .left(Percentage(2.5)) - .right(Percentage(2.5)) - .class("center"); + .height(Auto) + .left(Percentage(2.5)) + .right(Percentage(2.5)) + .class("center"); ResizeHandle::new(cx); }) } diff --git a/src/style.css b/src/style.css index 3b477e6..451b1e9 100644 --- a/src/style.css +++ b/src/style.css @@ -9,6 +9,7 @@ attack-release-graph { width: 100%; + min-height: 50px; outline-color: #0a0a0a; border-color: #696969; background-color: #f0f0f0;