Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SRCT
whats-open-web
Commits
fb893ca0
Commit
fb893ca0
authored
Sep 17, 2018
by
Mattias J Duffy
Browse files
more map performance improvements
parent
c650e27f
Pipeline
#2897
passed with stages
in 1 minute and 42 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
src/components/FacilitiesMap.js
View file @
fb893ca0
...
...
@@ -42,12 +42,17 @@ class FacilitiesMap extends React.Component {
this
.
state
=
{
maxBounds
:
getMaxBounds
(
campusRegion
),
campusRegion
:
campusRegion
,
center
:
facilityLocationExists
?
facility
.
facility_location
.
coordinate_location
.
coordinates
:
getCenterOfCampusRegion
(
campusRegion
),
zoom
:
facilityLocationExists
?
[
17
]
:
[
0
],
zoom
:
[
17
],
fitBoundsOptions
:
{},
facilityLocations
:
[],
selectedLocation
:
null
selectedLocation
:
null
,
isLoaded
:
false
};
setTimeout
(()
=>
{
this
.
setState
({
center
:
facilityLocationExists
?
facility
.
facility_location
.
coordinate_location
.
coordinates
:
getCenterOfCampusRegion
(
campusRegion
)
});
},
500
);
}
componentWillReceiveProps
(
nextProps
)
{
...
...
@@ -72,7 +77,7 @@ class FacilitiesMap extends React.Component {
maxBounds
:
getMaxBounds
(
campusRegion
),
campusRegion
:
campusRegion
,
center
:
facilityLocationExists
?
facility
.
facility_location
.
coordinate_location
.
coordinates
:
getCenterOfCampusRegion
(
campusRegion
),
zoom
:
facilityLocationExists
?
[
17
]
:
[
0
]
zoom
:
[
17
]
});
};
...
...
@@ -108,14 +113,13 @@ class FacilitiesMap extends React.Component {
this
.
setState
({
selectedLocation
:
oldSelectedLocation
!==
location
?
location
:
null
,
center
:
location
&&
location
.
location
.
coordinate_location
.
coordinates
,
zoom
:
oldSelectedLocation
!==
location
?
[
17
]
:
oldZoom
zoom
:
[
17
]
});
}
render
()
{
const
{
interactive
=
true
}
=
this
.
props
;
const
{
maxBounds
,
fitBoundsOptions
,
facilityLocations
,
selectedLocation
,
center
,
zoom
}
=
this
.
state
;
return
(
<
this
.
Map
onStyleLoad
=
{(
map
)
=>
{
...
...
@@ -130,7 +134,7 @@ class FacilitiesMap extends React.Component {
}}
animationOptions
=
{{
animate
:
true
,
duration
:
150
0
duration
:
1
2
50
}}
style
=
"
mapbox://styles/mduffy8/cjbcdxi3v73hp2spiyhxbkjde
"
movingMethod
=
"
easeTo
"
...
...
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