Skip to content

Commit

Permalink
Fix game dock popout delay on new versions of Chrome
Browse files Browse the repository at this point in the history
Fixes #2669
  • Loading branch information
anoek committed May 6, 2024
1 parent ef7c6e4 commit f3823b3
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/components/Dock/Dock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,9 @@ export class Dock extends React.Component<DockProperties, DockState> {
}

mouseEntered = () => {
let delay = this.state.dock_delay;
if (delay === MAX_DOCK_DELAY) {
console.log("NO slide out");
delay = 99999;
}
// open dock at speed set by preference 'dock-delay'
const modified_transition = `all 0.1s ease-in ${delay}s`;
const dock = document.getElementsByClassName("Dock")[0] as HTMLElement;
// tested on Opera, Chrome, Safari, Edge, Firefox
dock.style.transition = modified_transition;
dock.style.webkitTransition = modified_transition;
dock.style.transition = this.getTransitionStyle();
dock.style.webkitTransition = this.getTransitionStyle();
};

mouseExited = () => {
Expand All @@ -57,13 +49,23 @@ export class Dock extends React.Component<DockProperties, DockState> {
dock.style.webkitTransition = fast_transition;
};

getTransitionStyle = () => {
let delay = this.state.dock_delay;
if (delay === MAX_DOCK_DELAY) {
delay = 99999;
}
const modified_transition = `all 0.1s ease-in ${delay}s`;
return modified_transition;
};

render() {
return (
<div
onMouseEnter={this.mouseEntered}
onMouseLeave={this.mouseExited}
{...this.props}
className={"Dock" + (this.props.className || "")}
style={{ transition: this.getTransitionStyle() }}
>
{this.props.children}
</div>
Expand Down

0 comments on commit f3823b3

Please sign in to comment.