Auto Mouse

<script src="./point_src/automouse"></script>

Automouse provides a point at the mouse position. It's the last known position of the mouse; updated upon mousemove.

let point = Point.mouse.position
Meta Data
title Auto Mouse
dependencies ()
unused_keys ()
unknown_keys ('tags',)
tags ['mouse']
filepath_exists True
path automouse
filepath automouse.js
clean_files ()

  • VariableDeclaration
    const

    getLastMousePos

    =
    function ( )
  • ClassDeclaration
    class comments:
    The _AutoMouse_ class cares for much of the mouse pointer functionality for a stage and the a point. It's functionality is designed to hook onto preparing `stages` and their canvas. It exists as a singleton `autoMouse`: autoMouse = new AutoMouse() autoMouse == stage.mouse Point.mouse == stage.mouse Initiate like this: Point.mouse?.mount(stage.canvas) Synonymous to: installCanvas(canvas, stage){ this.canvasMap.set(canvas, stage) Point.mouse?.listen(canvas) }
    • constructor

      constructor

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

      The AutoMouse class cares for much of the mouse pointer functionality for a stage and the a point. It's functionality is designed to hook onto preparing stages and their canvas. It exists as a singleton autoMouse:

          autoMouse = new AutoMouse()
          autoMouse == stage.mouse
          Point.mouse == stage.mouse
      
      Initiate like this:
      
          Point.mouse?.mount(stage.canvas)
      
      Synonymous to:
      
          installCanvas(canvas, stage){
              this.canvasMap.set(canvas, stage)
              Point.mouse?.listen(canvas)
          }
      

      a reference of clicks

    • method

      _announce

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

      Wait for a stage prep event.

    • method

      stagePrepareHandler

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

      The given event has a stage ready for mounting. Perform any changes, such as adding a reference to the mouse.

      console.log('AutoMouse::stagePrepareHandler', d)

    • method

      announcementResponse

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

      getMousePos

      (
      canvas
      )
      from class_name
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])
    • get

      xy

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

      position

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

      The this.position method returns a new Point, with the mouse XY (from the last motion).

          Use `this.point` for a persisent single Point instance.
      
    • get

      point

      (
      )
      from class_name
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])
          Return a persistent _point_, of which is updated rather than replaced
          when the mouse state changes.
      
    • method

      getBoundingClientRect

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

      getListenerMethods

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

      console.log('Setting up mouse events')

    • method

      mount

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

      Call upon mount to initate listening of all events on a canvas.

    • method

      listen

      (
      canvas , eventName , handler , opts
      )
      from class_name
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])
    • method

      mousemoveHandler

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

      let bound = this.getBoundingClientRect();

    • method

      callHandlers

      (
      name , canvas , event
      )
      from class_name
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])
    • method

      mousedownHandler

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

      mouseupHandler

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

      applyPositionIncrement

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

      wheelHandler

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

      isDown

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

      wheelSize

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

      (v * v)

    • method

      clampWheelSize

      (
      min , max , abs
      )
      from class_name
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])
      A function to help clamp the wheel scroll within a range. By using this
      function, the wheel value doesn't exceed the clamp.
      
      
          let size = mouse.clampWheelSize(5, 20)
      
      The same can be done with the clamp function
      
          let size = clamp(mouse.wheelSize(), 30, 300)
      
      but when the wheel exceeds the clamp, it'll scroll into an unused range.
      
    • method

      on

      (
      canvas , name , handler , opts
      )
      from class_name
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])
    • method

      getActionSpace

      (
      name , defaults = {}
      )
      from class_name
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])
    • method

      speed

      (
      previous , delta = 1
      )
      from class_name
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])

      Return the speed of the point over a delta. This is a lot like the velocity functionality, but cut-down for efficiency.

    • property

      _moduloTicker

      = 0
      from class_name
      dict_keys(['kind', 'word', 'computed', 'static', 'value', 'type', 'pos'])
    • method

      modulatedSpeed

      (
      mod = 15 , previous , delta = 1
      )
      from class_name
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])
    • method

      computeSpeed

      (
      previous , current , delta = 1
      )
      from class_name
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos'])

      CREATE use a smoothtext function share for this anf fps text

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

    :

    dict_keys(['type', 'expression', 'pos'])
  • VariableDeclaration
    const

    autoMouse

    =
    new AutoMouse ( Point )
  • ExpressionStatement

    :

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

    :

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