Files
feuerwerk/src/editor/viewport/sceneViewHost.ts
T
adminandClaude Opus 5.5 e31db3df1d Split tile painting and polygon corners out of SceneViewport (#215)
SceneViewport had grown to 1216 lines. Three blocks carried their own
state and only needed a few things from the view, so they now live in
their own classes. Behaviour is unchanged.

- SceneViewHost is the narrow interface the new classes see of the
  view: state, coordinate mapping, redraw and the preview trigger.
- TilemapPainting owns the paint stroke, the rectangle preview and
  the flood fill, with press/move/release called in the old order.
- PolygonCorners owns hovering, dragging, inserting and deleting the
  corners of a polygon collider.
- TilemapSolids draws the solid outlines of tilemap layers.
- SceneViewport is down to 668 lines.

Findings:
- PaintStroke.holderId was written but never read. It is gone.

Tests:
- ./check.sh: 145 files, 2190 tests, CHECK EXIT 0 (unchanged)
- e2e 1-16,29,31,39-43: ALL PASSED, 679 checks
- Counter-checks in the browser: bending the brush, the corner drag
  and the solid outline each fails exactly the expected checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-23 10:20:03 +02:00

22 lines
787 B
TypeScript

import type { ObjectHolder } from '../../core/model/Project';
import type { Vec2 } from '../../core/model/Properties';
import type { DrawItem } from '../../viewport/items';
import type { EditorState } from '../state';
/** Below this on-screen spacing a grid is noise rather than orientation, so it is dropped. */
export const MIN_GRID_STEP = 12;
/** What the scene view lends the tools that work inside it. */
export interface SceneViewHost {
readonly state: EditorState;
/** What the view shows and edits. */
holder(): ObjectHolder | undefined;
/** What the view drew last. */
items(): readonly DrawItem[];
/** The world point under a global pointer position. */
worldAt(global: Vec2): Vec2;
/** Screen pixels per world unit. */
scale(): number;
redraw(): void;
}