mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-09 20:29:36 +02:00
fix double click handler on ItemCard
This commit is contained in:
@@ -126,20 +126,19 @@ const CompactItemCard = ({
|
||||
? internalState.isSelected(internalState.extractRowId(data) || '')
|
||||
: false;
|
||||
|
||||
if (data) {
|
||||
const handleMouseEnter = () => {
|
||||
if (withControls) {
|
||||
setShowControls(true);
|
||||
}
|
||||
};
|
||||
|
||||
const handleMouseLeave = () => {
|
||||
if (withControls) {
|
||||
setShowControls(false);
|
||||
}
|
||||
};
|
||||
|
||||
const handleClick = useDoubleClick({
|
||||
onDoubleClick: (e: React.MouseEvent<HTMLDivElement>) => {
|
||||
if (!data || !controls || !internalState) {
|
||||
return;
|
||||
}
|
||||
|
||||
controls.onDoubleClick?.({
|
||||
event: e,
|
||||
internalState,
|
||||
item: data as any,
|
||||
itemType,
|
||||
});
|
||||
},
|
||||
onSingleClick: (e: React.MouseEvent<HTMLDivElement>) => {
|
||||
if (!data || !controls || !internalState) {
|
||||
return;
|
||||
@@ -162,19 +161,20 @@ const CompactItemCard = ({
|
||||
itemType,
|
||||
});
|
||||
},
|
||||
onDoubleClick: (e: React.MouseEvent<HTMLDivElement>) => {
|
||||
if (!data || !controls || !internalState) {
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
controls.onDoubleClick?.({
|
||||
event: e,
|
||||
internalState,
|
||||
item: data as any,
|
||||
itemType,
|
||||
});
|
||||
},
|
||||
});
|
||||
if (data) {
|
||||
const handleMouseEnter = () => {
|
||||
if (withControls) {
|
||||
setShowControls(true);
|
||||
}
|
||||
};
|
||||
|
||||
const handleMouseLeave = () => {
|
||||
if (withControls) {
|
||||
setShowControls(false);
|
||||
}
|
||||
};
|
||||
|
||||
const handleContextMenu = (e: React.MouseEvent<HTMLDivElement>) => {
|
||||
if (!data || !controls || !internalState) {
|
||||
@@ -259,20 +259,19 @@ const DefaultItemCard = ({
|
||||
? internalState.isSelected(internalState.extractRowId(data) || '')
|
||||
: false;
|
||||
|
||||
if (data) {
|
||||
const handleMouseEnter = () => {
|
||||
if (withControls) {
|
||||
setShowControls(true);
|
||||
}
|
||||
};
|
||||
|
||||
const handleMouseLeave = () => {
|
||||
if (withControls) {
|
||||
setShowControls(false);
|
||||
}
|
||||
};
|
||||
|
||||
const handleClick = useDoubleClick({
|
||||
onDoubleClick: (e: React.MouseEvent<HTMLDivElement>) => {
|
||||
if (!data || !controls || !internalState) {
|
||||
return;
|
||||
}
|
||||
|
||||
controls.onDoubleClick?.({
|
||||
event: e,
|
||||
internalState,
|
||||
item: data as any,
|
||||
itemType,
|
||||
});
|
||||
},
|
||||
onSingleClick: (e: React.MouseEvent<HTMLDivElement>) => {
|
||||
if (!data || !controls || !internalState) {
|
||||
return;
|
||||
@@ -295,19 +294,20 @@ const DefaultItemCard = ({
|
||||
itemType,
|
||||
});
|
||||
},
|
||||
onDoubleClick: (e: React.MouseEvent<HTMLDivElement>) => {
|
||||
if (!data || !controls || !internalState) {
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
controls.onDoubleClick?.({
|
||||
event: e,
|
||||
internalState,
|
||||
item: data as any,
|
||||
itemType,
|
||||
});
|
||||
},
|
||||
});
|
||||
if (data) {
|
||||
const handleMouseEnter = () => {
|
||||
if (withControls) {
|
||||
setShowControls(true);
|
||||
}
|
||||
};
|
||||
|
||||
const handleMouseLeave = () => {
|
||||
if (withControls) {
|
||||
setShowControls(false);
|
||||
}
|
||||
};
|
||||
|
||||
const handleContextMenu = (e: React.MouseEvent<HTMLDivElement>) => {
|
||||
if (!data || !controls || !internalState) {
|
||||
@@ -436,20 +436,19 @@ const PosterItemCard = ({
|
||||
|
||||
const isDragging = data && internalState ? internalState.isDragging(data.id) : isDraggingLocal;
|
||||
|
||||
if (data) {
|
||||
const handleMouseEnter = () => {
|
||||
if (withControls) {
|
||||
setShowControls(true);
|
||||
}
|
||||
};
|
||||
|
||||
const handleMouseLeave = () => {
|
||||
if (withControls) {
|
||||
setShowControls(false);
|
||||
}
|
||||
};
|
||||
|
||||
const handleClick = useDoubleClick({
|
||||
onDoubleClick: (e: React.MouseEvent<HTMLDivElement>) => {
|
||||
if (!data || !controls || !internalState) {
|
||||
return;
|
||||
}
|
||||
|
||||
controls.onDoubleClick?.({
|
||||
event: e,
|
||||
internalState,
|
||||
item: data as any,
|
||||
itemType,
|
||||
});
|
||||
},
|
||||
onSingleClick: (e: React.MouseEvent<HTMLDivElement>) => {
|
||||
if (!data || !controls || !internalState) {
|
||||
return;
|
||||
@@ -472,19 +471,20 @@ const PosterItemCard = ({
|
||||
itemType,
|
||||
});
|
||||
},
|
||||
onDoubleClick: (e: React.MouseEvent<HTMLDivElement>) => {
|
||||
if (!data || !controls || !internalState) {
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
controls.onDoubleClick?.({
|
||||
event: e,
|
||||
internalState,
|
||||
item: data as any,
|
||||
itemType,
|
||||
});
|
||||
},
|
||||
});
|
||||
if (data) {
|
||||
const handleMouseEnter = () => {
|
||||
if (withControls) {
|
||||
setShowControls(true);
|
||||
}
|
||||
};
|
||||
|
||||
const handleMouseLeave = () => {
|
||||
if (withControls) {
|
||||
setShowControls(false);
|
||||
}
|
||||
};
|
||||
|
||||
const handleContextMenu = (e: React.MouseEvent<HTMLDivElement>) => {
|
||||
if (!data || !controls || !internalState) {
|
||||
|
||||
Reference in New Issue
Block a user