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
Commits
2f8b7c22
Commit
2f8b7c22
authored
3 months ago
by
Miłosz Grocholewski
Browse files
Options
Downloads
Patches
Plain Diff
feat(vector-map): restore old map extent
parent
dda6fcaa
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!349
feat(vector-map): split getStyle function into separate smaller functions
,
!348
feat(vector-map): restore old map extent
Pipeline
#99326
passed
3 months ago
Stage: lint
Stage: prettier
Stage: test
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/components/Map/MapViewer/utils/config/useOlMapView.ts
+10
-19
10 additions, 19 deletions
src/components/Map/MapViewer/utils/config/useOlMapView.ts
src/constants/map.ts
+0
-1
0 additions, 1 deletion
src/constants/map.ts
with
10 additions
and
20 deletions
src/components/Map/MapViewer/utils/config/useOlMapView.ts
+
10
−
19
View file @
2f8b7c22
/* eslint-disable no-magic-numbers */
/* eslint-disable no-magic-numbers */
import
{
DEFAULT_
EXTENT_PADDING
,
OPTIONS
,
ZOOM_RESCALING_FACTOR
}
from
'
@/constants/map
'
;
import
{
EXTENT_PADDING
_MULTIPLICATOR
,
OPTIONS
,
ZOOM_RESCALING_FACTOR
}
from
'
@/constants/map
'
;
import
{
mapDataInitialPositionSelector
,
mapDataSizeSelector
}
from
'
@/redux/map/map.selectors
'
;
import
{
mapDataInitialPositionSelector
,
mapDataSizeSelector
}
from
'
@/redux/map/map.selectors
'
;
import
{
MapInstance
,
Point
}
from
'
@/types/map
'
;
import
{
MapInstance
,
Point
}
from
'
@/types/map
'
;
import
{
usePointToProjection
}
from
'
@/utils/map/usePointToProjection
'
;
import
{
usePointToProjection
}
from
'
@/utils/map/usePointToProjection
'
;
...
@@ -19,32 +19,23 @@ export const useOlMapView = ({ mapInstance }: UseOlMapViewInput): MapConfig['vie
...
@@ -19,32 +19,23 @@ export const useOlMapView = ({ mapInstance }: UseOlMapViewInput): MapConfig['vie
const
pointToProjection
=
usePointToProjection
();
const
pointToProjection
=
usePointToProjection
();
const
extent
=
useMemo
(():
Extent
=>
{
const
extent
=
useMemo
(():
Extent
=>
{
let
widthPadding
=
0
;
const
extentPadding
=
{
let
heightPadding
=
0
;
horizontal
:
mapSize
.
width
*
EXTENT_PADDING_MULTIPLICATOR
,
let
mapInstanceWidthToHeightRatio
=
2.15
;
vertical
:
mapSize
.
height
*
EXTENT_PADDING_MULTIPLICATOR
,
const
mapInstanceSize
=
mapInstance
?.
getSize
();
};
if
(
mapInstanceSize
)
{
mapInstanceWidthToHeightRatio
=
mapInstanceSize
[
0
]
/
mapInstanceSize
[
1
];
}
const
mapWidthToHeightRatio
=
mapSize
.
width
/
mapSize
.
height
;
if
(
mapWidthToHeightRatio
<
mapInstanceWidthToHeightRatio
)
{
widthPadding
=
mapSize
.
height
*
mapInstanceWidthToHeightRatio
-
mapSize
.
width
;
}
else
{
heightPadding
=
mapSize
.
width
/
mapInstanceWidthToHeightRatio
-
mapSize
.
height
;
}
const
topLeftPoint
:
Point
=
{
const
topLeftPoint
:
Point
=
{
x
:
mapSize
.
width
+
width
Padding
/
2
+
DEFAULT_EXTENT_PADDING
,
x
:
mapSize
.
width
+
extent
Padding
.
horizontal
,
y
:
mapSize
.
height
+
heigh
tPadding
/
2
+
DEFAULT_EXTENT_PADDING
,
y
:
mapSize
.
height
+
exten
tPadding
.
vertical
,
};
};
const
bottomRightPoint
:
Point
=
{
const
bottomRightPoint
:
Point
=
{
x
:
-
width
Padding
/
2
-
DEFAULT_EXTENT_PADDING
,
x
:
-
extent
Padding
.
horizontal
,
y
:
-
heigh
tPadding
/
2
-
DEFAULT_EXTENT_PADDING
,
y
:
-
exten
tPadding
.
vertical
,
};
};
return
boundingExtent
([
topLeftPoint
,
bottomRightPoint
].
map
(
pointToProjection
));
return
boundingExtent
([
topLeftPoint
,
bottomRightPoint
].
map
(
pointToProjection
));
},
[
mapSize
.
width
,
mapSize
.
height
,
mapInstance
,
pointToProjection
]);
},
[
pointToProjection
,
mapSize
]);
const
center
=
useMemo
(():
Point
=>
{
const
center
=
useMemo
(():
Point
=>
{
const
centerPoint
:
Point
=
{
const
centerPoint
:
Point
=
{
...
...
This diff is collapsed.
Click to expand it.
src/constants/map.ts
+
0
−
1
View file @
2f8b7c22
...
@@ -11,7 +11,6 @@ export const DEFAULT_CENTER_Y = 0;
...
@@ -11,7 +11,6 @@ export const DEFAULT_CENTER_Y = 0;
// eslint-disable-next-line no-magic-numbers
// eslint-disable-next-line no-magic-numbers
export
const
LATLNG_FALLBACK
:
LatLng
=
[
0
,
0
];
export
const
LATLNG_FALLBACK
:
LatLng
=
[
0
,
0
];
export
const
EXTENT_PADDING_MULTIPLICATOR
=
1
;
export
const
EXTENT_PADDING_MULTIPLICATOR
=
1
;
export
const
DEFAULT_EXTENT_PADDING
=
20
;
export
const
ZOOM_RESCALING_FACTOR
=
1
;
export
const
ZOOM_RESCALING_FACTOR
=
1
;
export
const
DEFAULT_CENTER_POINT
:
Point
=
{
export
const
DEFAULT_CENTER_POINT
:
Point
=
{
...
...
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