mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-28 12:36:35 +00:00
Avoid case where random skin selection would cause webamp to jump when rendred
This commit is contained in:
parent
7808e91d34
commit
d0541b7875
1 changed files with 14 additions and 15 deletions
|
|
@ -39,21 +39,6 @@ class FocusedSkin extends React.Component {
|
|||
}
|
||||
this._webampLoadedEvents = new Subject();
|
||||
this._transitionBeginEvents = new Subject();
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
if (!this.props.centered) {
|
||||
this._disposable.add(
|
||||
timer(0).subscribe(() => {
|
||||
// TODO: Observe DOM and recenter
|
||||
this.setState(this._getCenteredState());
|
||||
this._transitionBeginEvents.next(null);
|
||||
})
|
||||
);
|
||||
} else {
|
||||
this._transitionBeginEvents.next(null);
|
||||
}
|
||||
|
||||
const transitionComplete = this._transitionBeginEvents.pipe(delay(500));
|
||||
|
||||
// Emit after both Webamp has loaded, and the transition is complete
|
||||
|
|
@ -78,6 +63,20 @@ class FocusedSkin extends React.Component {
|
|||
);
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
if (!this.state.centered) {
|
||||
this._disposable.add(
|
||||
timer(0).subscribe(() => {
|
||||
// TODO: Observe DOM and recenter
|
||||
this.setState(this._getCenteredState());
|
||||
this._transitionBeginEvents.next(null);
|
||||
})
|
||||
);
|
||||
} else {
|
||||
this._transitionBeginEvents.next(null);
|
||||
}
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
this._disposable.dispose();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue