mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-08 07:35:01 +03:00
Ensure panel and pane sizes are integral (#8619)
Fixes: #8050 For some reason that we didn't investigate, if you have view caching enabled, and you have non-integer sized bounds, and you are right aligning things, the co-ordinates can differ by +/- 1px when using the cached view. The easiest fix for now is to just not do that. Co-Authored-By: Antonio <as-cii@zed.dev> Release Notes: - Fixed the pane icons flickering ([#8050](https://github.com/zed-industries/zed/issues/8050)). Co-authored-by: Antonio <as-cii@zed.dev>
This commit is contained in:
parent
db9cc42245
commit
b3b94e64ba
@ -204,7 +204,7 @@ impl ChatPanel {
|
|||||||
let panel = Self::new(workspace, cx);
|
let panel = Self::new(workspace, cx);
|
||||||
if let Some(serialized_panel) = serialized_panel {
|
if let Some(serialized_panel) = serialized_panel {
|
||||||
panel.update(cx, |panel, cx| {
|
panel.update(cx, |panel, cx| {
|
||||||
panel.width = serialized_panel.width;
|
panel.width = serialized_panel.width.map(|r| r.round());
|
||||||
cx.notify();
|
cx.notify();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -327,7 +327,7 @@ impl CollabPanel {
|
|||||||
let panel = CollabPanel::new(workspace, cx);
|
let panel = CollabPanel::new(workspace, cx);
|
||||||
if let Some(serialized_panel) = serialized_panel {
|
if let Some(serialized_panel) = serialized_panel {
|
||||||
panel.update(cx, |panel, cx| {
|
panel.update(cx, |panel, cx| {
|
||||||
panel.width = serialized_panel.width;
|
panel.width = serialized_panel.width.map(|w| w.round());
|
||||||
panel.collapsed_channels = serialized_panel
|
panel.collapsed_channels = serialized_panel
|
||||||
.collapsed_channels
|
.collapsed_channels
|
||||||
.unwrap_or_else(|| Vec::new())
|
.unwrap_or_else(|| Vec::new())
|
||||||
|
@ -183,7 +183,7 @@ impl NotificationPanel {
|
|||||||
let panel = Self::new(workspace, cx);
|
let panel = Self::new(workspace, cx);
|
||||||
if let Some(serialized_panel) = serialized_panel {
|
if let Some(serialized_panel) = serialized_panel {
|
||||||
panel.update(cx, |panel, cx| {
|
panel.update(cx, |panel, cx| {
|
||||||
panel.width = serialized_panel.width;
|
panel.width = serialized_panel.width.map(|w| w.round());
|
||||||
cx.notify();
|
cx.notify();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -338,7 +338,7 @@ impl ProjectPanel {
|
|||||||
let panel = ProjectPanel::new(workspace, cx);
|
let panel = ProjectPanel::new(workspace, cx);
|
||||||
if let Some(serialized_panel) = serialized_panel {
|
if let Some(serialized_panel) = serialized_panel {
|
||||||
panel.update(cx, |panel, cx| {
|
panel.update(cx, |panel, cx| {
|
||||||
panel.width = serialized_panel.width;
|
panel.width = serialized_panel.width.map(|px| px.round());
|
||||||
cx.notify();
|
cx.notify();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -192,8 +192,8 @@ impl TerminalPanel {
|
|||||||
let items = if let Some(serialized_panel) = serialized_panel.as_ref() {
|
let items = if let Some(serialized_panel) = serialized_panel.as_ref() {
|
||||||
panel.update(cx, |panel, cx| {
|
panel.update(cx, |panel, cx| {
|
||||||
cx.notify();
|
cx.notify();
|
||||||
panel.height = serialized_panel.height;
|
panel.height = serialized_panel.height.map(|h| h.round());
|
||||||
panel.width = serialized_panel.width;
|
panel.width = serialized_panel.width.map(|w| w.round());
|
||||||
panel.pane.update(cx, |_, cx| {
|
panel.pane.update(cx, |_, cx| {
|
||||||
serialized_panel
|
serialized_panel
|
||||||
.items
|
.items
|
||||||
|
@ -522,7 +522,7 @@ impl Dock {
|
|||||||
|
|
||||||
pub fn resize_active_panel(&mut self, size: Option<Pixels>, cx: &mut ViewContext<Self>) {
|
pub fn resize_active_panel(&mut self, size: Option<Pixels>, cx: &mut ViewContext<Self>) {
|
||||||
if let Some(entry) = self.panel_entries.get_mut(self.active_panel_index) {
|
if let Some(entry) = self.panel_entries.get_mut(self.active_panel_index) {
|
||||||
let size = size.map(|size| size.max(RESIZE_HANDLE_SIZE));
|
let size = size.map(|size| size.max(RESIZE_HANDLE_SIZE).round());
|
||||||
entry.panel.set_size(size, cx);
|
entry.panel.set_size(size, cx);
|
||||||
cx.notify();
|
cx.notify();
|
||||||
}
|
}
|
||||||
|
@ -883,7 +883,8 @@ mod element {
|
|||||||
|
|
||||||
let child_size = bounds
|
let child_size = bounds
|
||||||
.size
|
.size
|
||||||
.apply_along(self.axis, |_| space_per_flex * child_flex);
|
.apply_along(self.axis, |_| space_per_flex * child_flex)
|
||||||
|
.map(|d| d.round());
|
||||||
|
|
||||||
let child_bounds = Bounds {
|
let child_bounds = Bounds {
|
||||||
origin,
|
origin,
|
||||||
|
Loading…
Reference in New Issue
Block a user