fix plugin panel scroll bar
fix clippy and fmt warnings
code cleanup
+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) {
