Merge lp:~joergberroth/unav/fix_map_longclick_behaviour into lp:unav

Proposed by JkB
Status: Merged
Merged at revision: 58
Proposed branch: lp:~joergberroth/unav/fix_map_longclick_behaviour
Merge into: lp:unav
Prerequisite: lp:~costales/unav/0.59-more-minor-improvements
Diff against target: 93 lines (+30/-31)
2 files modified
nav/index.html (+28/-30)
qml/PoiListPage.qml (+2/-1)
To merge this branch: bzr merge lp:~joergberroth/unav/fix_map_longclick_behaviour
Reviewer Review Type Date Requested Status
costales Approve
Nekhelesh Ramananthan testing Approve
Review via email: mp+292718@code.launchpad.net

Commit message

* small design fix for PoiListPage Button

*improved map long-click behavior to make it react as one would expect

Description of the change

* small design fix for PoiListPage Button

*improved map long-click behavior to make it react as one would expect

To post a comment you must log in.
Revision history for this message
Nekhelesh Ramananthan (nik90) wrote :

Worked nicely! Nice work Joerg! So with release we have pinch-zoom, and long-press fixed as well. Great job guys!

@marcos, please do a code review. thnx

review: Approve (testing)
58. By JkB

*set longpress to 300ms

59. By JkB

*merge with trunk

60. By JkB

*merge costales fixes

Revision history for this message
costales (costales) wrote :

So awesome hack! Thanks Joerg!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'nav/index.html'
--- nav/index.html 2016-04-22 17:32:31 +0000
+++ nav/index.html 2016-04-24 15:41:24 +0000
@@ -419,45 +419,43 @@
419 // Map events419 // Map events
420 // Clicks420 // Clicks
421 var longpress = false;421 var longpress = false;
422 map.on('singleclick', function(evt) {422 var longpressTimer;
423 if (longpress) {423 var pointerIsDown = false;
424 map.on('pointerdown', function(evt) {
425 longpress = false;
426 !pointerIsDown ? longpressTimer = window.setTimeout( function(){
427 longpress = true;
424 var coord = ol.proj.transform(evt.coordinate, 'EPSG:3857', 'EPSG:4326');428 var coord = ol.proj.transform(evt.coordinate, 'EPSG:3857', 'EPSG:4326');
429
425 while (coord[0] > 180) // Fix bug ol3 #4522430 while (coord[0] > 180) // Fix bug ol3 #4522
426 coord[0] = coord[0] - 360;431 coord[0] = coord[0] - 360;
427 while (coord[0] < -180)432 while (coord[0] < -180)
428 coord[0] = coord[0] + 360;433 coord[0] = coord[0] + 360;
429 434
430 ui.markers_POI_set([{title: '', lat: coord[1], lng: coord[0]}]);435 ui.markers_POI_set([{title: '', lat: coord[1], lng: coord[0]}]);
431 436
432 window.location = 'http://clicked_on_map?nofollow/' + coord[1] + '/' + coord[0] + '/none/none/none/none'; // Show popup437 window.location = 'http://clicked_on_map?nofollow/' + coord[1] + '/' + coord[0] + '/none/none/none/none'; // Show popup
433 }438 },
434 else {439 300 /**longpress time constant **/ ) : undefined;
435 window.location = 'http://hide_popup?';440 pointerIsDown=true;
436 }441 });
437 });442
438 443 map.on('pointermove', function(evt) {
439 var startTime, endTime;444 window.clearTimeout(longpressTimer);
440 $("#map").on('touchstart', function () {445 });
441 startTime = new Date().getTime();446
442 });447 map.on('singleclick', function(evt) {
443 $("#map").on('touchend', function () {448 !longpress ? window.location = 'http://hide_popup?' : undefined;
444 endTime = new Date().getTime();449 });
445 longpress = (endTime - startTime < 225) ? false : true;450
446 });451 map.on('pointerup', function () {
447 452 window.clearTimeout(longpressTimer);
448 /** TESTING BEGIN453 pointerIsDown=false;
449 $("#map").on('mousedown', function () {454 });
450 startTime = new Date().getTime();455
451 });
452 $("#map").on('mouseup', function () {
453 endTime = new Date().getTime();
454 longpress = (endTime - startTime < 225) ? false : true;
455 });
456 TESTING END **/
457
458 // Drag456 // Drag
459 map.on('pointerdrag', function(evt) {457 map.on('pointerdrag', function(evt) {
460 ui.set_zoom_unav(false); // Pinch zoom = custom zoom too458 window.clearTimeout(longpressTimer);
461 459
462 if (id_gps != 0 && ui.get_center_onpos()) { // Unfocus center if GPS ON460 if (id_gps != 0 && ui.get_center_onpos()) { // Unfocus center if GPS ON
463 ui.set_center_onpos(false);461 ui.set_center_onpos(false);
464462
=== modified file 'qml/PoiListPage.qml'
--- qml/PoiListPage.qml 2016-04-20 17:36:04 +0000
+++ qml/PoiListPage.qml 2016-04-24 15:41:24 +0000
@@ -123,9 +123,10 @@
123 id: distButton123 id: distButton
124 visible: false124 visible: false
125 z: 500125 z: 500
126 width: parent.width*5/8
126 anchors {127 anchors {
127 top: distSlider.bottom128 top: distSlider.bottom
128 topMargin: units.gu (1)129 topMargin: units.gu (3)
129 horizontalCenter: parent.horizontalCenter130 horizontalCenter: parent.horizontalCenter
130 }131 }
131 iconName: "reload"132 iconName: "reload"

Subscribers

People subscribed via source and target branches