The animation tab's Fit frames the preview, and the separate Centre button is gone (#111)
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
cc14988338
commit
4c92a9478f
5 files changed
+23
-16
No files matched your search
@@ -23,7 +23,6 @@ export class AnimationEditor extends AssetTabEditor<AnimationAsset, TimelineCanv
|
||||
readonly rootPicker: Dropdown;
|
||||
readonly addRowButton: Button;
|
||||
readonly playButton: Button;
|
||||
readonly centreButton: Button;
|
||||
readonly preview: PreviewCanvas;
|
||||
|
||||
constructor(state: EditorState) {
|
||||
@@ -31,14 +30,18 @@ export class AnimationEditor extends AssetTabEditor<AnimationAsset, TimelineCanv
|
||||
this.rootPicker = new Dropdown('—', { width: ROOT_WIDTH, onClick: () => this.openRootPicker() });
|
||||
this.addRowButton = new Button('+ Row', { onClick: () => this.openRowDialog() });
|
||||
this.playButton = new Button('Play', { width: 64, onClick: () => this.togglePlay() });
|
||||
this.centreButton = new Button('Centre', { onClick: () => this.preview.fit() });
|
||||
const timeline = new TimelineCanvas(state);
|
||||
this.preview = new PreviewCanvas(state, () => ({
|
||||
frame: timeline.playhead,
|
||||
reverse: timeline.playheadReverse,
|
||||
}));
|
||||
timeline.onPlayhead = () => this.preview.redraw();
|
||||
this.mount(timeline, [this.rootPicker, this.addRowButton, this.playButton, this.centreButton]);
|
||||
this.mount(timeline, [this.rootPicker, this.addRowButton, this.playButton]);
|
||||
}
|
||||
|
||||
/** Fit frames the preview; the timeline keeps its own zoom and scroll. */
|
||||
protected override fit(): void {
|
||||
this.preview.fit();
|
||||
}
|
||||
|
||||
/** The preview above, the timeline below, each taking half. */
|
||||
@@ -81,7 +84,7 @@ export class AnimationEditor extends AssetTabEditor<AnimationAsset, TimelineCanv
|
||||
protected override syncExtras(asset: AnimationAsset | null): void {
|
||||
const root = asset ? findAsset(this.state.project, asset.root) : undefined;
|
||||
this.preview.show(asset?.id ?? '');
|
||||
this.centreButton.setEnabled(Boolean(root));
|
||||
this.fitButton.setEnabled(Boolean(root));
|
||||
this.rootPicker.setText(root ? root.name : asset ? 'Animates…' : '—');
|
||||
this.rootPicker.setEnabled(asset !== null);
|
||||
// A row needs something to aim at.
|
||||
|
||||
Reference in new issue
Block a user