Add REMOVE button to Snapshot Edit dialog.

This commit is contained in:
Robin E.R. Davies
2026-05-30 22:37:31 -04:00
parent 533e313b40
commit 9bc348bc9e
6 changed files with 81 additions and 27 deletions
+19 -7
View File
@@ -121,8 +121,7 @@ export default class SnapshotPanel extends ResizeResponsiveComponent<SnapshotPan
}
getCollapseButtons() {
if (this.getPortraitOrientation())
{
if (this.getPortraitOrientation()) {
return document.documentElement.clientWidth < 550;
} else {
return document.documentElement.clientWidth < 800;
@@ -188,21 +187,31 @@ export default class SnapshotPanel extends ResizeResponsiveComponent<SnapshotPan
}
renderSnapshot(snapshot: Snapshot | null, index: number) {
return (
<SnapshotButton key={"s"+index}
<SnapshotButton key={"s" + index}
snapshot={snapshot}
snapshotIndex={index}
collapseButtons={this.state.collapseButtons}
selected={this.state.selectedSnapshot === index}
largeText={this.state.largeText}
onEditSnapshot={(index)=>{this.onEditSnapshot(index)}}
onSaveSnapshot={(index)=>{ this.onSaveSnapshot(index); }}
onSelectSnapshot={(index)=>{this.model.selectSnapshot(index);}}
onEditSnapshot={(index) => { this.onEditSnapshot(index) }}
onSaveSnapshot={(index) => { this.onSaveSnapshot(index); }}
onSelectSnapshot={(index) => { this.model.selectSnapshot(index); }}
/>
);
}
handleRemoveSnapshot(snapshotId: number) {
let snapshots = Snapshot.cloneSnapshots(this.state.snapshots);
snapshots[snapshotId] = null;
this.setState({
snapshots: snapshots,
snapshotPropertiesDialogOpen: false,
selectedSnapshot: -1
});
this.model.setSnapshots(snapshots, -1);
this.model.selectSnapshot(-1);
}
handleSnapshotPropertyOk(index: number, name: string, color: string, editing: boolean) {
if (editing) {
@@ -286,6 +295,9 @@ export default class SnapshotPanel extends ResizeResponsiveComponent<SnapshotPan
color={this.state.editColor}
editing={this.state.editing}
snapshotIndex={this.state.editId}
onRemove={(snapshotId) => {
this.handleRemoveSnapshot(snapshotId);
}}
onClose={() => { this.setState({ snapshotPropertiesDialogOpen: false }); }}
onOk={(snapshotId, name, color, editing) => {
this.handleSnapshotPropertyOk(snapshotId, name, color, editing);