summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpliablepixels <pliablepixels@gmail.com>2016-04-22 16:46:34 -0400
committerpliablepixels <pliablepixels@gmail.com>2016-04-22 16:46:34 -0400
commitac3ce1f56629b175543751ab500ee72482f8f767 (patch)
tree6867f14454cd402b305435f3f776ce78c999e107
parentbbd8d4b8fc3da1182ec3c6077775a6bf857950bc (diff)
#230 - closest guess hack
Former-commit-id: c73816e67ce3d13efffc36cfa1a5f5de52b9c7f7
-rw-r--r--www/js/TimelineCtrl.js47
1 files changed, 39 insertions, 8 deletions
diff --git a/www/js/TimelineCtrl.js b/www/js/TimelineCtrl.js
index c99e0509..1301ac01 100644
--- a/www/js/TimelineCtrl.js
+++ b/www/js/TimelineCtrl.js
@@ -676,6 +676,8 @@ angular.module('zmApp.controllers').controller('zmApp.TimelineCtrl', ['$ionicPla
timeline.on('click', function (prop) {
+
+
$timeout (function() {
if (dblclick)
{
@@ -698,14 +700,43 @@ angular.module('zmApp.controllers').controller('zmApp.TimelineCtrl', ['$ionicPla
} else {
- $ionicLoading.show({
- template: "Zoom in more to scrub events...",
- animation: 'fade-in',
- showBackdrop: true,
- maxWidth: 200,
- showDelay: 0,
- duration: 1500,
- });
+ ZMDataModel.zmDebug ("exact match not found, guessing item with co-ordinates X="+prop.x+" group="+prop.group);
+ if (prop.group)
+ {
+ var visible = timeline.getVisibleItems();
+ ZMDataModel.zmDebug ("Visible items="+JSON.stringify(visible));
+ var closestItem;
+ var minDist =99999;
+ for (var x = 0; x < visible.length; x++)
+ {
+ var _item = timeline.itemSet.items[x];
+ if (_item.data.group == prop.group)
+ {
+ if (Math.abs(_item.left - prop.x) < minDist)
+ {
+ closestItem = _item;
+ minDist = Math.abs(_item.left - prop.x);
+ ZMDataModel.zmDebug ("Temporary closest "+_item.left);
+ //console.log (_item);
+ }
+ }
+
+ }
+ ZMDataModel.zmLog ("Closest item " +closestItem.left+ " group: " + closestItem.data.group);
+ showEvent(closestItem.data.myevent);
+ }
+ else // no group row tapped, do nothing
+ {
+
+ /*$ionicLoading.show({
+ template: "",
+ animation: 'fade-in',
+ showBackdrop: true,
+ maxWidth: 200,
+ showDelay: 0,
+ duration: 1500,
+ });*/
+ }
// console.log("Zoomed out too far to playback events");
}
},400);