From 495f7dd9fd84170647715e076e39767a91b5b769 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 25 Sep 2025 05:51:48 +0000 Subject: [PATCH 1/2] Initial plan From 1579019e3cb620661e91f9c91ddb6668d0aa80cb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 25 Sep 2025 06:01:57 +0000 Subject: [PATCH 2/2] Fix branch and window dragging reference issues Co-authored-by: Kitenite <31864905+Kitenite@users.noreply.github.com> --- .../_components/canvas/frame/top-bar/index.tsx | 7 +++++++ .../components/store/editor/frames/manager.ts | 18 +++++++++++++++++- packages/file-system/src/fs.ts | 10 ++++++++-- packages/file-system/src/hooks/useDirectory.ts | 6 +++--- packages/file-system/src/hooks/useFS.tsx | 3 ++- packages/file-system/src/hooks/useFile.ts | 3 ++- 6 files changed, 39 insertions(+), 8 deletions(-) diff --git a/apps/web/client/src/app/project/[id]/_components/canvas/frame/top-bar/index.tsx b/apps/web/client/src/app/project/[id]/_components/canvas/frame/top-bar/index.tsx index 09a66e1c4a..e41bcd0250 100644 --- a/apps/web/client/src/app/project/[id]/_components/canvas/frame/top-bar/index.tsx +++ b/apps/web/client/src/app/project/[id]/_components/canvas/frame/top-bar/index.tsx @@ -62,6 +62,13 @@ export const TopBar = observer( time: Date.now() }; + // If the clicked frame is not selected and this is not a multiselect operation, + // select it first to ensure we drag the correct frame + if (!editorEngine.frames.isSelected(frame.id) && !e.shiftKey) { + editorEngine.frames.select([frame], false); + } + + // Get the currently selected frames after potential selection update const selectedFrames = editorEngine.frames.selected.map(frameData => frameData.frame); const framesToMove = selectedFrames.length > 0 ? selectedFrames : [frame]; diff --git a/apps/web/client/src/components/store/editor/frames/manager.ts b/apps/web/client/src/components/store/editor/frames/manager.ts index c3640d3c17..516e357e2b 100644 --- a/apps/web/client/src/components/store/editor/frames/manager.ts +++ b/apps/web/client/src/components/store/editor/frames/manager.ts @@ -79,11 +79,27 @@ export class FramesManager { } select(frames: Frame[], multiselect = false) { + if (!multiselect) { + this.deselectAll(); + // Without multiselect, always ensure frames are selected + for (const frame of frames) { + this.updateFrameSelection(frame.id, true); + } + } else { + // With multiselect, toggle individual frames + for (const frame of frames) { + this.updateFrameSelection(frame.id, !this.isSelected(frame.id)); + } + } + this.notify(); + } + + ensureSelected(frames: Frame[], multiselect = false) { if (!multiselect) { this.deselectAll(); } for (const frame of frames) { - this.updateFrameSelection(frame.id, !this.isSelected(frame.id)); + this.updateFrameSelection(frame.id, true); } this.notify(); } diff --git a/packages/file-system/src/fs.ts b/packages/file-system/src/fs.ts index ee1073d8fc..545f9d5684 100644 --- a/packages/file-system/src/fs.ts +++ b/packages/file-system/src/fs.ts @@ -7,8 +7,14 @@ */ import type ZenFS from '@zenfs/core'; -import { getFS } from './config'; -import type { FileChangeEvent, FileEntry, FileInfo } from './types'; +import { + type FileChangeEvent, + type FileChangeEvent, + type FileEntry, + type FileEntry, + type FileInfo, + type FileInfo, +} from './types'; export class FileSystem { private fs: typeof ZenFS | null = null; diff --git a/packages/file-system/src/hooks/useDirectory.ts b/packages/file-system/src/hooks/useDirectory.ts index 3ef03a53eb..3b59ddf7d7 100644 --- a/packages/file-system/src/hooks/useDirectory.ts +++ b/packages/file-system/src/hooks/useDirectory.ts @@ -1,6 +1,6 @@ -import { useState, useEffect } from 'react'; -import { useFS } from './useFS'; -import type { FileEntry } from '../types'; +import { useEffect, useState } from 'react'; + +import { type FileEntry, type FileEntry } from '../types'; export function useDirectory(rootDir: string, path: string) { const { fs, isInitializing, error: fsError } = useFS(rootDir); diff --git a/packages/file-system/src/hooks/useFS.tsx b/packages/file-system/src/hooks/useFS.tsx index ca98aec67c..c52d6ba90f 100644 --- a/packages/file-system/src/hooks/useFS.tsx +++ b/packages/file-system/src/hooks/useFS.tsx @@ -1,6 +1,7 @@ 'use client'; -import { useState, useEffect } from 'react'; +import { useEffect, useState } from 'react'; + import { FileSystem } from '../fs'; export function useFS(rootDir: string) { diff --git a/packages/file-system/src/hooks/useFile.ts b/packages/file-system/src/hooks/useFile.ts index db1b897d63..5746e03321 100644 --- a/packages/file-system/src/hooks/useFile.ts +++ b/packages/file-system/src/hooks/useFile.ts @@ -1,4 +1,5 @@ -import { useState, useEffect } from 'react'; +import { useEffect, useState } from 'react'; + import { useFS } from './useFS'; export function useFile(rootDir: string, path: string) {