@@ -53,8 +53,8 @@ LocalComponents.Page {
53 function latitudeToY(latitude, map_height) {
53 function latitudeToY(latitude, map_height) {
54 const bottom_lat = -59;
54 const bottom_lat = -59;
55 const top_lat = 81;
55 const top_lat = 81;
57 const top_per = top_lat / 180.0;
56 const top_per = top_lat / 180.0;
58 var y = 1.25 * Math.log(Math.tan(0.25*Math.PI + 0.4 * radians(latitude)));
58 var y = 1.25 * Math.log(Math.tan(0.25*Math.PI + 0.4 * radians(latitude)));
59 const full_range = 4.6068250867599998;
59 const full_range = 4.6068250867599998;
60 const top_offset = full_range * top_per;
60 const top_offset = full_range * top_per;
@@ -153,10 +153,11 @@ LocalComponents.Page {
153 highlightTimezone(offset);
153 highlightTimezone(offset);
154 ListView.view.currentIndex = index;
154 ListView.view.currentIndex = index;
155 selectedTimeZone = timeZone;
155 selectedTimeZone = timeZone;
156− print("Clicked at city with coords:", longitude, latitude);
156+ //print("Clicked at city with coords:", longitude, latitude);
157+ //print("Clicked on TZ:", timeZone);
157− print("Highlight at (x,y):", longitudeToX(longitude, map.width), latitudeToY(latitude, map.height));
158+ //print("Highlight at (x,y):", longitudeToX(longitude, map.width), latitudeToY(latitude, map.height));
158− pinImage.x = longitudeToX(longitude, map.width) - pinImage.width / 2;
159+ pinImage.x = Qt.binding(function() { return longitudeToX(longitude, map.width) - pinImage.width / 2; });
159− pinImage.y = latitudeToY(latitude, map.height) - pinImage.height;
160+ pinImage.y = Qt.binding(function() { return latitudeToY(latitude, map.height) - pinImage.height; });
@@ -235,13 +236,19 @@ LocalComponents.Page {
235 MouseArea {
236 MouseArea {
236 anchors.fill: parent
237 anchors.fill: parent
237 onClicked: {
238 onClicked: {
239+ var x = mouse.x + map.width/60; // longitude is offset by 6 degrees
241+ if (y <= 2*map.height/3) {
242+ y = y * 0.80; // latitude is offset by ~20%, except the 1/3 southern hemisphere
238− var tzAndOffset = tzModel.timezoneAndOffsetAtMapPoint(mouse.x, mouse.y,
245+ var tzAndOffset = tzModel.timezoneAndOffsetAtMapPoint(x, y, Qt.size(map.width, map.height));
239− Qt.size(map.width, map.height));
240 var tzId = tzAndOffset[0];
246 var tzId = tzAndOffset[0];
241 var offset = tzAndOffset[1];
247 var offset = tzAndOffset[1];
242 print("Timezone", tzId, ", offset", offset);
248 print("Timezone", tzId, ", offset", offset);
243 if (tzId) {
249 if (tzId) {
244 resetViews();
250 resetViews();
251+ tzFilterModel.country = "";
245 selectedTimeZone = tzId;
252 selectedTimeZone = tzId;
246 highlightTimezone(offset);
253 highlightTimezone(offset);