         @dragging = false
         if not @button_activated
           @$tool_button.removeClass('active')
-        offset = $(e.currentTarget).offset()
-        e.bokehX = e.pageX - offset.left
-        e.bokehY = e.pageY - offset.top
+        set_bokehXY(e)
         @eventSink.trigger("#{@options.eventBasename}:DragEnd", e)
 
 


define [], () ->

  class TwoPointEventGenerator


          return
        if not @tool_active
          return

        set_bokehXY(e)

        if not @basepoint_set
          @dragging = true
