Tidy up workspace resizing
This commit is contained in:
parent
e2bfd46455
commit
416bb45531
2 changed files with 10 additions and 14 deletions
|
@ -1,10 +1,9 @@
|
||||||
use crate::DraggedDock;
|
use crate::DraggedDock;
|
||||||
use crate::{status_bar::StatusItemView, Workspace};
|
use crate::{status_bar::StatusItemView, Workspace};
|
||||||
use gpui::{
|
use gpui::{
|
||||||
div, px, red, Action, AnchorCorner, AnyView, AppContext, Axis, ClickEvent, Div, Entity,
|
div, px, Action, AnchorCorner, AnyView, AppContext, Axis, ClickEvent, Div, Entity, EntityId,
|
||||||
EntityId, EventEmitter, FocusHandle, FocusableView, IntoElement, MouseButton, ParentElement,
|
EventEmitter, FocusHandle, FocusableView, IntoElement, MouseButton, ParentElement, Render,
|
||||||
Render, SharedString, Styled, Subscription, View, ViewContext, VisualContext, WeakView,
|
SharedString, Styled, Subscription, View, ViewContext, VisualContext, WeakView, WindowContext,
|
||||||
WindowContext,
|
|
||||||
};
|
};
|
||||||
use schemars::JsonSchema;
|
use schemars::JsonSchema;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
@ -493,16 +492,16 @@ impl Render for Dock {
|
||||||
let position = self.position;
|
let position = self.position;
|
||||||
let handler = div()
|
let handler = div()
|
||||||
.id("resize-handle")
|
.id("resize-handle")
|
||||||
// .bg(cx.theme().colors().border)
|
.bg(cx.theme().colors().border)
|
||||||
.bg(red())
|
|
||||||
.on_drag(move |cx| cx.build_view(|_| DraggedDock(position)))
|
.on_drag(move |cx| cx.build_view(|_| DraggedDock(position)))
|
||||||
.on_click(cx.listener(|v, e: &ClickEvent, cx| {
|
.on_click(cx.listener(|v, e: &ClickEvent, cx| {
|
||||||
if e.down.button == MouseButton::Left && e.down.click_count == 2 {
|
if e.down.button == MouseButton::Left && e.down.click_count == 2 {
|
||||||
v.resize_active_panel(None, cx)
|
v.resize_active_panel(None, cx)
|
||||||
}
|
}
|
||||||
}));
|
}))
|
||||||
|
.z_index(1);
|
||||||
|
|
||||||
const HANDLE_SIZE: Pixels = Pixels(4. * 3.);
|
const HANDLE_SIZE: Pixels = Pixels(6.);
|
||||||
|
|
||||||
match self.position() {
|
match self.position() {
|
||||||
DockPosition::Left => {
|
DockPosition::Left => {
|
||||||
|
|
|
@ -29,9 +29,9 @@ use futures::{
|
||||||
Future, FutureExt, StreamExt,
|
Future, FutureExt, StreamExt,
|
||||||
};
|
};
|
||||||
use gpui::{
|
use gpui::{
|
||||||
actions, canvas, div, impl_actions, outline, point, size, Action, AnyModel, AnyView,
|
actions, canvas, div, impl_actions, point, size, Action, AnyModel, AnyView, AnyWeakView,
|
||||||
AnyWeakView, AnyWindowHandle, AppContext, AsyncAppContext, AsyncWindowContext, Bounds, Context,
|
AnyWindowHandle, AppContext, AsyncAppContext, AsyncWindowContext, Bounds, Context, Div,
|
||||||
Div, DragMoveEvent, Entity, EntityId, EventEmitter, FocusHandle, FocusableView, GlobalPixels,
|
DragMoveEvent, Entity, EntityId, EventEmitter, FocusHandle, FocusableView, GlobalPixels,
|
||||||
InteractiveElement, KeyContext, ManagedView, Model, ModelContext, ParentElement,
|
InteractiveElement, KeyContext, ManagedView, Model, ModelContext, ParentElement,
|
||||||
PathPromptOptions, Pixels, Point, PromptLevel, Render, Size, Styled, Subscription, Task, View,
|
PathPromptOptions, Pixels, Point, PromptLevel, Render, Size, Styled, Subscription, Task, View,
|
||||||
ViewContext, VisualContext, WeakView, WindowBounds, WindowContext, WindowHandle, WindowOptions,
|
ViewContext, VisualContext, WeakView, WindowBounds, WindowContext, WindowHandle, WindowOptions,
|
||||||
|
@ -3629,9 +3629,6 @@ impl Render for Workspace {
|
||||||
.border_color(cx.theme().colors().border)
|
.border_color(cx.theme().colors().border)
|
||||||
.child(
|
.child(
|
||||||
canvas(cx.listener(|workspace, bounds, cx| {
|
canvas(cx.listener(|workspace, bounds, cx| {
|
||||||
cx.with_z_index(100, |cx| {
|
|
||||||
cx.paint_quad(outline(*bounds, gpui::green()));
|
|
||||||
});
|
|
||||||
workspace.bounds = *bounds;
|
workspace.bounds = *bounds;
|
||||||
}))
|
}))
|
||||||
.absolute()
|
.absolute()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue