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
561dae77
Commit
561dae77
authored
Jul 14, 2023
by
timel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: remove preload image
parent
3e13bed8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
24 deletions
+0
-24
src/ui/Duel/PlayMat/Card/index.tsx
src/ui/Duel/PlayMat/Card/index.tsx
+0
-2
src/ui/Duel/PlayMat/Card/springs/utils.ts
src/ui/Duel/PlayMat/Card/springs/utils.ts
+0
-22
No files found.
src/ui/Duel/PlayMat/Card/index.tsx
View file @
561dae77
...
...
@@ -32,7 +32,6 @@ import {
type
MoveOptions
,
}
from
"
./springs
"
;
import
type
{
SpringApiProps
}
from
"
./springs/types
"
;
import
{
preloadCardImage
}
from
"
./springs/utils
"
;
const
{
HAND
,
GRAVE
,
REMOVED
,
EXTRA
,
MZONE
,
SZONE
,
TZONE
}
=
ygopro
.
CardZone
;
...
...
@@ -93,7 +92,6 @@ export const Card: React.FC<{ idx: number }> = React.memo(({ idx }) => {
});
register
(
Task
.
Focus
,
async
()
=>
{
await
preloadCardImage
(
card
.
code
);
setClassFocus
(
true
);
setTimeout
(()
=>
setClassFocus
(
false
),
1000
);
await
focus
({
card
,
api
});
...
...
src/ui/Duel/PlayMat/Card/springs/utils.ts
View file @
561dae77
...
...
@@ -11,25 +11,3 @@ export const asyncStart = <T extends {}>(api: SpringRef<T>) => {
});
});
};
// >>> preload image >>>
const
preloadImageSet
=
new
Set
<
string
>
();
export
const
preloadImage
=
(
src
:
string
)
=>
new
Promise
<
void
>
((
resolve
,
reject
)
=>
{
if
(
preloadImageSet
.
has
(
src
))
{
resolve
();
}
else
{
const
image
=
new
Image
();
image
.
onload
=
async
()
=>
{
await
new
Promise
((
r
)
=>
setTimeout
(
r
,
100
));
resolve
();
preloadImageSet
.
add
(
src
);
};
image
.
onerror
=
reject
;
image
.
src
=
src
;
}
});
export
const
preloadCardImage
=
(
code
:
number
)
=>
preloadImage
(
getCardImgUrl
(
code
));
// <<< preload image <<<
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