mirror of https://github.com/lapce/lapce.git
fix plugin panel scroll bar
fix clippy and fmt warnings code cleanup
This commit is contained in:
parent
4df4f67a27
commit
a549171c40
|
@ -1,3 +1,4 @@
|
||||||
|
use crate::scroll::LapceScroll;
|
||||||
use druid::{
|
use druid::{
|
||||||
piet::{Text, TextAttribute, TextLayout as PietTextLayout, TextLayoutBuilder},
|
piet::{Text, TextAttribute, TextLayout as PietTextLayout, TextLayoutBuilder},
|
||||||
BoxConstraints, Color, Cursor, Env, Event, EventCtx, FontWeight, LayoutCtx,
|
BoxConstraints, Color, Cursor, Env, Event, EventCtx, FontWeight, LayoutCtx,
|
||||||
|
@ -32,7 +33,12 @@ pub fn new_panel(data: &LapceTabData) -> LapcePanel {
|
||||||
PanelKind::Plugin,
|
PanelKind::Plugin,
|
||||||
data.plugin.widget_id,
|
data.plugin.widget_id,
|
||||||
split_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,
|
_data: &LapceTabData,
|
||||||
_env: &Env,
|
_env: &Env,
|
||||||
) -> Size {
|
) -> 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) {
|
fn paint(&mut self, ctx: &mut PaintCtx, data: &LapceTabData, _env: &Env) {
|
||||||
|
|
Loading…
Reference in New Issue