Refactoring round 5 covers the code since round 4 without changing behaviour: four identical copies of dot() and three of "nearest point on a segment" stood in the collision math, in the hit area of the collider outlines and in the polygon handles, so they moved into the new module src/core/util/vec.ts; the warning line, the busy state, info() and the caret reset were written out line by line in both the sign-in screen and the password dialog and are now FormStatus; the closing row "Cancel plus a confirming button, optionally one on the left" was built by hand in FormDialog, FilePicker, OpenProjectDialog and PasswordDialog and is now dialogButtons(); the header bar was drawn by the toolbar, the TabHeader and the Breadcrumb each on its own and is now drawHeaderBar(); AddColliderCommand and AddRigidbodyCommand share a base, each subclass only builds its own asset; Editor.ts derives the panes from assetEditors instead of repeating eight entries and clamps its splitters with clamp(); jscpd over src falls from 0.19 % to 0.14 %; dead code is gone - listScenes() has been orphaned since the Scene picker fell away (#183), DEFAULT_FILTER (#152) was never used, the two test hooks projectPickerRowAt/rowPosition and particleCompiles are read by no tool, and four functions lost an export they did not need; seven comments that told history ("used to", "no longer", "since #...") describe the state of things now, and that this changed nothing was proved by a rebuild - the bundle is md5 identical, b4ad0dfe... before and after; the README said Logout sits at the far right of the toolbar, which has been the Account menu since #182, and wiki/Architecture.md was missing src/core/util/ altogether; 4 new unit tests cover vec.ts, and switching the clamp on the segment off makes exactly one of them fail while none of the 76 neighbouring tests notice, so that clamping was covered nowhere before (#85)
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
da35f10d1a
commit
ae3aa7d3bd
32 files changed
+240
-246
No files matched your search
@@ -74,10 +74,6 @@ export function findScene(project: Project, sceneId: string): SceneAsset | undef
|
||||
return asset && isSceneAsset(asset) ? asset : undefined;
|
||||
}
|
||||
|
||||
export function listScenes(project: Project): SceneAsset[] {
|
||||
return project.assets.filter(isSceneAsset);
|
||||
}
|
||||
|
||||
export function findGraphAsset(project: Project, assetId: string): GraphAsset | undefined {
|
||||
const asset = findAsset(project, assetId);
|
||||
return asset && isGraphAsset(asset) ? asset : undefined;
|
||||
|
||||
@@ -27,9 +27,6 @@ export interface CollisionFilter {
|
||||
mask: number;
|
||||
}
|
||||
|
||||
/** What a collider carries before anything is set: layer 0, colliding with everything. */
|
||||
export const DEFAULT_FILTER: CollisionFilter = Object.freeze({ layer: 0, mask: ALL_LAYERS });
|
||||
|
||||
/**
|
||||
* The names as stored, read off untrusted JSON: the first one is layer 0 and is always there, a
|
||||
* name that is not a text (or is empty) falls back to its number, and anything past the sixteenth
|
||||
@@ -69,7 +66,7 @@ export function layerMaskOf(value: unknown): number {
|
||||
return Number.isFinite(n) && n >= 0 ? n & ALL_LAYERS : ALL_LAYERS;
|
||||
}
|
||||
|
||||
export function layerBit(layer: number): number {
|
||||
function layerBit(layer: number): number {
|
||||
return 1 << layerIndexOf(layer);
|
||||
}
|
||||
|
||||
|
||||
@@ -188,7 +188,7 @@ function placed(outline: TileOutline, x: number, y: number, size: number): TileO
|
||||
export type OneWayFilter = boolean | number;
|
||||
|
||||
/** The angle a one-way tile lands things within, held to 0 … 90°. */
|
||||
export function tileOneWayAngle(tile: TileAsset): number {
|
||||
function tileOneWayAngle(tile: TileAsset): number {
|
||||
return oneWayAngle(tile.props[TILE_ONE_WAY_ANGLE_KEY]);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user