Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
PyBusMap
Manage
Activity
Members
Labels
Plan
Issues
10
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
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
Anton Sarukhanov
PyBusMap
Commits
c776989d
Commit
c776989d
authored
8 years ago
by
Anton Sarukhanov
Browse files
Options
Downloads
Patches
Plain Diff
Half-ass solution to
#8
.
parent
dde4846f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
static/js/map.js
+11
-4
11 additions, 4 deletions
static/js/map.js
with
11 additions
and
4 deletions
static/js/map.js
+
11
−
4
View file @
c776989d
...
@@ -3,7 +3,7 @@ var BusMap = {
...
@@ -3,7 +3,7 @@ var BusMap = {
zoomShowVehicles
:
15
,
zoomShowVehicles
:
15
,
stopZoom
:
16
,
stopZoom
:
16
,
vehicleMaxAge
:
10
,
vehicleMaxAge
:
10
,
locateOptions
=
{
timeout
:
3000
,
},
locateOptions
:
{
timeout
:
3000
,
},
};
};
/*
/*
...
@@ -426,7 +426,8 @@ BusMap.Map = function(opts) {
...
@@ -426,7 +426,8 @@ BusMap.Map = function(opts) {
// Scaling: update what is displayed based on zoom level
// Scaling: update what is displayed based on zoom level
function
zoomShowHide
()
{
function
zoomShowHide
()
{
var
zoom
=
that
.
leaflet
.
getZoom
();
var
zoom
=
that
.
leaflet
.
getZoom
();
if
(
that
.
vehicleMarkersGroup
)
{
var
got_vehicles
=
Object
.
keys
(
map
.
vehicleMarkers
).
length
>
0
;
if
(
got_vehicles
&&
that
.
vehicleMarkersGroup
)
{
if
(
zoom
>=
BusMap
.
zoomShowVehicles
if
(
zoom
>=
BusMap
.
zoomShowVehicles
&&
!
(
that
.
leaflet
.
hasLayer
(
that
.
vehicleMarkersGroup
)))
{
&&
!
(
that
.
leaflet
.
hasLayer
(
that
.
vehicleMarkersGroup
)))
{
that
.
leaflet
.
addLayer
(
that
.
vehicleMarkersGroup
);
that
.
leaflet
.
addLayer
(
that
.
vehicleMarkersGroup
);
...
@@ -485,9 +486,15 @@ BusMap.Map = function(opts) {
...
@@ -485,9 +486,15 @@ BusMap.Map = function(opts) {
// Go to zoom level and map center where vehicles are visible.
// Go to zoom level and map center where vehicles are visible.
function
goToVehicles
()
{
function
goToVehicles
()
{
// TODO: this
var
zoom
=
BusMap
.
zoomShowVehicles
;
var
zoom
=
BusMap
.
zoomShowVehicles
;
console
.
log
(
"
going to zoom
"
+
zoom
);
var
veh_keys
=
Object
.
keys
(
that
.
vehicleMarkers
);
if
(
veh_keys
.
length
>
0
)
{
var
ll
=
that
.
vehicleMarkers
[
veh_keys
[
0
]].
getLatLng
();
}
else
{
var
ll
=
that
.
leaflet
.
getCenter
();
}
console
.
log
(
"
setView(
"
+
ll
+
"
,
"
+
zoom
+
"
)
"
);
that
.
leaflet
.
setView
(
ll
,
zoom
);
}
}
init
();
init
();
...
...
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