Fix pause icon alignment

This commit is contained in:
Thomas Nordquist
2019-04-10 13:59:57 +02:00
parent c7b0400e84
commit ab8365b1f7
2 changed files with 10 additions and 5 deletions

View File

@@ -58,13 +58,13 @@ class Demo extends React.Component<{classes: any}, State> {
return null return null
} }
const style = { const cursorStyle = {
left: this.state.position.x + 2, left: this.state.position.x + 2,
top: this.state.position.y + 2, top: this.state.position.y + 2,
} }
return ( return (
<img src="../cursor.png" style={style} className={this.props.classes.cursor} /> <img src="../cursor.png" style={cursorStyle} className={this.props.classes.cursor} />
) )
} }
} }
@@ -76,7 +76,7 @@ const style = (theme: Theme) => ({
position: 'fixed' as 'fixed', position: 'fixed' as 'fixed',
zIndex: 1000000, zIndex: 1000000,
filter: theme.palette.type === 'light' ? undefined : 'invert(100%)', filter: theme.palette.type === 'light' ? undefined : 'invert(100%)',
} },
}) })
export default withStyles(style)(Demo) export default withStyles(style)(Demo)

View File

@@ -10,7 +10,12 @@ import { treeActions } from '../../actions'
import { StyleRulesCallback, withStyles } from '@material-ui/core/styles' import { StyleRulesCallback, withStyles } from '@material-ui/core/styles'
import { Tooltip } from '@material-ui/core' import { Tooltip } from '@material-ui/core'
const styles: StyleRulesCallback = theme => ({ }) const styles: StyleRulesCallback = theme => ({
icon: {
color: theme.palette.primary.contrastText,
verticalAlign: 'middle' as 'middle',
},
})
interface Props { interface Props {
classes: any classes: any
@@ -66,7 +71,7 @@ class PauseButton extends React.Component<Props, {changes: number}> {
<CustomIconButton onClick={this.props.actions.tree.togglePause} > <CustomIconButton onClick={this.props.actions.tree.togglePause} >
<Tooltip title={message}> <Tooltip title={message}>
<div /* Required so tooltip does not loose the anchor when the icon changes */> <div /* Required so tooltip does not loose the anchor when the icon changes */>
{this.props.paused ? <Resume /> : <Pause />} {this.props.paused ? <Resume className={this.props.classes.icon} /> : <Pause className={this.props.classes.icon} />}
</div> </div>
</Tooltip> </Tooltip>
</CustomIconButton> </CustomIconButton>