bubble-layout の端の扱い(魚眼の箱の反復打ち切り・子孫への落とし込み・ゼロ除算)

Open
#201 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
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
typescript
Domain
backend

Research direction

Start with the cited domain entry points: src/lib/domain/measure.ts, drop.ts, pin.ts, resolve.ts, project.ts, and drag.ts; compare their existing tests and callers before changing behavior. Reproduce the listed edge cases, including whether the fisheye sizing behavior is intended, and check the UI caller in useBubbleInput.ts. Done means the domain preserves valid tree structure, handles degenerate inputs, and uses consistent overflow checks, with tests covering the outcomes.

Written by the indexing model from the issue text.

Description

OS question

bublys-libs/bubble-layout の domain で、ふだんの操作では踏みにくいが、端の入力で答えが崩れるものです。

1. 魚眼の箱の大きさを求める反復が、打ち切りの 60 回で止まる(収束しない)

  • 場所:measure.ts:103-120

  • 1 回の反復で半幅が伸びるのは最大 pad(14px)ぶんなので、60 回では 840px までしか伸びない。収束していれば H − need = 14 になるはずが、coverflow(幅 340・札 90)で測ると:

    札の数 box.w H − need
    40 1225 13.787
    80 1898 5.997
    150 2019 0.081
  • 箱の大きさが反復回数で決まってしまい、それを知らせる手段も無い

  • 設計の確認:grow の既定が true なので、魚眼の箱が札の数にほぼ比例して横に伸びる(40 枚で 1225px)。魚眼の意図と合っているか

2. 自分の子孫へ落とすのを domain が防いでいない

  • 場所:spaceSlotAt(drop.ts:173-187)
  • コメントには「掴んだ泡とその中身は除く」とあるが、hitSpace を検査していない
  • 実測:commitDrop で A をその子 B へ落とすと A.parent = B の循環ができる。例外は出ず、A と B が画面から消える。以後 isAncestor などが無限ループになりうる
  • いまは ui 側(useBubbleInput.ts:606 が skip を渡している)で防げている。domain の動詞として守るべき不変条件

3. 退化したときのゼロ除算

  • sizeFit の product で倍率が 0 に潰れると scale = 0。その seen を keepSeen に渡すと 1/m で free.z = Infinity(pin.ts:138-140)
  • equal の step: 0 にも防御が無い(valueFromPos)。一方 wheelZ / turnBy は step || 1 で守っている

4. 「収まらない並び」の判定が 3 か所にあり、余白の取り方が違う

  • resolve.ts:294-297 は padOf(見えない親なら 0)、project.ts:235-242 と drag.ts:257-265 は METRICS.PAD 固定
  • 見えない親の並びでは、fitFocus が「はみ出している」と数えて焦点を ±14 まで許す計算になる(要確認。いまの操作経路からは到達しにくい)
  • 1 か所の関数にまとめる

(行番号は main d41a42da 時点)

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.