|
|
|
@ -1,7 +1,7 @@
|
|
|
|
|
import { Tooltip } from "antd"; |
|
|
|
|
import { useDispatch, useSelector } from "react-redux"; |
|
|
|
|
import { useSelector } from "react-redux"; |
|
|
|
|
import classnames from "classnames"; |
|
|
|
|
import { EditorAction, OverlayNamePrefixs, mapStateSelector } from "@store"; |
|
|
|
|
import { globalController, OverlayNamePrefixs, mapStateSelector } from "@store"; |
|
|
|
|
import { OverlayTypes } from "@types"; |
|
|
|
|
|
|
|
|
|
type IconWithTipProps = { |
|
|
|
@ -36,14 +36,13 @@ type OverlayToolProps = {
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const OverlayTool = (props: OverlayToolProps) => { |
|
|
|
|
const dispatch = useDispatch(); |
|
|
|
|
const { type } = props; |
|
|
|
|
const text = OverlayNamePrefixs[type]; |
|
|
|
|
|
|
|
|
|
const { overlayType } = useSelector(mapStateSelector); |
|
|
|
|
const selected = type === overlayType; |
|
|
|
|
|
|
|
|
|
const onClick = () => dispatch(EditorAction.createOverlay(type)); |
|
|
|
|
const onClick = () => globalController.createOverlay(type); |
|
|
|
|
return <IconWithTip {...{ text, onClick, type, selected }} />; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|