Commit 0fd21f69 authored by Chunchi Che's avatar Chunchi Che

add onDoubleClick

parent b37889a4
Pipeline #25509 passed with stages
in 15 minutes and 11 seconds
......@@ -306,6 +306,11 @@ export const DeckEditor: React.FC<{
}
}}
onElementMouseUp={(event) => handleMouseUp(type, event)}
onDoubleClick={(card) => {
if (editDeckStore.canAdd(card, type, "search").result) {
editDeckStore.add(type, card);
}
}}
/>
))}
</ScrollableArea>
......
......@@ -21,7 +21,8 @@ export const DeckCard: React.FC<{
source: Type | "search";
onMouseUp?: (event: DeckCardMouseUpEvent) => void;
onMouseEnter?: () => void;
}> = memo(({ value, source, onMouseUp, onMouseEnter }) => {
onDoubleClick?: (card: CardMeta) => void;
}> = memo(({ value, source, onMouseUp, onMouseEnter, onDoubleClick }) => {
const ref = useRef<HTMLDivElement>(null);
const [{ isDragging }, drag] = useDrag({
type: "Card",
......@@ -46,6 +47,7 @@ export const DeckCard: React.FC<{
})
}
onMouseEnter={onMouseEnter}
onDoubleClick={() => onDoubleClick?.(value)}
onContextMenu={(e) => {
e.preventDefault();
}}
......
......@@ -25,12 +25,14 @@ export const DeckZone: React.FC<{
destination: Type,
) => void;
onElementMouseUp: (event: DeckCardMouseUpEvent) => void;
onDoubleClick?: (card: CardMeta) => void;
}> = ({
type,
cards,
canAdd,
onChange,
onElementMouseUp: onElementMouseUp,
onDoubleClick,
}) => {
const { message } = App.useApp();
const [allowToDrop, setAllowToDrop] = useState(false);
......@@ -71,6 +73,7 @@ export const DeckZone: React.FC<{
key={card.id + i + type}
source={type}
onMouseUp={onElementMouseUp}
onDoubleClick={onDoubleClick}
/>
))}
<div className={styles["editing-zone-name"]}>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment