Skip to content

Commit bd27fa8

Browse files
committed
put ruler outside border
1 parent 5eae5df commit bd27fa8

File tree

1 file changed

+52
-53
lines changed

1 file changed

+52
-53
lines changed

src/editor.rs

+52-53
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::LambParams;
22
use crate::ZoomMode;
3-
use nih_plug::prelude::{Editor};
3+
use nih_plug::prelude::Editor;
44
use nih_plug_vizia::vizia::prelude::*;
55
use nih_plug_vizia::vizia::vg;
66
use nih_plug_vizia::widgets::*;
@@ -151,7 +151,6 @@ pub(crate) fn create(
151151
.class("center")
152152
.left(Percentage(2.5));
153153
})
154-
// .height(Percentage(100.0))
155154
.height(Auto)
156155
.width(Percentage(100.0)); // level + time
157156

@@ -182,20 +181,13 @@ pub(crate) fn create(
182181
.height(Auto)
183182
.width(Percentage(100.0));
184183

185-
// meters
186-
// VStack::new(cx, |cx| {
187184
peak_graph(cx);
188-
// }) // meters
189-
// .width(Percentage(100.0))
190-
// .height(Auto)
191-
// .class("center"); // meters
192185
}) // everything
193-
.width(Percentage(95.0))
194-
// .height(Percentage(95.0))
195-
.height(Auto)
196-
.left(Percentage(2.5))
197-
.right(Percentage(2.5))
198-
.class("center");
186+
.width(Percentage(95.0))
187+
.height(Auto)
188+
.left(Percentage(2.5))
189+
.right(Percentage(2.5))
190+
.class("center");
199191
ResizeHandle::new(cx);
200192
})
201193
}
@@ -362,47 +354,31 @@ impl<AttackReleaseDataL: Lens<Target = Arc<LambParams>>> View
362354
/// Draws a peak graph with a grid backdrop, unit ruler, and a peak meter to side.
363355
fn peak_graph(cx: &mut Context) {
364356
HStack::new(cx, |cx| {
365-
ZStack::new(cx, |cx| {
366-
Grid::new(
367-
cx,
368-
ValueScaling::Linear,
369-
(METER_MIN, METER_MAX),
370-
vec![0.0, -6.0, -12.0, -18.0, -24.0, -30.0],
371-
Orientation::Vertical
372-
)
373-
.color(Color::rgb(60, 60, 60));
357+
HStack::new(cx, |cx| {
358+
ZStack::new(cx, |cx| {
359+
Grid::new(
360+
cx,
361+
ValueScaling::Linear,
362+
(METER_MIN, METER_MAX),
363+
vec![0.0, -6.0, -12.0, -18.0, -24.0, -30.0],
364+
Orientation::Vertical
365+
)
366+
.color(Color::rgb(60, 60, 60));
374367

375-
// level
376-
Graph::new(cx, LambData::level_buffer, (METER_MIN, METER_MAX), ValueScaling::Decibels)
377-
.color(Color::rgba(60, 60, 60, 160))
378-
.background_color(Color::rgba(60, 60, 60, 60));
368+
// level
369+
Graph::new(cx, LambData::level_buffer, (METER_MIN, METER_MAX), ValueScaling::Decibels)
370+
.color(Color::rgba(60, 60, 60, 160))
371+
.background_color(Color::rgba(60, 60, 60, 60));
379372

380-
// gain reduction
381-
Graph::new(cx, LambData::gr_buffer, (METER_MIN, METER_MAX), ValueScaling::Decibels)
382-
.color(Color::rgba(160, 0, 0, 160))
383-
.background_color(Color::rgba(255, 16, 16, 60))
384-
.fill_from(0.0);
385-
})
386-
// .background_color(Color::rgb(16, 16, 16))
373+
// gain reduction
374+
Graph::new(cx, LambData::gr_buffer, (METER_MIN, METER_MAX), ValueScaling::Decibels)
375+
.color(Color::rgba(160, 0, 0, 160))
376+
.background_color(Color::rgba(255, 16, 16, 60))
377+
.fill_from(0.0);
378+
})
379+
// .background_color(Color::rgb(16, 16, 16))
387380
;
388381

389-
UnitRuler::new(
390-
cx,
391-
(METER_MIN, METER_MAX),
392-
ValueScaling::Linear,
393-
vec![
394-
(-0.0, "0db"),
395-
(-6.0, "-6db"),
396-
(-12.0, "-12db"),
397-
(-18.0, "-18db"),
398-
(-24.0, "-24db"),
399-
(-30.0, "-30db"),
400-
],
401-
Orientation::Vertical,
402-
)
403-
.font_size(12.)
404-
.color(Color::rgb(160, 160, 160))
405-
.width(Pixels(32.));
406382
Meter::new(
407383
cx,
408384
LambData::level_buffer,
@@ -428,11 +404,34 @@ fn peak_graph(cx: &mut Context) {
428404
.width(Pixels(32.0))
429405
.background_color(Color::rgb(251, 195, 195));
430406
// .background_color(Color::rgba(160, 0, 0, 60));
407+
})
408+
.border_color(Color::rgb(80, 80, 80))
409+
.border_width(Pixels(1.))
410+
;
411+
UnitRuler::new(
412+
cx,
413+
(METER_MIN, METER_MAX),
414+
ValueScaling::Linear,
415+
vec![
416+
(-0.0, "0db"),
417+
(-6.0, "-6db"),
418+
(-12.0, "-12db"),
419+
(-18.0, "-18db"),
420+
(-24.0, "-24db"),
421+
(-30.0, "-30db"),
422+
],
423+
Orientation::Vertical,
424+
)
425+
.font_size(12.)
426+
.color(Color::rgb(160, 160, 160))
427+
.width(Pixels(32.))
428+
;
431429
})
432430
.top(Pixels(13.0))
433431
.height(Pixels(330.0))
434432
.width(Percentage(100.0))
435433
.col_between(Pixels(8.))
436-
.border_color(Color::rgb(80, 80, 80))
437-
.border_width(Pixels(1.));
434+
.border_color(Color::rgba(0, 0, 0, 0))
435+
.border_width(Pixels(1.))
436+
;
438437
}

0 commit comments

Comments
 (0)