fix plugin panel scroll bar

fix clippy and fmt warnings

code cleanup
This commit is contained in:
bbrabbitt 2022-07-15 21:39:59 -07:00
parent 4df4f67a27
commit a549171c40
No known key found for this signature in database
GPG Key ID: 3123A68917B8E541
1 changed files with 14 additions and 2 deletions

View File

@ -1,3 +1,4 @@
use crate::scroll::LapceScroll;
use druid::{
piet::{Text, TextAttribute, TextLayout as PietTextLayout, TextLayoutBuilder},
BoxConstraints, Color, Cursor, Env, Event, EventCtx, FontWeight, LayoutCtx,
@ -32,7 +33,12 @@ pub fn new_panel(data: &LapceTabData) -> LapcePanel {
PanelKind::Plugin,
data.plugin.widget_id,
split_id,
vec![(split_id, PanelHeaderKind::None, Self::new().boxed(), None)],
vec![(
split_id,
PanelHeaderKind::None,
LapceScroll::new(Self::new()).boxed(),
None,
)],
)
}
@ -141,7 +147,13 @@ fn layout(
_data: &LapceTabData,
_env: &Env,
) -> Size {
bc.max()
if _data.plugins.is_empty() {
return bc.max();
}
let height = 3.0 * self.line_height * _data.plugins.len() as f64;
let height = height.max(bc.max().height);
Size::new(bc.max().width, height)
}
fn paint(&mut self, ctx: &mut PaintCtx, data: &LapceTabData, _env: &Env) {