fix: block click happening while moving (#2275)

This commit is contained in:
Aaryan Khandelwal 2023-09-27 13:08:35 +05:30 committed by GitHub
parent 2d8cbccfbc
commit 5298f1e53c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -179,11 +179,6 @@ export const ChartDraggable: React.FC<Props> = ({
if (e.button !== 0) return; if (e.button !== 0) return;
e.preventDefault();
e.stopPropagation();
setIsMoving(true);
const resizableDiv = resizableRef.current; const resizableDiv = resizableRef.current;
const columnWidth = currentViewData.data.width; const columnWidth = currentViewData.data.width;
@ -193,6 +188,8 @@ export const ChartDraggable: React.FC<Props> = ({
let initialMarginLeft = parseInt(resizableDiv.style.marginLeft); let initialMarginLeft = parseInt(resizableDiv.style.marginLeft);
const handleMouseMove = (e: MouseEvent) => { const handleMouseMove = (e: MouseEvent) => {
setIsMoving(true);
let delWidth = 0; let delWidth = 0;
delWidth = checkScrollEnd(e); delWidth = checkScrollEnd(e);
@ -295,7 +292,9 @@ export const ChartDraggable: React.FC<Props> = ({
</> </>
)} )}
<div <div
className="relative z-[2] rounded h-8 w-full flex items-center" className={`relative z-[2] rounded h-8 w-full flex items-center ${
isMoving ? "pointer-events-none" : ""
}`}
onMouseDown={handleBlockMove} onMouseDown={handleBlockMove}
> >
<BlockRender data={block.data} /> <BlockRender data={block.data} />