From 26d6c8b6bfc406126e9eb340b99f51fad58bdef4 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Tue, 16 Sep 2014 17:27:46 -0700 Subject: [PATCH 1/3] hover placement: only use the halfway threshold for images --- src/General/UI.coffee | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/General/UI.coffee b/src/General/UI.coffee index 60cc1db1e..02035d256 100755 --- a/src/General/UI.coffee +++ b/src/General/UI.coffee @@ -307,6 +307,7 @@ UI = do -> root el style: el.style + isImage: el.nodeName in ['IMG', 'VIDEO'] cb endEvents latestEvent @@ -345,7 +346,9 @@ UI = do -> else top - [left, right] = if clientX <= @clientWidth / 2 + threshold = @clientWidth / 2 + threshold = Math.max threshold, @clientWidth - 400 unless @isImage + [left, right] = if clientX <= threshold [clientX + 45 + 'px', null] else [null, @clientWidth - clientX + 45 + 'px'] From 5e1b8a8f7c05b5788fb66aa8a64986043c0c630f Mon Sep 17 00:00:00 2001 From: ccd0 Date: Tue, 16 Sep 2014 17:47:24 -0700 Subject: [PATCH 2/3] Well, that would explain the image preview jumping. --- src/General/UI.coffee | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/General/UI.coffee b/src/General/UI.coffee index 02035d256..193bd471d 100755 --- a/src/General/UI.coffee +++ b/src/General/UI.coffee @@ -310,6 +310,7 @@ UI = do -> isImage: el.nodeName in ['IMG', 'VIDEO'] cb endEvents + ready: false latestEvent clientHeight: doc.clientHeight clientWidth: doc.clientWidth @@ -321,6 +322,7 @@ UI = do -> $.asap -> !el.parentNode or asapTest() , -> + o.ready = true o.hover o.latestEvent if el.parentNode $.on root, endEvents, o.hoverend @@ -335,6 +337,7 @@ UI = do -> hover = (e) -> @latestEvent = e + return unless @ready height = @el.offsetHeight {clientX, clientY} = e From 34abd802674867fe5627a4f5061c80746286b557 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Tue, 16 Sep 2014 18:23:53 -0700 Subject: [PATCH 3/3] tweak image hover vertical position --- src/General/UI.coffee | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/General/UI.coffee b/src/General/UI.coffee index 193bd471d..44eec8030 100755 --- a/src/General/UI.coffee +++ b/src/General/UI.coffee @@ -341,13 +341,10 @@ UI = do -> height = @el.offsetHeight {clientX, clientY} = e - top = clientY - 120 - top = if @clientHeight <= height or top <= 0 - 0 - else if top + height >= @clientHeight - @clientHeight - height + top = if @isImage + Math.max 0, clientY * (@clientHeight - height) / @clientHeight else - top + Math.max 0, Math.min(@clientHeight - height, clientY - 120) threshold = @clientWidth / 2 threshold = Math.max threshold, @clientWidth - 400 unless @isImage