Skip to content

Commit

Permalink
align items when starting targeting
Browse files Browse the repository at this point in the history
  • Loading branch information
paul90 committed Jan 18, 2024
1 parent 57f7c1a commit 45c4254
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/target.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# that highlighting can be immediate when requested.

targeting = false
$item = null
item = null
itemElem = null
action = null
Expand All @@ -28,10 +29,13 @@ bind = ->

startTargeting = (e) ->
targeting = e.shiftKey
if targeting
if targeting and $item
$('.emit').addClass('highlight')
if id = item || action
$("[data-id=#{id}]").addClass('target')
key = ($page = $(this).parents('.page:first')).data('key')
place = $item.offset().top
$('.page').trigger('align-item', {key, id:item, place})
if itemElem
consumed = itemElem.consuming
if consumed
Expand Down Expand Up @@ -79,6 +83,7 @@ leaveItem = (e) ->
$('.item, .action').removeClass('target')
$('.item').removeClass('consumed')
item = null
$item = null
itemElem = null


Expand Down

0 comments on commit 45c4254

Please sign in to comment.