Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
External wiki
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
Service Desk
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
minerva
frontend
Merge requests
!200
Resolve "[
MIN-113
] Show comments on the map"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Resolve "[
MIN-113
] Show comments on the map"
67-min-113-show-comments-on-the-map
into
development
Overview
5
Commits
8
Pipelines
3
Changes
2
All threads resolved!
Hide all comments
Merged
Piotr Gawron
requested to merge
67-min-113-show-comments-on-the-map
into
development
10 months ago
Overview
5
Commits
8
Pipelines
3
Changes
2
All threads resolved!
Hide all comments
Expand
Closes
#67 (closed)
0
0
Merge request reports
Viewing commit
9a0b09a4
Prev
Next
Show latest version
2 files
+
66
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
9a0b09a4
comment selector implemented
· 9a0b09a4
Piotr Gawron
authored
10 months ago
src/components/Map/MapViewer/utils/config/commentsLayer/useOlMapCommentsLayer.ts
0 → 100644
+
41
−
0
Options
/* eslint-disable no-magic-numbers */
import
{
usePointToProjection
}
from
'
@/utils/map/usePointToProjection
'
;
import
Feature
from
'
ol/Feature
'
;
import
{
Geometry
}
from
'
ol/geom
'
;
import
VectorLayer
from
'
ol/layer/Vector
'
;
import
VectorSource
from
'
ol/source/Vector
'
;
import
{
useSelector
}
from
'
react-redux
'
;
import
{
allCommentsSelectorOfCurrentMap
}
from
'
@/redux/comment/comment.selectors
'
;
import
{
getCommentsFeatures
}
from
'
@/components/Map/MapViewer/utils/config/commentsLayer/getCommentsFeatures
'
;
import
{
useMemo
}
from
'
react
'
;
export
const
useOlMapCommentsLayer
=
():
VectorLayer
<
VectorSource
<
Feature
<
Geometry
>>>
=>
{
const
pointToProjection
=
usePointToProjection
();
const
comments
=
useSelector
(
allCommentsSelectorOfCurrentMap
);
const
elementsFeatures
=
useMemo
(
()
=>
[
getCommentsFeatures
(
comments
,
{
pointToProjection
,
}),
].
flat
(),
[
comments
,
pointToProjection
],
);
const
vectorSource
=
useMemo
(()
=>
{
return
new
VectorSource
({
features
:
[...
elementsFeatures
],
});
},
[
elementsFeatures
]);
const
pinsLayer
=
useMemo
(
()
=>
new
VectorLayer
({
source
:
vectorSource
,
}),
[
vectorSource
],
);
return
pinsLayer
;
};
Loading