 
 define [], () ->
+
+  set_bokehXY = (event) ->
+    offset = $(event.currentTarget).offset()
+    left = if offset? then offset.left else 0
+    top = if offset? then offset.top else 0
+    event.bokehX = event.pageX - left
+    event.bokehY = event.pageY - top
 
   class TwoPointEventGenerator
 

        (e, delta, dX, dY) =>
          if not @tool_active
            return
          offset = $(e.currentTarget).offset()
          e.bokehX = e.pageX - offset.left
          e.bokehY = e.pageY - offset.top
          e.delta = delta
          eventSink.trigger("#{toolName}:zoom", e)
          e.preventDefault()

          return
        if not @tool_active
          return

        set_bokehXY(e)

        if not @basepoint_set
          @dragging = true
