change size for remote desktop

This commit is contained in:
赵一寰 2026-03-13 16:58:34 +08:00
parent 2712bb0f3d
commit 4be856caf3
3 changed files with 54 additions and 2 deletions

View File

@ -591,7 +591,7 @@ export function renderApp(state: AppViewState) {
: nothing
}
${
state.tab === "config"
state.tab === "config" || state.tab === "chat"
? nothing
: html`<section class="content-header">
<div>
@ -1317,7 +1317,17 @@ export function renderApp(state: AppViewState) {
${
state.tab === "chat"
? html`
<div style="flex: 1; display: flex; flex-direction: row; min-height: 0; overflow: hidden;">
<div style="flex: 1; display: flex; flex-direction: column; min-width: 0; padding: 12px 16px 32px; overflow: hidden; gap: 24px;">
<section class="content-header">
<div>
${renderChatSessionSelect(state)}
</div>
<div class="page-meta">
${state.lastError ? html`<div class="pill danger">${state.lastError}</div>` : nothing}
${renderChatControls(state)}
</div>
</section>
${renderChat({
@ -1445,6 +1455,7 @@ export function renderApp(state: AppViewState) {
? html`
<resizable-divider
mode="pixels"
side="right"
orientation="vertical"
.initialWidth=${state.clawComputerWidth}
.minWidth=${400}
@ -1468,6 +1479,7 @@ export function renderApp(state: AppViewState) {
`
: nothing
}
</div>
`
: nothing
}

View File

@ -170,6 +170,9 @@ export class OpenClawApp extends LitElement {
@state() sidebarError: string | null = null;
@state() splitRatio = this.settings.splitRatio;
@state() showClawComputer = false;
@state() clawComputerWidth = 600;
@state() nodesLoading = false;
@state() nodes: Array<Record<string, unknown>> = [];
@state() devicesLoading = false;
@ -710,6 +713,14 @@ export class OpenClawApp extends LitElement {
this.applySettings({ ...this.settings, splitRatio: newRatio });
}
toggleClawComputer() {
this.showClawComputer = !this.showClawComputer;
}
setClawComputerWidth(width: number) {
this.clawComputerWidth = width;
}
render() {
return renderApp(this as unknown as AppViewState);
}

View File

@ -11,9 +11,16 @@ export class ResizableDivider extends LitElement {
@property({ type: Number }) minRatio = 0.4;
@property({ type: Number }) maxRatio = 0.7;
@property({ type: String }) mode: "ratio" | "pixels" = "ratio";
@property({ type: String }) side: "left" | "right" = "left";
@property({ type: Number }) initialWidth = 0;
@property({ type: Number }) minWidth = 0;
@property({ type: Number }) maxWidth = Infinity;
private isDragging = false;
private startX = 0;
private startRatio = 0;
private startWidth = 0;
static styles = css`
:host {
@ -60,6 +67,7 @@ export class ResizableDivider extends LitElement {
this.isDragging = true;
this.startX = e.clientX;
this.startRatio = this.splitRatio;
this.startWidth = this.initialWidth;
this.classList.add("dragging");
document.addEventListener("mousemove", this.handleMouseMove);
@ -78,8 +86,29 @@ export class ResizableDivider extends LitElement {
return;
}
const containerWidth = container.getBoundingClientRect().width;
const deltaX = e.clientX - this.startX;
if (this.mode === "pixels") {
let newWidth = this.startWidth;
if (this.side === "left") {
newWidth += deltaX;
} else {
newWidth -= deltaX;
}
newWidth = Math.max(this.minWidth, Math.min(this.maxWidth, newWidth));
this.dispatchEvent(
new CustomEvent("resize", {
detail: { width: newWidth },
bubbles: true,
composed: true,
}),
);
return;
}
const containerWidth = container.getBoundingClientRect().width;
const deltaRatio = deltaX / containerWidth;
let newRatio = this.startRatio + deltaRatio;