ドラッグで複数のオブジェクトを運べるようにする

Open
#142 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 12 days

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
typescript
Domain
desktop, devtools

Research direction

Start with bublys-libs/bubbles-ui/src/lib/utils/drag-types.ts and useUniverseDropZone.ts, then trace the single-object drag start and drop paths described in the issue. Check BatchConvertFeature.tsx, BubblesUI.tsx, and MappingEditorFeature.tsx for the blocked consumers. Done means agreeing on mixed-type, count, receiver, and compatibility behavior, then supporting multi-object drag and drop in those paths.

Written by the indexing model from the issue text.

Description

enhancement OS question

ドラッグが1オブジェクトしか運べない。選択まわりの工事の前提であり、それとは無関係に今も詰まっている場所がある。

現状

// bublys-libs/bubbles-ui/src/lib/utils/drag-types.ts
DragPayload = { type, url, label?, objectId?, sourceBubbleId? }

配列も、複数 objectId も、個数のフィールドも無い。parseDragPayload も最初にヒットした型ひとつを返して終わり。

さらに dragover の最中は dataTransfer の中身が読めない(HTML5 DnD の protected mode。型名しか見えないので hasDragPayload が別に用意してある)。つまり受け入れ側はドロップされるまで「何個来るか」を知る手段がない。ドロップ前に「3件受け入れます」と見せることが今の設計ではできない。

いま詰まっている場所

object-transformer の一括変換 — 複数オブジェクトを受け取る関数が空配列を返すプレースホルダのまま。

// object-transformer-bubly/object-transformer-libs/src/feature/BatchConvertFeature.tsx:20-23
// TODO: usePlaneObjects() — 複数オブジェクトの入力経路が未実装

ポケットの出口 — 溜め場は既にあって永続もするのに、出口は「1件ずつバブルとして開く」だけ(BubblesUI.tsx:240-242)。まとめて渡す先が無い。clearPocket は定義されているがどこからも呼ばれていない。

なぜ選択より先か

selection-and-scope.md で決めた格上げの仕掛けは

選択されているものを掴んだら、選択ぜんぶが荷物になる

なので、この器の上に乗ります。器が単数のままだと、設計スケッチの「2人まとめて人数充足ビューへ運ぶ」は動きません。

決めないといけないこと

1. 型が混ざったとき何を名乗るか
type/staff が2つなら type/staff でいい。Staff と Task が混ざったら? 受け入れ側は型で絞っているので、名乗り方を決めないと「一部だけ受け取れる」状況が扱えない。

2. 個数を dragover で見せるか
見せたいなら、型キーとは別に type/staff に加えて件数を含む型名(count/3 のようなキー)を setData しておく、といった逃げ道が要る。値は読めなくてもキーの存在は読めるので。

3. 受け入れ側が複数を扱えないときの振る舞い
1つだけ受ける / 全部拒否 / 順に処理。宇宙のドロップ(useUniverseDropZone)とポケットの両方が単数前提なので、両方を広げる必要がある。

4. 後方互換
単数の DragPayload を読んでいる箇所が既にある。1件でも配列で運ぶのか、単数のキーも併記するのか。

付随して直したいもの

  • ポケットからドラッグで出すと objectId が落ちる。 ObjectView の handleDragStart は {type, url, label, sourceBubbleId} しか載せず objectId を載せない。明示的に載せているのはリポジトリ全体で gakkai-shift-libs/src/ui/ShiftPlanTableView.tsx:156 の1箇所だけ
  • apps/bublys-os/app/bubble-ui/Pocket/domain/PocketItem.ts はどこからも import されていない死んだクラス(objectId の無い旧型)
  • object-transformer のドロップは parseDragPayload を通さず application/json を直読みしていて、OS のドラッグ規約の外にある(MappingEditorFeature.tsx:54)。console.log("[OT] ...") も残ったまま

参考

Dominant language
TypeScript
Stars
1
Forks
0
Avg merge
9d 13h
Merged PRs (30d)
10

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from fumicode/bublys-org

All issues in fumicode/bublys-org

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.