Dragging

<script src="./point_src/distances.js"></script>
<script src="./point_src/dragging"></script>

Dragging tool performs distance tests for all applied points.

const drag = new Dragging
drag.initDragging(this)
drag.onDragMove = this.onDragMove.bind(this)
drag.onDragEnd = this.onDragEnd.bind(this)

Install points into the map:

drag.addPoints(this.center, this.point0, this.point1)

Upon a mouse action we can access the discovered points.

let p = drag.getPoint();
if(p) {
    p.pen.circle(ctx)
}
Meta Data
title Dragging
dependencies ('distances.js',)
unused_keys ()
unknown_keys ('files',)
files ['', 'protractor.js', 'text/beta.js']
filepath_exists True
path dragging
filepath dragging.js
clean_files ('protractor.js', 'text/beta.js')

  • ExpressionStatement

    :

    dict_keys(['type', 'expression', 'pos'])
  • ClassDeclaration
    class comments:

    click Down<>Up ms delta,

    • property

      clickSpeed

      = 300
      from Dragging
      dict_keys(['kind', 'word', 'computed', 'static', 'value', 'type', 'pos'])
    • property

      clickDragDeadzone

      from Dragging
      dict_keys(['kind', 'word', 'computed', 'static', 'value', 'type', 'pos'])
    • property

      maxWheelValue

      = 500
      from Dragging
      dict_keys(['kind', 'word', 'computed', 'static', 'value', 'type', 'pos'])
    • property

      padding

      = 10
      from Dragging
      dict_keys(['kind', 'word', 'computed', 'static', 'value', 'type', 'pos'])
    • property

      twistMouse

      = true
      from Dragging
      dict_keys(['kind', 'word', 'computed', 'static', 'value', 'type', 'pos'])
    • constructor

      constructor

      (
      stage
      )
      from Dragging
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])
    • method

      wake

      (
      )
      from Dragging
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])
    • method

      initDragging

      (
      stage
      )
      from Dragging
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])

      , {passive: true}

    • method

      add

      (
      point
      )
      from Dragging
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])
    • method

      set

      (
      many
      )
      from Dragging
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])
    • method

      onMousedown

      (
      stage , canvas , ev
      )
      from Dragging
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])

      register point

    • method

      primaryActionDown

      (
      stage , canvas , ev
      )
      from Dragging
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])

      Capture the down event for the primary mouse button (likely button #0)

    • method

      emptyMouseDown

      (
      stage , canvas , ev
      )
      from Dragging
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])

      console.log('Empty click', stage, ev)

    • method

      getPoint

      (
      )
      from Dragging
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])

      return the point previously discovered.

    • method

      onMousemove

      (
      stage , canvas , ev
      )
      from Dragging
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])

      present the possible nearest

    • method

      isRightClickOkay

      (
      ev
      )
      from Dragging
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])
    • method

      mousedownRotationTool

      (
      ev
      )
      from Dragging
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])

      this.mousedownOrigin.radians = this._near.radians

    • method

      onShiftMouseMoveHandler

      (
      ev
      )
      from Dragging
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])

      the point should spin rather than move.

    • method

      cursorChange

      (
      found
      )
      from Dragging
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])

      perform cursor magic

    • method

      _emitCursorHover

      (
      )
      from Dragging
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])

      console.log('enable hover')

    • method

      _emitCursorRelease

      (
      )
      from Dragging
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])

      console.log('disable hover', id)

    • method

      onMouseup

      (
      stage , canvas , ev
      )
      from Dragging
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])

      console.log('Click Speed =', delta, 'distance', dis, 'is click:', isClick)

    • method

      onWheelInternal

      (
      stage , canvas , ev
      )
      from Dragging
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])

      this.onWheel(ev, n)

    • method

      onLongClick

      (
      stage , canvas , ev , delta
      )
      from Dragging
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])
    • method

      getDownTimeTaken

      (
      )
      from Dragging
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])
    • method

      onContextMenu

      (
      stage , c , ev
      )
      from Dragging
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])

      mouse.listen(c, 'contextmenu', (c,ev)=> this.onContextMenu(stage,c,ev), {passive: true})

    • method

      dragDistance

      (
      ev
      )
      from Dragging
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])

      Given the EV with a {x,y}, return the distance from the origin mousedown.

    • method

      onClickHander

      (
      stage , canvas , ev
      )
      from Dragging
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])

      console.log('That was a click not a drag...')

    • method

      callDoubleHandler

      (
      name , ev , p , x
      )
      from Dragging
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])

      Given a function name shared by this instance, and the point, call the function with the event and arguments.

              callDoubleHandler('onClick', ev, point, ...)
      
          The function name must exist on this instance, optional on the point.
      
    • method

      callPointHandler

      (
      name , ev , p , x
      )
      from Dragging
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])

      Call the method name on the point, with the event, if the point contains the method.

              this.callPointHandler('onMousedown', ev, this._near)
      
          Apply any arguments after the _point_ to the event
      
              this.callPointHandler('onLongClick', ev, this._near, delta, { apples: 'green'})
      
    • method

      drawAll

      (
      ctx
      )
      from Dragging
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])
    • method

      drawTwists

      (
      ctx
      )
      from Dragging
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])
    • method

      drawIris

      (
      ctx
      )
      from Dragging
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])

      The dynamic highlighter.

    • method

      onWheelEmpty

      (
      ev
      )
      from Dragging
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])
    • method

      onEmptyDown

      (
      ev
      )
      from Dragging
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])
    • method

      onClick

      (
      ev
      )
      from Dragging
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])
    • method

      onDragStart

      (
      ev , point
      )
      from Dragging
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])
    • method

      onDragMove

      (
      ev
      )
      from Dragging
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])
    • method

      onDragEnd

      (
      ev , point
      )
      from Dragging
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])
    • method

      onWheel

      (
      ev , point
      )
      from Dragging
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])
    • method

      onEdgeStart

      (
      ev
      )
      from Dragging
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])
    • method

      onEdgeMove

      (
      ev
      )
      from Dragging
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])

      console.log('onEdgeMove')

    • method

      onEdgeEnd

      (
      ev
      )
      from Dragging
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])
    • method

      onDragMoveHandler

      (
      ev
      )
      from Dragging
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])
    • method

      onDragStartHandler

      (
      ev , p
      )
      from Dragging
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])

      this.onDragStart(ev, p)

    • method

      onEdgeStartHandler

      (
      ev
      )
      from Dragging
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])
    • method

      withinBufferZone

      (
      distancePoint , buffer
      )
      from Dragging
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])

      distance

    • method

      onDragEndHandler

      (
      ev
      )
      from Dragging
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])

      this.onDragEnd(ev)

    • method

      applyXY

      (
      x , y
      )
      from Dragging
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])
    dict_keys(['kind', 'word', 'parentName', 'type', 'body', 'comments', 'pos'])
  • ClassDeclaration
    class comments:

    stash and pop cursor states. id = cursor.set(name) cursor.unset(id)

    • constructor

      constructor

      (
      stage
      )
      from CursorStack
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])

      this.current = 'default'

    • method

      set

      (
      name , parallelUnset
      )
      from CursorStack
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])

      console.log('set cursor')

    • method

      setMouseIcon

      (
      icon
      )
      from CursorStack
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])
    • method

      unset

      (
      uuid , perform = True
      )
      from CursorStack
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])

      console.log('unset cursor', uuid)

    dict_keys(['kind', 'word', 'parentName', 'type', 'body', 'comments', 'pos'])
  • ExpressionStatement

    :

    dict_keys(['type', 'expression', 'pos'])
  • ExpressionStatement

    :

    dict_keys(['type', 'expression', 'pos'])
  • EmptyStatement
    ; (empty statement)
  • ExpressionStatement

    :

    dict_keys(['type', 'expression', 'pos'])