Skip to content

Commit dcc8661

Browse files
author
bdcoder2
authored
Add files via upload
1 parent 41b3dca commit dcc8661

File tree

2 files changed

+48
-6
lines changed

2 files changed

+48
-6
lines changed

v180/ex0/index.html

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,25 @@
4848
.form_div {
4949
display: inline-block;
5050
padding: 6px;
51-
margin: 0 0 0 12px;
51+
text-align: center;
52+
margin: 0;
5253
}
54+
55+
.inst_div {
56+
text-align: center;
57+
margin: 0;
58+
padding: 6px;
59+
}
60+
61+
.mzl_div {
62+
text-align: center;
63+
margin: 0;
64+
padding: 4px;
65+
}
66+
5367
.map_viewport {
5468
border: 1px solid #AAAAAA;
55-
height: 560px;
69+
height: 512px;
5670
width: 100%;
5771
position: relative;
5872
background: #EFEFEF;
@@ -71,6 +85,8 @@
7185
<section>
7286
<div class="center_div">
7387
The map below is using the grid clusterer with 200 random data points.
88+
</div>
89+
<div class="center_div">
7490
<form id="frm1" onsubmit="tester_obj.config_update( event );">
7591
<div class="form_div">
7692
Tile size (pixels) height x width:
@@ -105,13 +121,13 @@
105121
</div>
106122
</form>
107123
</div>
108-
</section>
109-
<div id="mvp" class="map_viewport"></div>
110-
<section id="log">
111-
<div class="center_div">
124+
<div class="inst_div">
112125
<b>Click on the map, a cluster marker or grid point marker to view details.</b>
113126
</div>
114127
</section>
128+
<div id="mvp" class="map_viewport"></div>
129+
<div id="mzl" class="mzl_div"></div>
130+
<section id="log"></section>
115131
</main>
116132
<script>
117133
async function map_init() {

v180/ex0/tester.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ class tester {
4444
alert('* Unable to create map: ' + ex.toString());
4545
return;
4646
}
47+
this.map_zoom_level_show();
4748
// Set clusterer options and create clusterer ...
4849
clusterer_opts = {
4950
cluster_marker_click_handler: this.cluster_marker_click_handler.bind(this),
@@ -55,6 +56,8 @@ class tester {
5556
this.clusterer.auto_redraw_event_add('idle');
5657
// Redraw tiles once all the tiles are loaded ...
5758
google.maps.event.addListenerOnce(this.map, 'tilesloaded', () => { this.clusterer.redraw(); });
59+
// Add map zoom handler ...
60+
google.maps.event.addListener(this.map, 'zoom_changed', this.map_zoom_level_show.bind(this));
5861
// Add map click handler ...
5962
google.maps.event.addListener(this.map, 'click', this.map_click_handler.bind(this));
6063
}
@@ -341,4 +344,27 @@ class tester {
341344
s += '</ul>';
342345
$('#log').html(s);
343346
}
347+
/*
348+
---------------------------------------------------------------------
349+
Map zoom handler.
350+
351+
PARAMETERS:
352+
353+
Name: evt
354+
Desc: A grid_point_marker_click_event object
355+
356+
RETURNS:
357+
358+
None
359+
360+
---------------------------------------------------------------------
361+
*/
362+
map_zoom_level_show() {
363+
let s;
364+
let z;
365+
// Show map zoom level ...
366+
z = this.map.getZoom();
367+
s = '<b>Map Zoom Level</b>: ' + z.toString();
368+
$('#mzl').html(s);
369+
}
344370
}

0 commit comments

Comments
 (0)