Drawer that uses a P5 instance for all drawing operations.
Members
debugMarkerRadius :Number
Radius of the main visual elements for debug drawing.
- Default Value:
-
22
-
debugPointRadius :Number
Radius of point markers for debug drawing.
- Default Value:
-
22
-
debugStyle :Object
Style used for debug drawing, when null the style already applied
is used.
- Default Value:
-
null
-
debugTextOptions :Object
Settings used by the default implementation of drawable.debug().
Properties:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
font |
String
|
'monospace'
|
Font to use when drawing with |
|
size |
Number
|
<optional> |
rac.textFormatDefaults.size
|
Font size to use when drawing with |
fixedDigits |
Number
|
2
|
Number of decimal digits to print when drawing with |
debugTextStyle :Object
Style used for text for debug drawing, when null the style already
applied is used.
- Default Value:
-
null
-
strokeWeightFactor :Number
Factor applied to stroke weight setting. Stroke weight is set to
stroke.weight * strokeWeightFactor when applicable.
- Default Value:
-
1
-
Methods
setDebugFunction(drawableClass, debugFunction)
Sets the given debugFunction to perform the debug-drawing for
instances of class drawableClass.
When a drawable class does not have a debugFunction setup, calling
drawable.debug() simply calls draw() with
debugStyle applied.
debugFunction is expected to have the signature:
debugFunction(drawer, objectOfClass, drawsText)
drawer: P5Drawer- Instance to use for drawingobjectOfClass: drawableClass- Instance ofdrawableClassto drawdrawsText: bool- Whentruetext should be drawn with additional information.
Parameters:
| Name | Type | Description |
|---|---|---|
drawableClass |
class
|
Class of the instances to draw |
debugFunction |
function
|
Function that performs debug-drawing |
setDrawFunction(drawableClass, drawFunction)
Sets the given drawFunction to perform the drawing for instances of
class drawableClass.
drawFunction is expected to have the signature:
drawFunction(drawer, objectOfClass)
drawer: P5Drawer- Instance to use for drawingobjectOfClass: drawableClass- Instance ofdrawableClassto draw
Parameters:
| Name | Type | Description |
|---|---|---|
drawableClass |
class
|
Class of the instances to draw |
drawFunction |
function
|
Function that performs drawing |