Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ehasa-frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
WIMMA Lab 2019
Overflow
ehasa-frontend
Commits
54c86593
Commit
54c86593
authored
5 years ago
by
Ronnie Friman
Browse files
Options
Downloads
Patches
Plain Diff
shows icons based on group class
parent
f044b110
No related branches found
Branches containing commit
No related tags found
2 merge requests
!46
Development to testing
,
!33
Game replay
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/components/ReplayMap.js
+9
-6
9 additions, 6 deletions
src/components/ReplayMap.js
src/track-playback/src/leaflet.trackplayback/draw.js
+27
-21
27 additions, 21 deletions
src/track-playback/src/leaflet.trackplayback/draw.js
with
36 additions
and
27 deletions
src/components/ReplayMap.js
+
9
−
6
View file @
54c86593
...
@@ -27,20 +27,22 @@ export default class ReplayMap extends React.Component {
...
@@ -27,20 +27,22 @@ export default class ReplayMap extends React.Component {
async
componentDidMount
()
{
async
componentDidMount
()
{
await
this
.
fetchPlayerData
();
await
this
.
fetchPlayerData
();
await
this
.
fetchDrawingData
();
//
await this.fetchDrawingData();
this
.
tickDrawings
();
//
this.tickDrawings();
this
.
replay
();
this
.
replay
();
}
}
componentWillReceiveProps
(
nextProps
)
{}
componentWillReceiveProps
(
nextProps
)
{}
// cloud game a1231e2b-aa29-494d-b687-ea2d48cc23df
// cloud game a1231e2b-aa29-494d-b687-ea2d48cc23df
// local game wimma 15e9563b-e621-4ba1-a440-1b21c7774923
// local game vbox 16977b13-c419-48b4-b7d6-e7620f27bf39
// fetch player locations from the game
// fetch player locations from the game
fetchPlayerData
=
async
()
=>
{
fetchPlayerData
=
async
()
=>
{
await
fetch
(
await
fetch
(
`
${
`
${
process
.
env
.
REACT_APP_API_URL
process
.
env
.
REACT_APP_API_URL
}
/replay/players/1
5e9563b-e621-4ba1-a440-1b21c7774923
`
,
}
/replay/players/1
6977b13-c419-48b4-b7d6-e7620f27bf39
`
,
{
{
method
:
"
GET
"
method
:
"
GET
"
}
}
...
@@ -61,9 +63,10 @@ export default class ReplayMap extends React.Component {
...
@@ -61,9 +63,10 @@ export default class ReplayMap extends React.Component {
fetchDrawingData
=
async
()
=>
{
fetchDrawingData
=
async
()
=>
{
await
fetch
(
await
fetch
(
`
${
`
${
process
.
env
.
REACT_APP_API_URL
}
/replay/{
process
.
env
.
REACT_APP_API_URL
"lng": 25.72588,
}
/replay/a1231e2b-aa29-494d-b687-ea2d48cc23df`
,
"lat": 62.23147
}`
,
{
{
method
:
"
GET
"
method
:
"
GET
"
}
}
...
...
This diff is collapsed.
Click to expand it.
src/track-playback/src/leaflet.trackplayback/draw.js
+
27
−
21
View file @
54c86593
...
@@ -67,23 +67,15 @@ export const Draw = L.Class.extend({
...
@@ -67,23 +67,15 @@ export const Draw = L.Class.extend({
// 目标如果使用图片,先加载图片
// 目标如果使用图片,先加载图片
if
(
this
.
targetOptions
.
useImg
)
{
if
(
this
.
targetOptions
.
useImg
)
{
let
img
=
new
Image
();
/* let img2 = new Image();
let
img2
=
new
Image
();
img2.onload = () => {
img2
.
onload
=
()
=>
{
this._targetImg2 = img2;
this
.
_targetImg2
=
img2
;
};
};
img2.onerror = () => {
img2
.
onerror
=
()
=>
{
throw new Error("img load error!");
throw
new
Error
(
"
img load error!
"
);
};
};
img2.src = this.targetOptions.imgUrl; */
img2
.
src
=
this
.
targetOptions
.
imgUrl
;
this
.
_targetImg
=
[];
img
.
onload
=
()
=>
{
this
.
_targetImg
=
img
;
};
img
.
onerror
=
()
=>
{
throw
new
Error
(
"
img load error!
"
);
};
img
.
src
=
this
.
targetOptions
.
imgUrl
;
}
}
},
},
...
@@ -312,11 +304,25 @@ export const Draw = L.Class.extend({
...
@@ -312,11 +304,25 @@ export const Draw = L.Class.extend({
};
};
this
.
_ctx
.
save
();
this
.
_ctx
.
save
();
this
.
_ctx
.
translate
(
point
.
x
,
point
.
y
);
this
.
_ctx
.
translate
(
point
.
x
,
point
.
y
);
let
image
;
this
.
_targetImg
.
map
(
img
=>
{
if
(
img
.
icon
==
info
[
0
][
"
value
"
])
{
image
=
img
;
}
});
if
(
!
image
)
{
let
img
=
new
Image
();
img
.
onload
=
()
=>
{
this
.
_targetImg
.
push
(
img
);
};
img
.
onerror
=
()
=>
{
throw
new
Error
(
"
img load error!
"
);
};
img
.
src
=
info
[
0
][
"
value
"
];
img
.
icon
=
info
[
0
][
"
value
"
];
image
=
img
;
}
//let svg = document.createElementNS(`../${info[0]["value"]}`, "svg"); //http://www.sclance.com/pngs/random-png/random_png_1136179.png
//let svg = document.createElementNS(`../${info[0]["value"]}`, "svg"); //http://www.sclance.com/pngs/random-png/random_png_1136179.png
let
image
=
info
[
0
][
"
value
"
]
===
"
infantry.svg
"
?
this
.
_targetImg
:
this
.
_targetImg2
;
image
.
src
=
`../
${
info
[
0
][
"
value
"
]}
`
;
this
.
_ctx
.
drawImage
(
image
,
0
-
offset
.
x
,
0
-
offset
.
y
,
width
,
height
);
this
.
_ctx
.
drawImage
(
image
,
0
-
offset
.
x
,
0
-
offset
.
y
,
width
,
height
);
this
.
_ctx
.
restore
();
this
.
_ctx
.
restore
();
},
},
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment