update doc

This commit is contained in:
hufeixiong
2021-07-13 20:15:38 +08:00
parent 0b6dbb8677
commit 213b776886
6 changed files with 44 additions and 84 deletions

View File

@@ -1,5 +1,5 @@
{
"version": "0.4.1",
"version": "0.4.2",
"license": "MIT",
"main": "dist/index.js",
"module": "dist/dooringx-lib.esm.js",
@@ -44,10 +44,10 @@
"tsdx": "^0.14.1"
},
"dependencies": {
"classnames": "^2.3.1",
"deepcopy": "^2.1.0",
"nanoid": "^3.1.23",
"react-color": "^2.19.3",
"react-sortable-hoc": "^2.0.0",
"uuid": "^8.3.2"
"react-sortable-hoc": "^2.0.0"
}
}

View File

@@ -2,7 +2,7 @@
* @Author: yehuozhili
* @Date: 2021-03-14 04:29:09
* @LastEditors: yehuozhili
* @LastEditTime: 2021-07-12 20:31:47
* @LastEditTime: 2021-07-13 19:57:45
* @FilePath: \dooringx\packages\dooringx-lib\src\core\contextMenu\index.tsx
*/
import { Button } from 'antd';

View File

@@ -145,90 +145,41 @@ export const resizerMouseMove = (e: React.MouseEvent, config: UserConfig) => {
}
};
const directionArr: directionType[] = [
'top',
'topleft',
'left',
'topright',
'bottomleft',
'bottom',
'right',
'bottomright',
];
export function BlockResizer(props: BlockResizerProps) {
const render = useMemo(() => {
if (props.data.focus && props.data.resize) {
return (
<>
<div
className={classnames(styles.resizepoint, styles.top)}
onMouseDown={(e) => {
onMouseDown(e, 'top', props.data, props.rect, props.config);
}}
onMouseUp={() => {
resizerMouseUp(props.config);
}}
></div>
<div
className={classnames(styles.resizepoint, styles.topleft)}
onMouseDown={(e) => {
onMouseDown(e, 'topleft', props.data, props.rect, props.config);
}}
onMouseUp={() => {
resizerMouseUp(props.config);
}}
></div>
<div
className={classnames(styles.resizepoint, styles.left)}
onMouseDown={(e) => {
onMouseDown(e, 'left', props.data, props.rect, props.config);
}}
onMouseUp={() => {
resizerMouseUp(props.config);
}}
></div>
<div
className={classnames(styles.resizepoint, styles.topright)}
onMouseDown={(e) => {
onMouseDown(e, 'topright', props.data, props.rect, props.config);
}}
onMouseUp={() => {
resizerMouseUp(props.config);
}}
></div>
<div
className={classnames(styles.resizepoint, styles.bottomleft)}
onMouseDown={(e) => {
onMouseDown(e, 'bottomleft', props.data, props.rect, props.config);
}}
onMouseUp={() => {
resizerMouseUp(props.config);
}}
></div>
<div
className={classnames(styles.resizepoint, styles.bottom)}
onMouseDown={(e) => {
onMouseDown(e, 'bottom', props.data, props.rect, props.config);
}}
onMouseUp={() => {
resizerMouseUp(props.config);
}}
></div>
<div
className={classnames(styles.resizepoint, styles.right)}
onMouseDown={(e) => {
onMouseDown(e, 'right', props.data, props.rect, props.config);
}}
onMouseUp={() => {
resizerMouseUp(props.config);
}}
></div>
<div
className={classnames(styles.resizepoint, styles.bottomright)}
onMouseDown={(e) => {
onMouseDown(e, 'bottomright', props.data, props.rect, props.config);
}}
onMouseUp={() => {
resizerMouseUp(props.config);
}}
></div>
{directionArr.map((v) => {
return (
<div
className={classnames(styles.resizepoint, styles[v])}
onMouseDown={(e) => {
onMouseDown(e, v, props.data, props.rect, props.config);
}}
onMouseUp={() => {
resizerMouseUp(props.config);
}}
></div>
);
})}
</>
);
} else {
return null;
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [props.data.focus, props.data.resize]);
}, [props.config, props.data, props.rect]);
return <>{render}</>;
}