Fix diagram mouse event handlers
This commit is contained in:
@@ -40,21 +40,12 @@ const style = (theme: Theme) => {
|
|||||||
|
|
||||||
function ChartIcon(props: { classes: any, literal: JsonPropertyLocation, showDiagram: (dotPath: string, target: EventTarget) => void, hideDiagram: () => void }) {
|
function ChartIcon(props: { classes: any, literal: JsonPropertyLocation, showDiagram: (dotPath: string, target: EventTarget) => void, hideDiagram: () => void }) {
|
||||||
const mouseOver = (event: React.MouseEvent<Element>) => {
|
const mouseOver = (event: React.MouseEvent<Element>) => {
|
||||||
event.stopPropagation()
|
|
||||||
event.preventDefault()
|
|
||||||
if ((event.target as Element).tagName !== 'path') {
|
|
||||||
props.showDiagram(props.literal.path, event.target)
|
props.showDiagram(props.literal.path, event.target)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
const mouseOut = (event: React.MouseEvent) => {
|
const mouseOut = (event: React.MouseEvent) => {
|
||||||
event.stopPropagation()
|
|
||||||
event.preventDefault()
|
|
||||||
|
|
||||||
if ((event.target as Element).tagName !== 'path') {
|
|
||||||
props.hideDiagram()
|
props.hideDiagram()
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ShowChart className={props.classes.icon} onMouseEnter={mouseOver} onMouseLeave={mouseOut} />
|
<ShowChart className={props.classes.icon} onMouseEnter={mouseOver} onMouseLeave={mouseOut} />
|
||||||
|
|||||||
Reference in New Issue
Block a user