(snapshot, editIndex)
| 14519 | return this.viewer.deselect(); |
| 14520 | } |
| 14521 | writeSnapshot(snapshot, editIndex) { |
| 14522 | let { selectedSnapshotIndex } = this.state; |
| 14523 | let snapshots; |
| 14524 | if (editIndex >= 0) { |
| 14525 | snapshots = [ |
| 14526 | ...this.state.snapshots |
| 14527 | ]; |
| 14528 | snapshots[editIndex] = snapshot; |
| 14529 | this.setState({ |
| 14530 | snapshots, |
| 14531 | selectedSnapshotIndex |
| 14532 | }); |
| 14533 | } else { |
| 14534 | const note = snapshot.description; |
| 14535 | snapshots = this.state.snapshots.concat(snapshot); |
| 14536 | selectedSnapshotIndex = snapshots.length - 1; |
| 14537 | this.scrollSnapshotIntoView(selectedSnapshotIndex); |
| 14538 | this.setState({ |
| 14539 | sideTabId: (0, _interfaces.SideTabId).Snapshots, |
| 14540 | snapshots, |
| 14541 | selectedSnapshotIndex, |
| 14542 | note |
| 14543 | }); |
| 14544 | } |
| 14545 | this.props.onSnapshotsChanged && this.props.onSnapshotsChanged(snapshots); |
| 14546 | } |
| 14547 | scrollSnapshotIntoView(selectedSnapshotIndex) { |
| 14548 | clearTimeout(this.scrollSnapshotTimer); |
| 14549 | if (this.state.sidebarClosed) return; |
no test coverage detected