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
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
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
MyCard
Neos
Commits
091aa5e0
Commit
091aa5e0
authored
Feb 22, 2024
by
Chunchi Che
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feat/double-click-add-card' into 'main'
为组卡页实现双击添加卡片的功能 See merge request
mycard/Neos!340
parents
b37889a4
6df7abd5
Pipeline
#25511
passed with stages
in 13 minutes and 24 seconds
Changes
3
Pipelines
1
Hide 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 @
091aa5e0
...
@@ -3,6 +3,7 @@ import {
...
@@ -3,6 +3,7 @@ import {
DeleteOutlined
,
DeleteOutlined
,
EditOutlined
,
EditOutlined
,
FilterOutlined
,
FilterOutlined
,
QuestionCircleOutlined
,
RetweetOutlined
,
RetweetOutlined
,
SearchOutlined
,
SearchOutlined
,
SortAscendingOutlined
,
SortAscendingOutlined
,
...
@@ -18,6 +19,7 @@ import {
...
@@ -18,6 +19,7 @@ import {
message
,
message
,
Pagination
,
Pagination
,
Space
,
Space
,
Tooltip
,
}
from
"
antd
"
;
}
from
"
antd
"
;
import
{
isEqual
}
from
"
lodash-es
"
;
import
{
isEqual
}
from
"
lodash-es
"
;
import
{
type
OverlayScrollbarsComponentRef
}
from
"
overlayscrollbars-react
"
;
import
{
type
OverlayScrollbarsComponentRef
}
from
"
overlayscrollbars-react
"
;
...
@@ -290,6 +292,9 @@ export const DeckEditor: React.FC<{
...
@@ -290,6 +292,9 @@ export const DeckEditor: React.FC<{
>
>
保存
保存
</
Button
>
</
Button
>
<
Tooltip
title=
"双击添加卡片,单击右键删除卡片,按下滑轮在主卡组和副卡组之间切换卡片"
>
<
QuestionCircleOutlined
/>
</
Tooltip
>
</
Space
>
</
Space
>
</
Space
>
</
Space
>
<
ScrollableArea
className=
{
styles
[
"
deck-zone
"
]
}
>
<
ScrollableArea
className=
{
styles
[
"
deck-zone
"
]
}
>
...
@@ -306,6 +311,11 @@ export const DeckEditor: React.FC<{
...
@@ -306,6 +311,11 @@ export const DeckEditor: React.FC<{
}
}
}
}
}
}
onElementMouseUp=
{
(
event
)
=>
handleMouseUp
(
type
,
event
)
}
onElementMouseUp=
{
(
event
)
=>
handleMouseUp
(
type
,
event
)
}
onDoubleClick=
{
(
card
)
=>
{
if
(
editDeckStore
.
canAdd
(
card
,
type
,
"
search
"
).
result
)
{
editDeckStore
.
add
(
type
,
card
);
}
}
}
/>
/>
))
}
))
}
</
ScrollableArea
>
</
ScrollableArea
>
...
...
src/ui/Shared/DeckCard/index.tsx
View file @
091aa5e0
...
@@ -21,7 +21,8 @@ export const DeckCard: React.FC<{
...
@@ -21,7 +21,8 @@ export const DeckCard: React.FC<{
source
:
Type
|
"
search
"
;
source
:
Type
|
"
search
"
;
onMouseUp
?:
(
event
:
DeckCardMouseUpEvent
)
=>
void
;
onMouseUp
?:
(
event
:
DeckCardMouseUpEvent
)
=>
void
;
onMouseEnter
?:
()
=>
void
;
onMouseEnter
?:
()
=>
void
;
}
>
=
memo
(({
value
,
source
,
onMouseUp
,
onMouseEnter
})
=>
{
onDoubleClick
?:
(
card
:
CardMeta
)
=>
void
;
}
>
=
memo
(({
value
,
source
,
onMouseUp
,
onMouseEnter
,
onDoubleClick
})
=>
{
const
ref
=
useRef
<
HTMLDivElement
>
(
null
);
const
ref
=
useRef
<
HTMLDivElement
>
(
null
);
const
[{
isDragging
},
drag
]
=
useDrag
({
const
[{
isDragging
},
drag
]
=
useDrag
({
type
:
"
Card
"
,
type
:
"
Card
"
,
...
@@ -46,6 +47,7 @@ export const DeckCard: React.FC<{
...
@@ -46,6 +47,7 @@ export const DeckCard: React.FC<{
})
})
}
}
onMouseEnter=
{
onMouseEnter
}
onMouseEnter=
{
onMouseEnter
}
onDoubleClick=
{
()
=>
onDoubleClick
?.(
value
)
}
onContextMenu=
{
(
e
)
=>
{
onContextMenu=
{
(
e
)
=>
{
e
.
preventDefault
();
e
.
preventDefault
();
}
}
}
}
...
...
src/ui/Shared/DeckZone/index.tsx
View file @
091aa5e0
...
@@ -25,12 +25,14 @@ export const DeckZone: React.FC<{
...
@@ -25,12 +25,14 @@ export const DeckZone: React.FC<{
destination
:
Type
,
destination
:
Type
,
)
=>
void
;
)
=>
void
;
onElementMouseUp
:
(
event
:
DeckCardMouseUpEvent
)
=>
void
;
onElementMouseUp
:
(
event
:
DeckCardMouseUpEvent
)
=>
void
;
onDoubleClick
?:
(
card
:
CardMeta
)
=>
void
;
}
>
=
({
}
>
=
({
type
,
type
,
cards
,
cards
,
canAdd
,
canAdd
,
onChange
,
onChange
,
onElementMouseUp
:
onElementMouseUp
,
onElementMouseUp
:
onElementMouseUp
,
onDoubleClick
,
})
=>
{
})
=>
{
const
{
message
}
=
App
.
useApp
();
const
{
message
}
=
App
.
useApp
();
const
[
allowToDrop
,
setAllowToDrop
]
=
useState
(
false
);
const
[
allowToDrop
,
setAllowToDrop
]
=
useState
(
false
);
...
@@ -71,6 +73,7 @@ export const DeckZone: React.FC<{
...
@@ -71,6 +73,7 @@ export const DeckZone: React.FC<{
key=
{
card
.
id
+
i
+
type
}
key=
{
card
.
id
+
i
+
type
}
source=
{
type
}
source=
{
type
}
onMouseUp=
{
onElementMouseUp
}
onMouseUp=
{
onElementMouseUp
}
onDoubleClick=
{
onDoubleClick
}
/>
/>
))
}
))
}
<
div
className=
{
styles
[
"
editing-zone-name
"
]
}
>
<
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