mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-24 19:10:24 +00:00
Focus shared screen item when clicking on it
This commit is contained in:
parent
a8bd234aa4
commit
e135b982c1
1 changed files with 20 additions and 14 deletions
|
@ -6,7 +6,7 @@ use futures::StreamExt;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
elements::*,
|
elements::*,
|
||||||
geometry::{rect::RectF, vector::vec2f},
|
geometry::{rect::RectF, vector::vec2f},
|
||||||
Entity, ModelHandle, RenderContext, Task, View, ViewContext,
|
Entity, ModelHandle, MouseButton, RenderContext, Task, View, ViewContext,
|
||||||
};
|
};
|
||||||
use smallvec::SmallVec;
|
use smallvec::SmallVec;
|
||||||
use std::{
|
use std::{
|
||||||
|
@ -63,8 +63,11 @@ impl View for SharedScreen {
|
||||||
"SharedScreen"
|
"SharedScreen"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _: &mut RenderContext<Self>) -> ElementBox {
|
fn render(&mut self, cx: &mut RenderContext<Self>) -> ElementBox {
|
||||||
|
enum Focus {}
|
||||||
|
|
||||||
let frame = self.frame.clone();
|
let frame = self.frame.clone();
|
||||||
|
MouseEventHandler::<Focus>::new(0, cx, |_, _| {
|
||||||
Canvas::new(move |bounds, _, cx| {
|
Canvas::new(move |bounds, _, cx| {
|
||||||
if let Some(frame) = frame.clone() {
|
if let Some(frame) = frame.clone() {
|
||||||
let size = constrain_size_preserving_aspect_ratio(
|
let size = constrain_size_preserving_aspect_ratio(
|
||||||
|
@ -79,6 +82,9 @@ impl View for SharedScreen {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.boxed()
|
.boxed()
|
||||||
|
})
|
||||||
|
.on_down(MouseButton::Left, |_, cx| cx.focus_parent_view())
|
||||||
|
.boxed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue