Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
N
Neos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
love_飞影
Neos
Commits
6df7abd5
Commit
6df7abd5
authored
Feb 22, 2024
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
为组卡页实现双击添加卡片的功能
parent
b37889a4
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
1 deletion
+16
-1
src/ui/BuildDeck/index.tsx
src/ui/BuildDeck/index.tsx
+10
-0
src/ui/Shared/DeckCard/index.tsx
src/ui/Shared/DeckCard/index.tsx
+3
-1
src/ui/Shared/DeckZone/index.tsx
src/ui/Shared/DeckZone/index.tsx
+3
-0
No files found.
src/ui/BuildDeck/index.tsx
View file @
6df7abd5
...
...
@@ -3,6 +3,7 @@ import {
DeleteOutlined
,
EditOutlined
,
FilterOutlined
,
QuestionCircleOutlined
,
RetweetOutlined
,
SearchOutlined
,
SortAscendingOutlined
,
...
...
@@ -18,6 +19,7 @@ import {
message
,
Pagination
,
Space
,
Tooltip
,
}
from
"
antd
"
;
import
{
isEqual
}
from
"
lodash-es
"
;
import
{
type
OverlayScrollbarsComponentRef
}
from
"
overlayscrollbars-react
"
;
...
...
@@ -290,6 +292,9 @@ export const DeckEditor: React.FC<{
>
保存
</
Button
>
<
Tooltip
title=
"双击添加卡片,单击右键删除卡片,按下滑轮在主卡组和副卡组之间切换卡片"
>
<
QuestionCircleOutlined
/>
</
Tooltip
>
</
Space
>
</
Space
>
<
ScrollableArea
className=
{
styles
[
"
deck-zone
"
]
}
>
...
...
@@ -306,6 +311,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
>
...
...
src/ui/Shared/DeckCard/index.tsx
View file @
6df7abd5
...
...
@@ -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
();
}
}
...
...
src/ui/Shared/DeckZone/index.tsx
View file @
6df7abd5
...
...
@@ -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
"
]
}
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment