Warning: Use of undefined constant Symbol - assumed 'Symbol' (this will throw an Error in a future version of PHP) in /mnt/new-ebs/workbench-106550/lib/dojo/util/docscripts/lib/parser2/dojo2.inc on line 215 Warning: Use of undefined constant JavaScriptSymbol - assumed 'JavaScriptSymbol' (this will throw an Error in a future version of PHP) in /mnt/new-ebs/workbench-106550/lib/dojo/util/docscripts/lib/parser2/dojo2.inc on line 215

dojox/drawing/util/common.js

  • Provides:

    • dojox.drawing.util.common
  • Requires:

    • dojox.math.round in common
  • dojox.drawing.util.common

    • summary
      A collection of common methods used for DojoX Drawing.
      This singleton is accessible in most Drawing classes
      as this.util
      
      NOTE:
      A lot of functions use a EventObject
      as an argument. An attempt was made to accept
      either that object or a list of numbers. That wasn't
      finished (it didn't work well in all cases) but is
      likely to happen in the future.
      In cases where you are not sending a Mouse object,
      form your argument like so:
      var obj = {
      start:{
      x:Number,  	// start x
      y:Number	// start y
      },
      x: Number,		// end x
      y:Number		// end y
      }
    • type
      Object
  • dojox.drawing.util.common.radToDeg

    • parameters:
      • n: (typeof Numer)
    • returns
      Number
    • summary
      Convert the passed number to degrees.
    • type
      Function
  • dojox.drawing.util.common.degToRad

    • parameters:
      • n: (typeof Numer)
    • returns
      Number
    • summary
      Convert the passed number to radians.
    • type
      Function
  • dojox.drawing.util.common.angle

    • parameters:
      • obj: (typeof EventObject)
        Manager.Mouse event.
      • snap: (typeof ?)
        Float Returns nearest angle within snap limits
        
        obj = this.argsToObj.apply(this, arguments);
    • returns
      Whole Number|Float
    • summary
      Return angle based on mouse object
      arguments:
    • type
      Function
  • dojox.drawing.util.common.oppAngle

    • parameters:
      • ang: (typeof Angle)
    • type
      Function
  • dojox.drawing.util.common.radians

    • parameters:
      • o: (typeof EventObject)
    • summary
      Return the radians derived from the coordinates
      in the Mouse object.
      
      var o = this.argsToObj.apply(this, arguments);
    • type
      Function
  • dojox.drawing.util.common.length

    • parameters:
      • o: (typeof EventObject)
    • summary
      Return the length derived from the coordinates
      in the Mouse object.
    • type
      Function
  • dojox.drawing.util.common.lineSub

    • parameters:
      • x1: (typeof Number)
      • y1: (typeof Number)
      • x2: (typeof Number)
      • y2: (typeof Number)
      • amt: (typeof Number)
    • returns
      Object
    • summary
      Subtract an amount from a line
    • description
      x1,y1,x2,y2 represents the Line. 'amt' represents the amount
      to subtract from it.
    • type
      Function
  • dojox.drawing.util.common.argsToObj

    • summary
      Attempts to determine in a Mouse Object
      was passed or indiviual numbers. Returns
      an object.
    • type
      Function
  • dojox.drawing.util.common.distance

    • returns
      Number
    • summary
      Return the length derived from the coordinates
      in the Mouse object. Different from util.length
      in that this always returns an absolute value.
    • type
      Function
  • dojox.drawing.util.common.slope

    • parameters:
      • p1: (typeof Object)
      • p2: (typeof Object)
    • returns
      Number
    • summary
      Given two poits of a line, returns the slope.
    • type
      Function
  • dojox.drawing.util.common.pointOnCircle

    • parameters:
      • cx: (typeof Number)
      • cy: (typeof Number)
      • radius: (typeof Number)
      • angle: (typeof Number)
    • summary
      A *very* helpful method. If you know the center
      (or starting) point, length and angle, find the
      x,y point at the end of that line.
    • type
      Function
  • dojox.drawing.util.common.constrainAngle

    • parameters:
      • obj: (typeof EventObject)
      • min: (typeof Number)
      • max: (typeof Number)
    • returns
      Object
    • summary
      Ensures the angle in the Mouse Object is within the
      min and max limits. If not one of those limits is used.
      Returns an x,y point for the angle used.
    • type
      Function
  • dojox.drawing.util.common.snapAngle

    • parameters:
      • obj: (typeof EventObject)
        Mouse object (see dojox.drawing.Mouse)
      • ca: (typeof Float)
        Fractional amount to snap to
        A decimal number fraction of a half circle
        .5 would snap to 90 degrees
        .25  would snap to 45 degrees
        .125 would snap to 22.5 degrees, etc.
    • returns
      Object
    • summary
      Snaps a line to the nearest angle
    • type
      Function
  • dojox.drawing.util.common.idSetStart

    • parameters:
      • num
    • type
      Function
  • dojox.drawing.util.common.uid

    • parameters:
      • str: (typeof ?)
        String If provided, kept in a map, incremented
        and used in the id. Otherwise 'shape' is used.
    • returns
      String
    • summary
      Creates a unique ID.
      arguments:
    • type
      Function
  • dojox.drawing.util.common.abbr

    • parameters:
      • type
    • summary
      Converts a namespace (typically a tool or a stencil) into
      an abbreviation
    • type
      Function
  • dojox.drawing.util.common.mixin

    • parameters:
      • o1
      • o2
    • type
      Function
  • dojox.drawing.util.common.objects

    • type
      Object
  • dojox.drawing.util.common.register

    • parameters:
      • obj: (typeof Object)
    • summary
      Since util is the only Singleton in Drawing (besides
      keys) it is used to help connect the Drawing object
      the Toolbar. Since multiple drawings can be on one
      page, this function serves a little more use than
      on first apearance.
    • type
      Function
  • dojox.drawing.util.common.byId

    • parameters:
      • id: (typeof String)
    • summary
      Get an object that was registered with util.register
    • type
      Function
  • dojox.drawing.util.common.attr

    • parameters:
      • elem: (typeof Object)
      • prop: (typeof property)
      • value: (typeof ?)
        value
      • squelchErrors
    • summary
      Helper function to attach attributes to SVG and VML raw nodes.
    • type
      Function
  • dojox.drawing.util

    • type
      Object
  • dojox.drawing

    • type
      Object
  • dojox

    • type
      Object