Bind slider handel function

This commit is contained in:
MrKBear 2022-05-01 13:03:49 +08:00
parent a0547095e2
commit 53ae625c92
4 changed files with 43 additions and 3 deletions

View File

@ -30,7 +30,7 @@ div.recorder-root {
span.ms-Slider-inactive {
height: 3px;
animation: none;
transition: none;
}
}

View File

@ -14,6 +14,7 @@ interface IRecorderProps {
allTime?: number;
currentTime?: number;
action?: () => void;
valueChange?: (value: number) => any;
}
class Recorder extends Component<IRecorderProps> {
@ -85,19 +86,38 @@ class Recorder extends Component<IRecorderProps> {
max={this.props.allFrame}
className={"recorder-slider" + (isSliderDisable ? " disable" : "")}
showValue={false}
onChange={(value) => {
if (this.props.valueChange && !isSliderDisable) {
this.props.valueChange(value);
}
}}
/>
<div className="recorder-content">
<div className="time-view">
{this.getRecordInfo()}
</div>
<div className="ctrl-button">
<div className={"ctrl-action" + (isJumpDisable ? " disable" : "")}>
<div
className={"ctrl-action" + (isJumpDisable ? " disable" : "")}
onClick={() => {
if (this.props.valueChange && !isJumpDisable && this.props.currentFrame !== undefined) {
this.props.valueChange(this.props.currentFrame - 1);
}
}}
>
<Icon iconName="Back"/>
</div>
<div className="ctrl-action ctrl-action-main" onClick={this.props.action}>
<Icon iconName={this.getActionIcon()}/>
</div>
<div className={"ctrl-action" + (isJumpDisable ? " disable" : "")}>
<div
className={"ctrl-action" + (isJumpDisable ? " disable" : "")}
onClick={() => {
if (this.props.valueChange && !isJumpDisable && this.props.currentFrame !== undefined) {
this.props.valueChange(this.props.currentFrame + 1);
}
}}
>
<Icon iconName="Forward"/>
</div>
</div>

View File

@ -217,6 +217,23 @@ class Actuator extends Emitter<IActuatorEvent> {
private playTickerTimer?: number;
/**
*
*/
public setPlayProcess(id: number) {
if (this.playClip && id >= 0 && id < this.playClip.frames.length) {
// 跳转值这帧
this.playFrameId = id;
this.playFrame = this.playClip.frames[this.playFrameId];
this.emit("record", this.playFrame.duration);
if (this.mod !== ActuatorModel.Play) {
this.playClip.play(this.playFrame);
}
}
}
/**
*
*/

View File

@ -93,6 +93,9 @@ class ClipRecorder extends Component<IMixinStatusProps> {
console.log("ClipRecorder: Pause start...");
}
}}
valueChange={(value) => {
this.props.status?.actuator.setPlayProcess(value);
}}
/>
}
}