From f47efffa8512919332288b8033a8db86ab664f51 Mon Sep 17 00:00:00 2001 From: Will Thompson Date: Mon, 8 Jun 2015 15:21:07 +0100 Subject: [PATCH] AnnotationFolder: fix showing annotations at current position, fixes #2802 Every day I discover something new and stupid about JavaScript. Today, it is that (eg) [100, 20].sort() == [100, 20]. x >= 100 && x <= 20 is always false. --- source/UI/js/Video/AnnotationFolder.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/UI/js/Video/AnnotationFolder.js b/source/UI/js/Video/AnnotationFolder.js index d8d527b..01fbd80 100644 --- a/source/UI/js/Video/AnnotationFolder.js +++ b/source/UI/js/Video/AnnotationFolder.js @@ -399,8 +399,12 @@ Ox.AnnotationFolder = function(options, self) { that.triggerEvent('change', item); } + function numerically(a, b) { + return a - b; + } + function crossesPoint() { - var positions = [self.position, self.options.position].sort(); + var positions = [self.position, self.options.position].sort(numerically); return self.points.some(function(point) { return point >= positions[0] && point <= positions[1]; }); -- 2.4.2