Skip to content
Snippets Groups Projects
Commit 5ab5a710 authored by Glenn Vorhes's avatar Glenn Vorhes
Browse files

add interval

parent 5b85d41e
No related branches found
No related tags found
No related merge requests found
......@@ -7,6 +7,7 @@ export interface iSlider {
change: (d: number) => any;
steps?: number;
animate?: boolean;
defaultAnimationInterval?: number;
value?: number;
}
export declare class Slider extends React.Component<iSlider, null> {
......
......@@ -115,6 +115,10 @@ var Slider = (function (_super) {
var previous = null;
var next = null;
var intervalSelect = null;
var interval = "200";
if (this.props.defaultAnimationInterval) {
interval = this.props.defaultAnimationInterval.toFixed();
}
if (this.props.animate) {
previous = <button id={this.previousUid} className="react-slider-previous" onClick={function () {
_this.increment(-1);
......@@ -129,8 +133,9 @@ var Slider = (function (_super) {
_this.stopAnimate();
}} title="Stop"/>;
intervalSelect = <span>
<label style={{ fontWeight: 'bold', marginRight: '3px' }}>Interval (s)</label>
<select defaultValue="200" id={this.intervalUid} onChange={function () {
<select defaultValue={interval} id={this.intervalUid} onChange={function () {
_this.restartAnimate();
}}>
<option value="100">0.1</option>
......
This diff is collapsed.
......@@ -11,6 +11,7 @@ export interface iSlider {
change: (d: number) => any;
steps?: number;
animate?: boolean;
defaultAnimationInterval?: number;
value?: number;
}
......@@ -141,6 +142,12 @@ export class Slider extends React.Component<iSlider, null> {
let next = null;
let intervalSelect = null;
let interval = "200";
if (this.props.defaultAnimationInterval){
interval = this.props.defaultAnimationInterval.toFixed();
}
if (this.props.animate) {
previous = <button id={this.previousUid} className="react-slider-previous" onClick={() => {
this.increment(-1)
......@@ -159,8 +166,9 @@ export class Slider extends React.Component<iSlider, null> {
}} title="Stop"/>;
intervalSelect = <span>
<label style={{fontWeight: 'bold', marginRight: '3px'}}>Interval (s)</label>
<select defaultValue="200" id={this.intervalUid} onChange={() => {
<select defaultValue={interval} id={this.intervalUid} onChange={() => {
this.restartAnimate()
}}>
<option value="100">0.1</option>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment