chore: Upgrade for GPUI API changes. (#589)
This commit is contained in:
parent
d2ff8177ec
commit
6fa1888ee6
20 changed files with 79 additions and 79 deletions
22
Cargo.lock
generated
22
Cargo.lock
generated
|
|
@ -474,7 +474,7 @@ dependencies = [
|
||||||
"bitflags 2.6.0",
|
"bitflags 2.6.0",
|
||||||
"cexpr",
|
"cexpr",
|
||||||
"clang-sys",
|
"clang-sys",
|
||||||
"itertools 0.13.0",
|
"itertools 0.11.0",
|
||||||
"log",
|
"log",
|
||||||
"prettyplease",
|
"prettyplease",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
|
|
@ -952,7 +952,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "collections"
|
name = "collections"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/huacnlee/zed.git?branch=webview#47beb1e705567fd74d0035ef6902299c757b7b5f"
|
source = "git+https://github.com/huacnlee/zed.git?branch=webview#c4fcc5dc17051485232855eefe860cad1946b573"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"indexmap 2.7.1",
|
"indexmap 2.7.1",
|
||||||
"rustc-hash 2.1.0",
|
"rustc-hash 2.1.0",
|
||||||
|
|
@ -1316,7 +1316,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "derive_refineable"
|
name = "derive_refineable"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/huacnlee/zed.git?branch=webview#47beb1e705567fd74d0035ef6902299c757b7b5f"
|
source = "git+https://github.com/huacnlee/zed.git?branch=webview#c4fcc5dc17051485232855eefe860cad1946b573"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
|
@ -2275,7 +2275,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gpui"
|
name = "gpui"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/huacnlee/zed.git?branch=webview#47beb1e705567fd74d0035ef6902299c757b7b5f"
|
source = "git+https://github.com/huacnlee/zed.git?branch=webview#c4fcc5dc17051485232855eefe860cad1946b573"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"as-raw-xcb-connection",
|
"as-raw-xcb-connection",
|
||||||
|
|
@ -2361,7 +2361,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gpui_macros"
|
name = "gpui_macros"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/huacnlee/zed.git?branch=webview#47beb1e705567fd74d0035ef6902299c757b7b5f"
|
source = "git+https://github.com/huacnlee/zed.git?branch=webview#c4fcc5dc17051485232855eefe860cad1946b573"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
|
@ -2551,7 +2551,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "http_client"
|
name = "http_client"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/huacnlee/zed.git?branch=webview#47beb1e705567fd74d0035ef6902299c757b7b5f"
|
source = "git+https://github.com/huacnlee/zed.git?branch=webview#c4fcc5dc17051485232855eefe860cad1946b573"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"bytes",
|
"bytes",
|
||||||
|
|
@ -3129,7 +3129,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "media"
|
name = "media"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/huacnlee/zed.git?branch=webview#47beb1e705567fd74d0035ef6902299c757b7b5f"
|
source = "git+https://github.com/huacnlee/zed.git?branch=webview#c4fcc5dc17051485232855eefe860cad1946b573"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"bindgen",
|
"bindgen",
|
||||||
|
|
@ -4409,7 +4409,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "refineable"
|
name = "refineable"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/huacnlee/zed.git?branch=webview#47beb1e705567fd74d0035ef6902299c757b7b5f"
|
source = "git+https://github.com/huacnlee/zed.git?branch=webview#c4fcc5dc17051485232855eefe860cad1946b573"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"derive_refineable",
|
"derive_refineable",
|
||||||
]
|
]
|
||||||
|
|
@ -4737,7 +4737,7 @@ checksum = "d369a96f978623eb3dc28807c4852d6cc617fed53da5d3c400feff1ef34a714a"
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "semantic_version"
|
name = "semantic_version"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/huacnlee/zed.git?branch=webview#47beb1e705567fd74d0035ef6902299c757b7b5f"
|
source = "git+https://github.com/huacnlee/zed.git?branch=webview#c4fcc5dc17051485232855eefe860cad1946b573"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"serde",
|
"serde",
|
||||||
|
|
@ -5176,7 +5176,7 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sum_tree"
|
name = "sum_tree"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/huacnlee/zed.git?branch=webview#47beb1e705567fd74d0035ef6902299c757b7b5f"
|
source = "git+https://github.com/huacnlee/zed.git?branch=webview#c4fcc5dc17051485232855eefe860cad1946b573"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arrayvec",
|
"arrayvec",
|
||||||
"log",
|
"log",
|
||||||
|
|
@ -5861,7 +5861,7 @@ checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9"
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "util"
|
name = "util"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/huacnlee/zed.git?branch=webview#47beb1e705567fd74d0035ef6902299c757b7b5f"
|
source = "git+https://github.com/huacnlee/zed.git?branch=webview#c4fcc5dc17051485232855eefe860cad1946b573"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-fs 2.1.2",
|
"async-fs 2.1.2",
|
||||||
|
|
|
||||||
|
|
@ -242,7 +242,7 @@ impl ModalStory {
|
||||||
.map(|s| Arc::new(s.to_string()))
|
.map(|s| Arc::new(s.to_string()))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let story = cx.model().downgrade();
|
let story = cx.entity().downgrade();
|
||||||
let delegate = ListItemDeletegate {
|
let delegate = ListItemDeletegate {
|
||||||
story,
|
story,
|
||||||
selected_index: None,
|
selected_index: None,
|
||||||
|
|
@ -362,7 +362,7 @@ impl ModalStory {
|
||||||
let input1 = self.input1.clone();
|
let input1 = self.input1.clone();
|
||||||
let date_picker = self.date_picker.clone();
|
let date_picker = self.date_picker.clone();
|
||||||
let dropdown = self.dropdown.clone();
|
let dropdown = self.dropdown.clone();
|
||||||
let view = cx.model().clone();
|
let view = cx.entity().clone();
|
||||||
let keyboard = self.model_keyboard;
|
let keyboard = self.model_keyboard;
|
||||||
|
|
||||||
window.open_modal(cx, move |modal, _, _| {
|
window.open_modal(cx, move |modal, _, _| {
|
||||||
|
|
|
||||||
|
|
@ -170,7 +170,7 @@ impl Render for ScrollableStory {
|
||||||
_: &mut gpui::Window,
|
_: &mut gpui::Window,
|
||||||
cx: &mut gpui::Context<Self>,
|
cx: &mut gpui::Context<Self>,
|
||||||
) -> impl gpui::IntoElement {
|
) -> impl gpui::IntoElement {
|
||||||
let view = cx.model().clone();
|
let view = cx.entity().clone();
|
||||||
|
|
||||||
v_flex()
|
v_flex()
|
||||||
.size_full()
|
.size_full()
|
||||||
|
|
@ -185,7 +185,7 @@ impl Render for ScrollableStory {
|
||||||
.size_full()
|
.size_full()
|
||||||
.child(
|
.child(
|
||||||
v_virtual_list(
|
v_virtual_list(
|
||||||
cx.model().clone(),
|
cx.entity().clone(),
|
||||||
"items",
|
"items",
|
||||||
self.item_sizes.clone(),
|
self.item_sizes.clone(),
|
||||||
move |story, visible_range, content_size, _, cx| {
|
move |story, visible_range, content_size, _, cx| {
|
||||||
|
|
@ -270,7 +270,7 @@ impl Render for ScrollableStory {
|
||||||
.p_3()
|
.p_3()
|
||||||
.w(self.test_width)
|
.w(self.test_width)
|
||||||
.id("test-1")
|
.id("test-1")
|
||||||
.scrollable(cx.model().entity_id(), ScrollbarAxis::Vertical)
|
.scrollable(cx.entity().entity_id(), ScrollbarAxis::Vertical)
|
||||||
.gap_1()
|
.gap_1()
|
||||||
.child("Scrollable Example")
|
.child("Scrollable Example")
|
||||||
.children(self.items.iter().take(500).map(|item| {
|
.children(self.items.iter().take(500).map(|item| {
|
||||||
|
|
|
||||||
|
|
@ -205,7 +205,7 @@ impl Render for SidebarStory {
|
||||||
.border_color(cx.theme().border)
|
.border_color(cx.theme().border)
|
||||||
.h_full()
|
.h_full()
|
||||||
.child(
|
.child(
|
||||||
Sidebar::left(&cx.model())
|
Sidebar::left(&cx.entity())
|
||||||
.collapsed(self.is_collapsed)
|
.collapsed(self.is_collapsed)
|
||||||
.header(
|
.header(
|
||||||
SidebarHeader::new()
|
SidebarHeader::new()
|
||||||
|
|
|
||||||
|
|
@ -138,7 +138,7 @@ impl Render for TextStory {
|
||||||
Clipboard::new("clipboard1")
|
Clipboard::new("clipboard1")
|
||||||
.content(|_, _| Label::new("Click icon to copy"))
|
.content(|_, _| Label::new("Click icon to copy"))
|
||||||
.value_fn({
|
.value_fn({
|
||||||
let view = cx.model().clone();
|
let view = cx.entity().clone();
|
||||||
move |_, cx| {
|
move |_, cx| {
|
||||||
SharedString::from(format!(
|
SharedString::from(format!(
|
||||||
"masked :{}",
|
"masked :{}",
|
||||||
|
|
|
||||||
|
|
@ -299,7 +299,7 @@ impl Render for ColorPicker {
|
||||||
}
|
}
|
||||||
.into();
|
.into();
|
||||||
|
|
||||||
let view = cx.model().clone();
|
let view = cx.entity().clone();
|
||||||
|
|
||||||
div()
|
div()
|
||||||
.id(self.id.clone())
|
.id(self.id.clone())
|
||||||
|
|
|
||||||
|
|
@ -278,7 +278,7 @@ impl Dock {
|
||||||
fn render_resize_handle(&mut self, _: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render_resize_handle(&mut self, _: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
let axis = self.placement.axis();
|
let axis = self.placement.axis();
|
||||||
let neg_offset = -HANDLE_PADDING;
|
let neg_offset = -HANDLE_PADDING;
|
||||||
let view = cx.model().clone();
|
let view = cx.entity().clone();
|
||||||
|
|
||||||
div()
|
div()
|
||||||
.id("resize-handle")
|
.id("resize-handle")
|
||||||
|
|
@ -340,7 +340,7 @@ impl Dock {
|
||||||
|
|
||||||
// Get the size of the left dock if it's open and not the current dock
|
// Get the size of the left dock if it's open and not the current dock
|
||||||
if let Some(left_dock) = &dock_area.left_dock {
|
if let Some(left_dock) = &dock_area.left_dock {
|
||||||
if left_dock.entity_id() != cx.model().entity_id() {
|
if left_dock.entity_id() != cx.entity().entity_id() {
|
||||||
let left_dock_read = left_dock.read(cx);
|
let left_dock_read = left_dock.read(cx);
|
||||||
if left_dock_read.is_open() {
|
if left_dock_read.is_open() {
|
||||||
left_dock_size = left_dock_read.size;
|
left_dock_size = left_dock_read.size;
|
||||||
|
|
@ -350,7 +350,7 @@ impl Dock {
|
||||||
|
|
||||||
// Get the size of the right dock if it's open and not the current dock
|
// Get the size of the right dock if it's open and not the current dock
|
||||||
if let Some(right_dock) = &dock_area.right_dock {
|
if let Some(right_dock) = &dock_area.right_dock {
|
||||||
if right_dock.entity_id() != cx.model().entity_id() {
|
if right_dock.entity_id() != cx.entity().entity_id() {
|
||||||
let right_dock_read = right_dock.read(cx);
|
let right_dock_read = right_dock.read(cx);
|
||||||
if right_dock_read.is_open() {
|
if right_dock_read.is_open() {
|
||||||
right_dock_size = right_dock_read.size;
|
right_dock_size = right_dock_read.size;
|
||||||
|
|
@ -415,7 +415,7 @@ impl Render for Dock {
|
||||||
})
|
})
|
||||||
.child(self.render_resize_handle(window, cx))
|
.child(self.render_resize_handle(window, cx))
|
||||||
.child(DockElement {
|
.child(DockElement {
|
||||||
view: cx.model().clone(),
|
view: cx.entity().clone(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -455,7 +455,7 @@ impl DockArea {
|
||||||
cx: &mut Context<Self>,
|
cx: &mut Context<Self>,
|
||||||
) {
|
) {
|
||||||
self.subscribe_item(&panel, window, cx);
|
self.subscribe_item(&panel, window, cx);
|
||||||
let weak_self = cx.model().downgrade();
|
let weak_self = cx.entity().downgrade();
|
||||||
self.left_dock = Some(cx.new(|cx| {
|
self.left_dock = Some(cx.new(|cx| {
|
||||||
let mut dock = Dock::left(weak_self.clone(), window, cx);
|
let mut dock = Dock::left(weak_self.clone(), window, cx);
|
||||||
if let Some(size) = size {
|
if let Some(size) = size {
|
||||||
|
|
@ -477,7 +477,7 @@ impl DockArea {
|
||||||
cx: &mut Context<Self>,
|
cx: &mut Context<Self>,
|
||||||
) {
|
) {
|
||||||
self.subscribe_item(&panel, window, cx);
|
self.subscribe_item(&panel, window, cx);
|
||||||
let weak_self = cx.model().downgrade();
|
let weak_self = cx.entity().downgrade();
|
||||||
self.bottom_dock = Some(cx.new(|cx| {
|
self.bottom_dock = Some(cx.new(|cx| {
|
||||||
let mut dock = Dock::bottom(weak_self.clone(), window, cx);
|
let mut dock = Dock::bottom(weak_self.clone(), window, cx);
|
||||||
if let Some(size) = size {
|
if let Some(size) = size {
|
||||||
|
|
@ -499,7 +499,7 @@ impl DockArea {
|
||||||
cx: &mut Context<Self>,
|
cx: &mut Context<Self>,
|
||||||
) {
|
) {
|
||||||
self.subscribe_item(&panel, window, cx);
|
self.subscribe_item(&panel, window, cx);
|
||||||
let weak_self = cx.model().downgrade();
|
let weak_self = cx.entity().downgrade();
|
||||||
self.right_dock = Some(cx.new(|cx| {
|
self.right_dock = Some(cx.new(|cx| {
|
||||||
let mut dock = Dock::right(weak_self.clone(), window, cx);
|
let mut dock = Dock::right(weak_self.clone(), window, cx);
|
||||||
if let Some(size) = size {
|
if let Some(size) = size {
|
||||||
|
|
@ -634,7 +634,7 @@ impl DockArea {
|
||||||
window: &mut Window,
|
window: &mut Window,
|
||||||
cx: &mut Context<Self>,
|
cx: &mut Context<Self>,
|
||||||
) {
|
) {
|
||||||
let weak_self = cx.model().downgrade();
|
let weak_self = cx.entity().downgrade();
|
||||||
match placement {
|
match placement {
|
||||||
DockPlacement::Left => {
|
DockPlacement::Left => {
|
||||||
if let Some(dock) = self.left_dock.as_ref() {
|
if let Some(dock) = self.left_dock.as_ref() {
|
||||||
|
|
@ -677,7 +677,7 @@ impl DockArea {
|
||||||
}
|
}
|
||||||
DockPlacement::Center => {
|
DockPlacement::Center => {
|
||||||
self.items
|
self.items
|
||||||
.add_panel(panel, &cx.model().downgrade(), window, cx);
|
.add_panel(panel, &cx.entity().downgrade(), window, cx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -692,7 +692,7 @@ impl DockArea {
|
||||||
cx: &mut Context<Self>,
|
cx: &mut Context<Self>,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
self.version = state.version;
|
self.version = state.version;
|
||||||
let weak_self = cx.model().downgrade();
|
let weak_self = cx.entity().downgrade();
|
||||||
|
|
||||||
if let Some(left_dock_state) = state.left_dock {
|
if let Some(left_dock_state) = state.left_dock {
|
||||||
self.left_dock = Some(left_dock_state.to_dock(weak_self.clone(), window, cx));
|
self.left_dock = Some(left_dock_state.to_dock(weak_self.clone(), window, cx));
|
||||||
|
|
@ -875,7 +875,7 @@ impl DockArea {
|
||||||
impl EventEmitter<DockEvent> for DockArea {}
|
impl EventEmitter<DockEvent> for DockArea {}
|
||||||
impl Render for DockArea {
|
impl Render for DockArea {
|
||||||
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
let view = cx.model().clone();
|
let view = cx.entity().clone();
|
||||||
|
|
||||||
div()
|
div()
|
||||||
.id("dock-area")
|
.id("dock-area")
|
||||||
|
|
|
||||||
|
|
@ -203,7 +203,7 @@ impl StackPanel {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let view = cx.model().clone();
|
let view = cx.entity().clone();
|
||||||
window.defer(cx, {
|
window.defer(cx, {
|
||||||
let panel = panel.clone();
|
let panel = panel.clone();
|
||||||
|
|
||||||
|
|
@ -300,7 +300,7 @@ impl StackPanel {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let view = cx.model().clone();
|
let view = cx.entity().clone();
|
||||||
if let Some(parent) = self.parent.as_ref() {
|
if let Some(parent) = self.parent.as_ref() {
|
||||||
_ = parent.update(cx, |parent, cx| {
|
_ = parent.update(cx, |parent, cx| {
|
||||||
parent.remove_panel(Arc::new(view.clone()), window, cx);
|
parent.remove_panel(Arc::new(view.clone()), window, cx);
|
||||||
|
|
|
||||||
|
|
@ -321,7 +321,7 @@ impl TabPanel {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let tab_view = cx.model().clone();
|
let tab_view = cx.entity().clone();
|
||||||
if let Some(stack_panel) = self.stack_panel.as_ref() {
|
if let Some(stack_panel) = self.stack_panel.as_ref() {
|
||||||
_ = stack_panel.update(cx, |view, cx| {
|
_ = stack_panel.update(cx, |view, cx| {
|
||||||
view.remove_panel(Arc::new(tab_view), window, cx);
|
view.remove_panel(Arc::new(tab_view), window, cx);
|
||||||
|
|
@ -400,7 +400,7 @@ impl TabPanel {
|
||||||
cx: &mut Context<Self>,
|
cx: &mut Context<Self>,
|
||||||
) -> impl IntoElement {
|
) -> impl IntoElement {
|
||||||
let is_zoomed = self.is_zoomed;
|
let is_zoomed = self.is_zoomed;
|
||||||
let view = cx.model().clone();
|
let view = cx.entity().clone();
|
||||||
let zoomable_toolbar_visible = state.zoomable.map_or(false, |v| v.toolbar_visible());
|
let zoomable_toolbar_visible = state.zoomable.map_or(false, |v| v.toolbar_visible());
|
||||||
|
|
||||||
// TODO: Do not show MenuButton if there is no menu items
|
// TODO: Do not show MenuButton if there is no menu items
|
||||||
|
|
@ -480,7 +480,7 @@ impl TabPanel {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
let view_entity_id = cx.model().entity_id();
|
let view_entity_id = cx.entity().entity_id();
|
||||||
let toggle_button_panels = dock_area.toggle_button_panels;
|
let toggle_button_panels = dock_area.toggle_button_panels;
|
||||||
|
|
||||||
// Check if current TabPanel's entity_id matches the one stored in DockArea for this placement
|
// Check if current TabPanel's entity_id matches the one stored in DockArea for this placement
|
||||||
|
|
@ -553,7 +553,7 @@ impl TabPanel {
|
||||||
window: &mut Window,
|
window: &mut Window,
|
||||||
cx: &mut Context<Self>,
|
cx: &mut Context<Self>,
|
||||||
) -> impl IntoElement {
|
) -> impl IntoElement {
|
||||||
let view = cx.model().clone();
|
let view = cx.entity().clone();
|
||||||
|
|
||||||
let Some(dock_area) = self.dock_area.upgrade() else {
|
let Some(dock_area) = self.dock_area.upgrade() else {
|
||||||
return div().into_any_element();
|
return div().into_any_element();
|
||||||
|
|
@ -838,7 +838,7 @@ impl TabPanel {
|
||||||
cx: &mut Context<Self>,
|
cx: &mut Context<Self>,
|
||||||
) {
|
) {
|
||||||
let panel = drag.panel.clone();
|
let panel = drag.panel.clone();
|
||||||
let is_same_tab = drag.tab_panel == cx.model();
|
let is_same_tab = drag.tab_panel == cx.entity();
|
||||||
|
|
||||||
// If target is same tab, and it is only one panel, do nothing.
|
// If target is same tab, and it is only one panel, do nothing.
|
||||||
if is_same_tab && ix.is_none() {
|
if is_same_tab && ix.is_none() {
|
||||||
|
|
@ -904,7 +904,7 @@ impl TabPanel {
|
||||||
|
|
||||||
let ix = stack_panel
|
let ix = stack_panel
|
||||||
.read(cx)
|
.read(cx)
|
||||||
.index_of_panel(Arc::new(cx.model().clone()))
|
.index_of_panel(Arc::new(cx.entity().clone()))
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
|
|
||||||
if parent_axis.is_vertical() && placement.is_vertical() {
|
if parent_axis.is_vertical() && placement.is_vertical() {
|
||||||
|
|
@ -933,10 +933,10 @@ impl TabPanel {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// 1. Create new StackPanel with new axis
|
// 1. Create new StackPanel with new axis
|
||||||
// 2. Move cx.model() from parent StackPanel to the new StackPanel
|
// 2. Move cx.entity() from parent StackPanel to the new StackPanel
|
||||||
// 3. Add the new TabPanel to the new StackPanel at the correct index
|
// 3. Add the new TabPanel to the new StackPanel at the correct index
|
||||||
// 4. Add new StackPanel to the parent StackPanel at the correct index
|
// 4. Add new StackPanel to the parent StackPanel at the correct index
|
||||||
let tab_panel = cx.model().clone();
|
let tab_panel = cx.entity().clone();
|
||||||
|
|
||||||
// Try to use the old stack panel, not just create a new one, to avoid too many nested stack panels
|
// Try to use the old stack panel, not just create a new one, to avoid too many nested stack panels
|
||||||
let new_stack_panel = if stack_panel.read(cx).panels_len() <= 1 {
|
let new_stack_panel = if stack_panel.read(cx).panels_len() <= 1 {
|
||||||
|
|
|
||||||
|
|
@ -837,7 +837,7 @@ impl EventEmitter<PanelEvent> for Tiles {}
|
||||||
impl EventEmitter<DismissEvent> for Tiles {}
|
impl EventEmitter<DismissEvent> for Tiles {}
|
||||||
impl Render for Tiles {
|
impl Render for Tiles {
|
||||||
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
let view = cx.model().clone();
|
let view = cx.entity().clone();
|
||||||
let view_id = view.entity_id();
|
let view_id = view.entity_id();
|
||||||
let panels = self.sorted_panels();
|
let panels = self.sorted_panels();
|
||||||
let scroll_bounds =
|
let scroll_bounds =
|
||||||
|
|
|
||||||
|
|
@ -338,7 +338,7 @@ where
|
||||||
let focus_handle = cx.focus_handle();
|
let focus_handle = cx.focus_handle();
|
||||||
let delegate = DropdownListDelegate {
|
let delegate = DropdownListDelegate {
|
||||||
delegate,
|
delegate,
|
||||||
dropdown: cx.model().downgrade(),
|
dropdown: cx.entity().downgrade(),
|
||||||
selected_index,
|
selected_index,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -604,7 +604,7 @@ where
|
||||||
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
let is_focused = self.focus_handle.is_focused(window);
|
let is_focused = self.focus_handle.is_focused(window);
|
||||||
let show_clean = self.cleanable && self.selected_index(cx).is_some();
|
let show_clean = self.cleanable && self.selected_index(cx).is_some();
|
||||||
let view = cx.model().clone();
|
let view = cx.entity().clone();
|
||||||
let bounds = self.bounds;
|
let bounds = self.bounds;
|
||||||
let allow_open = !(self.open || self.disabled);
|
let allow_open = !(self.open || self.disabled);
|
||||||
let outline_visible = self.open || is_focused && !self.disabled;
|
let outline_visible = self.open || is_focused && !self.disabled;
|
||||||
|
|
|
||||||
|
|
@ -12,10 +12,10 @@ use unicode_segmentation::*;
|
||||||
use gpui::prelude::FluentBuilder as _;
|
use gpui::prelude::FluentBuilder as _;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
actions, div, point, px, AnyElement, App, AppContext, Bounds, ClickEvent, ClipboardItem,
|
actions, div, point, px, AnyElement, App, AppContext, Bounds, ClickEvent, ClipboardItem,
|
||||||
Context, Entity, EventEmitter, FocusHandle, Focusable, InteractiveElement as _, IntoElement,
|
Context, Entity, EntityInputHandler, EventEmitter, FocusHandle, Focusable,
|
||||||
KeyBinding, KeyDownEvent, MouseButton, MouseDownEvent, MouseMoveEvent, MouseUpEvent,
|
InteractiveElement as _, IntoElement, KeyBinding, KeyDownEvent, MouseButton, MouseDownEvent,
|
||||||
ParentElement as _, Pixels, Point, Rems, Render, ScrollHandle, ScrollWheelEvent, SharedString,
|
MouseMoveEvent, MouseUpEvent, ParentElement as _, Pixels, Point, Rems, Render, ScrollHandle,
|
||||||
Styled as _, UTF16Selection, ViewInputHandler, Window, WrappedLine,
|
ScrollWheelEvent, SharedString, Styled as _, UTF16Selection, Window, WrappedLine,
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO:
|
// TODO:
|
||||||
|
|
@ -1362,7 +1362,7 @@ impl Sizable for TextInput {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ViewInputHandler for TextInput {
|
impl EntityInputHandler for TextInput {
|
||||||
fn text_for_range(
|
fn text_for_range(
|
||||||
&mut self,
|
&mut self,
|
||||||
range_utf16: Range<usize>,
|
range_utf16: Range<usize>,
|
||||||
|
|
@ -1593,7 +1593,7 @@ impl Render for TextInput {
|
||||||
.id("TextElement")
|
.id("TextElement")
|
||||||
.flex_grow()
|
.flex_grow()
|
||||||
.overflow_x_hidden()
|
.overflow_x_hidden()
|
||||||
.child(TextElement::new(cx.model().clone())),
|
.child(TextElement::new(cx.entity().clone())),
|
||||||
)
|
)
|
||||||
.when(self.loading, |this| {
|
.when(self.loading, |this| {
|
||||||
this.child(Indicator::new().color(cx.theme().muted_foreground))
|
this.child(Indicator::new().color(cx.theme().muted_foreground))
|
||||||
|
|
@ -1604,7 +1604,7 @@ impl Render for TextInput {
|
||||||
)
|
)
|
||||||
.children(suffix)
|
.children(suffix)
|
||||||
.when(self.is_multi_line(), |this| {
|
.when(self.is_multi_line(), |this| {
|
||||||
let entity_id = cx.model().entity_id();
|
let entity_id = cx.entity().entity_id();
|
||||||
if self.last_layout.is_some() {
|
if self.last_layout.is_some() {
|
||||||
let scroll_size = self.scroll_size;
|
let scroll_size = self.scroll_size;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -285,7 +285,7 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
Some(Scrollbar::uniform_scroll(
|
Some(Scrollbar::uniform_scroll(
|
||||||
cx.model().entity_id(),
|
cx.entity().entity_id(),
|
||||||
self.scrollbar_state.clone(),
|
self.scrollbar_state.clone(),
|
||||||
self.vertical_scroll_handle.clone(),
|
self.vertical_scroll_handle.clone(),
|
||||||
))
|
))
|
||||||
|
|
@ -520,7 +520,7 @@ where
|
||||||
D: ListDelegate,
|
D: ListDelegate,
|
||||||
{
|
{
|
||||||
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
let view = cx.model().clone();
|
let view = cx.entity().clone();
|
||||||
let vertical_scroll_handle = self.vertical_scroll_handle.clone();
|
let vertical_scroll_handle = self.vertical_scroll_handle.clone();
|
||||||
let items_count = self.delegate.items_count(cx);
|
let items_count = self.delegate.items_count(cx);
|
||||||
let loading = self.delegate.loading(cx);
|
let loading = self.delegate.loading(cx);
|
||||||
|
|
|
||||||
|
|
@ -331,7 +331,7 @@ impl PopupMenu {
|
||||||
f: impl Fn(PopupMenu, &mut Window, &mut Context<PopupMenu>) -> PopupMenu + 'static,
|
f: impl Fn(PopupMenu, &mut Window, &mut Context<PopupMenu>) -> PopupMenu + 'static,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let submenu = PopupMenu::build(window, cx, f);
|
let submenu = PopupMenu::build(window, cx, f);
|
||||||
let parent_menu = cx.model().downgrade();
|
let parent_menu = cx.entity().downgrade();
|
||||||
submenu.update(cx, |view, _| {
|
submenu.update(cx, |view, _| {
|
||||||
view.parent_menu = Some(parent_menu);
|
view.parent_menu = Some(parent_menu);
|
||||||
});
|
});
|
||||||
|
|
@ -507,7 +507,7 @@ impl Focusable for PopupMenu {
|
||||||
|
|
||||||
impl Render for PopupMenu {
|
impl Render for PopupMenu {
|
||||||
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
let view = cx.model().clone();
|
let view = cx.entity().clone();
|
||||||
let has_icon = self.menu_items.iter().any(|item| item.has_icon());
|
let has_icon = self.menu_items.iter().any(|item| item.has_icon());
|
||||||
let items_count = self.menu_items.len();
|
let items_count = self.menu_items.len();
|
||||||
let max_width = self.max_width;
|
let max_width = self.max_width;
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@ impl ResizablePanelGroup {
|
||||||
pub fn add_child(&mut self, panel: ResizablePanel, cx: &mut Context<Self>) {
|
pub fn add_child(&mut self, panel: ResizablePanel, cx: &mut Context<Self>) {
|
||||||
let mut panel = panel;
|
let mut panel = panel;
|
||||||
panel.axis = self.axis;
|
panel.axis = self.axis;
|
||||||
panel.group = Some(cx.model().downgrade());
|
panel.group = Some(cx.entity().downgrade());
|
||||||
self.sizes.push(panel.initial_size.unwrap_or_default());
|
self.sizes.push(panel.initial_size.unwrap_or_default());
|
||||||
self.panels.push(cx.new(|_| panel));
|
self.panels.push(cx.new(|_| panel));
|
||||||
}
|
}
|
||||||
|
|
@ -116,7 +116,7 @@ impl ResizablePanelGroup {
|
||||||
) {
|
) {
|
||||||
let mut panel = panel;
|
let mut panel = panel;
|
||||||
panel.axis = self.axis;
|
panel.axis = self.axis;
|
||||||
panel.group = Some(cx.model().downgrade());
|
panel.group = Some(cx.entity().downgrade());
|
||||||
|
|
||||||
self.sizes
|
self.sizes
|
||||||
.insert(ix, panel.initial_size.unwrap_or_default());
|
.insert(ix, panel.initial_size.unwrap_or_default());
|
||||||
|
|
@ -141,7 +141,7 @@ impl ResizablePanelGroup {
|
||||||
panel.initial_size = old_panel_initial_size;
|
panel.initial_size = old_panel_initial_size;
|
||||||
panel.size_ratio = old_panel_size_ratio;
|
panel.size_ratio = old_panel_size_ratio;
|
||||||
panel.axis = self.axis;
|
panel.axis = self.axis;
|
||||||
panel.group = Some(cx.model().downgrade());
|
panel.group = Some(cx.entity().downgrade());
|
||||||
self.sizes[ix] = panel.initial_size.unwrap_or_default();
|
self.sizes[ix] = panel.initial_size.unwrap_or_default();
|
||||||
self.panels[ix] = cx.new(|_| panel);
|
self.panels[ix] = cx.new(|_| panel);
|
||||||
cx.notify()
|
cx.notify()
|
||||||
|
|
@ -165,7 +165,7 @@ impl ResizablePanelGroup {
|
||||||
_: &mut Window,
|
_: &mut Window,
|
||||||
cx: &mut Context<Self>,
|
cx: &mut Context<Self>,
|
||||||
) -> impl IntoElement {
|
) -> impl IntoElement {
|
||||||
let view = cx.model().clone();
|
let view = cx.entity().clone();
|
||||||
resize_handle(("resizable-handle", ix), self.axis).on_drag(
|
resize_handle(("resizable-handle", ix), self.axis).on_drag(
|
||||||
DragPanel((cx.entity_id(), ix, self.axis)),
|
DragPanel((cx.entity_id(), ix, self.axis)),
|
||||||
move |drag_panel, _, _, cx| {
|
move |drag_panel, _, _, cx| {
|
||||||
|
|
@ -264,7 +264,7 @@ impl ResizablePanelGroup {
|
||||||
impl EventEmitter<ResizablePanelEvent> for ResizablePanelGroup {}
|
impl EventEmitter<ResizablePanelEvent> for ResizablePanelGroup {}
|
||||||
impl Render for ResizablePanelGroup {
|
impl Render for ResizablePanelGroup {
|
||||||
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
let view = cx.model().clone();
|
let view = cx.entity().clone();
|
||||||
let container = if self.axis.is_horizontal() {
|
let container = if self.axis.is_horizontal() {
|
||||||
h_flex()
|
h_flex()
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -292,7 +292,7 @@ impl Render for ResizablePanelGroup {
|
||||||
.size_full()
|
.size_full()
|
||||||
})
|
})
|
||||||
.child(ResizePanelGroupElement {
|
.child(ResizePanelGroupElement {
|
||||||
view: cx.model().clone(),
|
view: cx.entity().clone(),
|
||||||
axis: self.axis,
|
axis: self.axis,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -365,7 +365,7 @@ impl ResizablePanel {
|
||||||
self.size_ratio = None;
|
self.size_ratio = None;
|
||||||
self.size = Some(new_size);
|
self.size = Some(new_size);
|
||||||
|
|
||||||
let entity_id = cx.model().entity_id();
|
let entity_id = cx.entity().entity_id();
|
||||||
if let Some(group) = self.group.as_ref() {
|
if let Some(group) = self.group.as_ref() {
|
||||||
_ = group.update(cx, |view, _| {
|
_ = group.update(cx, |view, _| {
|
||||||
if let Some(ix) = view.panels.iter().position(|v| v.entity_id() == entity_id) {
|
if let Some(ix) = view.panels.iter().position(|v| v.entity_id() == entity_id) {
|
||||||
|
|
@ -388,7 +388,7 @@ impl Render for ResizablePanel {
|
||||||
return div();
|
return div();
|
||||||
}
|
}
|
||||||
|
|
||||||
let view = cx.model().clone();
|
let view = cx.entity().clone();
|
||||||
let total_size = self
|
let total_size = self
|
||||||
.group
|
.group
|
||||||
.as_ref()
|
.as_ref()
|
||||||
|
|
|
||||||
|
|
@ -262,14 +262,14 @@ impl Root {
|
||||||
where
|
where
|
||||||
F: FnOnce(&mut Self, &mut Window, &mut Context<Self>) + 'static,
|
F: FnOnce(&mut Self, &mut Window, &mut Context<Self>) + 'static,
|
||||||
{
|
{
|
||||||
if let Some(Some(root)) = window.root_model::<Root>() {
|
if let Some(Some(root)) = window.root::<Root>() {
|
||||||
root.update(cx, |root, cx| f(root, window, cx));
|
root.update(cx, |root, cx| f(root, window, cx));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn read<'a>(window: &'a mut Window, cx: &'a mut App) -> &'a Self {
|
pub fn read<'a>(window: &'a Window, cx: &'a App) -> &'a Self {
|
||||||
&window
|
&window
|
||||||
.root_model::<Root>()
|
.root::<Root>()
|
||||||
.expect("The window root view should be of type `ui::Root`.")
|
.expect("The window root view should be of type `ui::Root`.")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.read(cx)
|
.read(cx)
|
||||||
|
|
@ -286,7 +286,7 @@ impl Root {
|
||||||
window: &mut Window,
|
window: &mut Window,
|
||||||
cx: &mut App,
|
cx: &mut App,
|
||||||
) -> Option<impl IntoElement> {
|
) -> Option<impl IntoElement> {
|
||||||
let root = window.root_model::<Root>()??;
|
let root = window.root::<Root>()??;
|
||||||
|
|
||||||
let active_drawer_placement = root.read(cx).active_drawer.clone().map(|d| d.placement);
|
let active_drawer_placement = root.read(cx).active_drawer.clone().map(|d| d.placement);
|
||||||
|
|
||||||
|
|
@ -306,7 +306,7 @@ impl Root {
|
||||||
|
|
||||||
/// Render the Drawer layer.
|
/// Render the Drawer layer.
|
||||||
pub fn render_drawer_layer(window: &mut Window, cx: &mut App) -> Option<impl IntoElement> {
|
pub fn render_drawer_layer(window: &mut Window, cx: &mut App) -> Option<impl IntoElement> {
|
||||||
let root = window.root_model::<Root>()??;
|
let root = window.root::<Root>()??;
|
||||||
|
|
||||||
if let Some(active_drawer) = root.read(cx).active_drawer.clone() {
|
if let Some(active_drawer) = root.read(cx).active_drawer.clone() {
|
||||||
let mut drawer = Drawer::new(window, cx);
|
let mut drawer = Drawer::new(window, cx);
|
||||||
|
|
@ -333,7 +333,7 @@ impl Root {
|
||||||
|
|
||||||
/// Render the Modal layer.
|
/// Render the Modal layer.
|
||||||
pub fn render_modal_layer(window: &mut Window, cx: &mut App) -> Option<impl IntoElement> {
|
pub fn render_modal_layer(window: &mut Window, cx: &mut App) -> Option<impl IntoElement> {
|
||||||
let root = window.root_model::<Root>()??;
|
let root = window.root::<Root>()??;
|
||||||
|
|
||||||
let active_modals = root.read(cx).active_modals.clone();
|
let active_modals = root.read(cx).active_modals.clone();
|
||||||
let mut has_overlay = false;
|
let mut has_overlay = false;
|
||||||
|
|
|
||||||
|
|
@ -260,7 +260,7 @@ impl Render for Slider {
|
||||||
)
|
)
|
||||||
.child(self.render_thumb(thumb_bar_size, window, cx))
|
.child(self.render_thumb(thumb_bar_size, window, cx))
|
||||||
.child({
|
.child({
|
||||||
let view = cx.model().clone();
|
let view = cx.entity().clone();
|
||||||
canvas(
|
canvas(
|
||||||
move |bounds, _, cx| view.update(cx, |r, _| r.bounds = bounds),
|
move |bounds, _, cx| view.update(cx, |r, _| r.bounds = bounds),
|
||||||
|_, _, _, _| {},
|
|_, _, _, _| {},
|
||||||
|
|
|
||||||
|
|
@ -867,7 +867,7 @@ where
|
||||||
.right_0()
|
.right_0()
|
||||||
.bottom_0()
|
.bottom_0()
|
||||||
.child(Scrollbar::uniform_scroll(
|
.child(Scrollbar::uniform_scroll(
|
||||||
cx.model().entity_id(),
|
cx.entity().entity_id(),
|
||||||
state,
|
state,
|
||||||
self.vertical_scroll_handle.clone(),
|
self.vertical_scroll_handle.clone(),
|
||||||
)),
|
)),
|
||||||
|
|
@ -889,7 +889,7 @@ where
|
||||||
.bottom_0()
|
.bottom_0()
|
||||||
.size_full()
|
.size_full()
|
||||||
.child(Scrollbar::horizontal(
|
.child(Scrollbar::horizontal(
|
||||||
cx.model().entity_id(),
|
cx.entity().entity_id(),
|
||||||
state,
|
state,
|
||||||
self.horizontal_scroll_handle.clone(),
|
self.horizontal_scroll_handle.clone(),
|
||||||
self.head_content_bounds().size,
|
self.head_content_bounds().size,
|
||||||
|
|
@ -1101,7 +1101,7 @@ where
|
||||||
.child(self.render_resize_handle(col_ix, window, cx))
|
.child(self.render_resize_handle(col_ix, window, cx))
|
||||||
// to save the bounds of this col.
|
// to save the bounds of this col.
|
||||||
.child({
|
.child({
|
||||||
let view = cx.model().clone();
|
let view = cx.entity().clone();
|
||||||
canvas(
|
canvas(
|
||||||
move |bounds, _, cx| {
|
move |bounds, _, cx| {
|
||||||
view.update(cx, |r, _| r.col_groups[col_ix].bounds = bounds)
|
view.update(cx, |r, _| r.col_groups[col_ix].bounds = bounds)
|
||||||
|
|
@ -1119,7 +1119,7 @@ where
|
||||||
window: &mut Window,
|
window: &mut Window,
|
||||||
cx: &mut Context<Self>,
|
cx: &mut Context<Self>,
|
||||||
) -> impl IntoElement {
|
) -> impl IntoElement {
|
||||||
let view = cx.model().clone();
|
let view = cx.entity().clone();
|
||||||
let horizontal_scroll_handle = self.horizontal_scroll_handle.clone();
|
let horizontal_scroll_handle = self.horizontal_scroll_handle.clone();
|
||||||
|
|
||||||
h_flex()
|
h_flex()
|
||||||
|
|
@ -1218,7 +1218,7 @@ where
|
||||||
let horizontal_scroll_handle = self.horizontal_scroll_handle.clone();
|
let horizontal_scroll_handle = self.horizontal_scroll_handle.clone();
|
||||||
let is_stripe_row = self.stripe && row_ix % 2 != 0;
|
let is_stripe_row = self.stripe && row_ix % 2 != 0;
|
||||||
let is_selected = self.selected_row == Some(row_ix);
|
let is_selected = self.selected_row == Some(row_ix);
|
||||||
let view = cx.model().clone();
|
let view = cx.entity().clone();
|
||||||
|
|
||||||
if row_ix < rows_count {
|
if row_ix < rows_count {
|
||||||
self.delegate
|
self.delegate
|
||||||
|
|
@ -1478,7 +1478,7 @@ where
|
||||||
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
self.measure(window, cx);
|
self.measure(window, cx);
|
||||||
|
|
||||||
let view = cx.model().clone();
|
let view = cx.entity().clone();
|
||||||
let vertical_scroll_handle = self.vertical_scroll_handle.clone();
|
let vertical_scroll_handle = self.vertical_scroll_handle.clone();
|
||||||
let horizontal_scroll_handle = self.horizontal_scroll_handle.clone();
|
let horizontal_scroll_handle = self.horizontal_scroll_handle.clone();
|
||||||
let cols_count: usize = self.delegate.cols_count(cx);
|
let cols_count: usize = self.delegate.cols_count(cx);
|
||||||
|
|
@ -1590,7 +1590,7 @@ where
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let view = cx.model().clone();
|
let view = cx.entity().clone();
|
||||||
div()
|
div()
|
||||||
.size_full()
|
.size_full()
|
||||||
.when(self.border, |this| {
|
.when(self.border, |this| {
|
||||||
|
|
@ -1603,7 +1603,7 @@ where
|
||||||
.when(!loading, |this| {
|
.when(!loading, |this| {
|
||||||
this.child(inner_table)
|
this.child(inner_table)
|
||||||
.child(ScrollableMask::new(
|
.child(ScrollableMask::new(
|
||||||
cx.model().entity_id(),
|
cx.entity().entity_id(),
|
||||||
Axis::Horizontal,
|
Axis::Horizontal,
|
||||||
&horizontal_scroll_handle,
|
&horizontal_scroll_handle,
|
||||||
))
|
))
|
||||||
|
|
|
||||||
|
|
@ -85,13 +85,13 @@ impl Render for WebView {
|
||||||
window: &mut gpui::Window,
|
window: &mut gpui::Window,
|
||||||
cx: &mut gpui::Context<Self>,
|
cx: &mut gpui::Context<Self>,
|
||||||
) -> impl IntoElement {
|
) -> impl IntoElement {
|
||||||
let view = cx.model().clone();
|
let view = cx.entity().clone();
|
||||||
|
|
||||||
div()
|
div()
|
||||||
.track_focus(&self.focus_handle)
|
.track_focus(&self.focus_handle)
|
||||||
.size_full()
|
.size_full()
|
||||||
.child({
|
.child({
|
||||||
let view = cx.model().clone();
|
let view = cx.entity().clone();
|
||||||
canvas(
|
canvas(
|
||||||
move |bounds, _, cx| view.update(cx, |r, _| r.bounds = bounds),
|
move |bounds, _, cx| view.update(cx, |r, _| r.bounds = bounds),
|
||||||
|_, _, _, _| {},
|
|_, _, _, _| {},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue