Skip to content

Commit

Permalink
Hook it up so you can edit hte frame index value. Part of #10.
Browse files Browse the repository at this point in the history
  • Loading branch information
jkomoros committed Nov 15, 2021
1 parent 936c219 commit 6a99c8d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/components/simulation-controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import {
selectFrameIndex,
} from "../selectors.js";

import {
updateFrameIndex
} from '../actions/data.js';

// These are the shared styles needed by this element.
import { SharedStyles } from "./shared-styles.js";

Expand All @@ -30,7 +34,7 @@ class SimulationControls extends connect(store)(LitElement) {
return html`
<div class='container'>
<label for='frameIndex'>Frame</label>
<input id='frameIndex' .value=${this._frameIndex}>
<input id='frameIndex' .value=${this._frameIndex} type='number' min='0' @change=${this._handleFrameIndexChanged}>
</div>
`;
}
Expand All @@ -39,6 +43,11 @@ class SimulationControls extends connect(store)(LitElement) {
stateChanged(state) {
this._frameIndex = selectFrameIndex(state);
}

_handleFrameIndexChanged(e) {
const ele = e.composedPath()[0];
store.dispatch(updateFrameIndex(ele.value));
}
}

window.customElements.define("simulation-controls", SimulationControls);

0 comments on commit 6a99c8d

Please sign in to comment.