figureone 0.15.10 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/figureone.min.js +1 -1
- package/index.js +79167 -0
- package/package.json +15 -1
- package/types/index.d.ts +132 -0
- package/types/js/figure/Animation/Animation.d.ts +36 -0
- package/types/js/figure/Animation/AnimationBuilder.d.ts +173 -0
- package/types/js/figure/Animation/AnimationManager.d.ts +392 -0
- package/types/js/figure/Animation/AnimationStep/CustomStep.d.ts +99 -0
- package/types/js/figure/Animation/AnimationStep/DelayStep.d.ts +24 -0
- package/types/js/figure/Animation/AnimationStep/ElementAnimationStep/ColorAnimationStep.d.ts +203 -0
- package/types/js/figure/Animation/AnimationStep/ElementAnimationStep/OpacityAnimationStep.d.ts +220 -0
- package/types/js/figure/Animation/AnimationStep/ElementAnimationStep/PositionAnimationStep.d.ts +124 -0
- package/types/js/figure/Animation/AnimationStep/ElementAnimationStep/PulseAnimationStep.d.ts +137 -0
- package/types/js/figure/Animation/AnimationStep/ElementAnimationStep/PulseTransformAnimationStep.d.ts +52 -0
- package/types/js/figure/Animation/AnimationStep/ElementAnimationStep/RotationAnimationStep.d.ts +119 -0
- package/types/js/figure/Animation/AnimationStep/ElementAnimationStep/ScaleAnimationStep.d.ts +93 -0
- package/types/js/figure/Animation/AnimationStep/ElementAnimationStep/ScenarioAnimationStep.d.ts +204 -0
- package/types/js/figure/Animation/AnimationStep/ElementAnimationStep/TransformAnimationStep.d.ts +163 -0
- package/types/js/figure/Animation/AnimationStep/ElementAnimationStep.d.ts +56 -0
- package/types/js/figure/Animation/AnimationStep/ParallelAnimationStep.d.ts +70 -0
- package/types/js/figure/Animation/AnimationStep/SerialAnimationStep.d.ts +84 -0
- package/types/js/figure/Animation/AnimationStep/TriggerStep.d.ts +106 -0
- package/types/js/figure/Animation/AnimationStep.d.ts +110 -0
- package/types/js/figure/DrawContext2D.d.ts +9 -0
- package/types/js/figure/DrawingObjects/DrawingObject.d.ts +45 -0
- package/types/js/figure/DrawingObjects/GLObject/GLObject.d.ts +146 -0
- package/types/js/figure/DrawingObjects/HTMLObject/HTMLObject.d.ts +29 -0
- package/types/js/figure/DrawingObjects/TextObject/TextObject.d.ts +94 -0
- package/types/js/figure/DrawingObjects/TextObject/glyphMeasures.d.ts +7 -0
- package/types/js/figure/DrawingObjects/VertexObject/VertexGeneric.d.ts +21 -0
- package/types/js/figure/DrawingObjects/VertexObject/VertexObject.d.ts +0 -0
- package/types/js/figure/DrawingObjects/VertexObject/VertexText.d.ts +34 -0
- package/types/js/figure/Element.d.ts +1212 -0
- package/types/js/figure/Equation/Elements/BaseAnnotationFunction.d.ts +118 -0
- package/types/js/figure/Equation/Elements/BaseEquationFunction.d.ts +20 -0
- package/types/js/figure/Equation/Elements/Bounds.d.ts +49 -0
- package/types/js/figure/Equation/Elements/Color.d.ts +7 -0
- package/types/js/figure/Equation/Elements/Container.d.ts +5 -0
- package/types/js/figure/Equation/Elements/Element.d.ts +95 -0
- package/types/js/figure/Equation/Elements/Fraction.d.ts +5 -0
- package/types/js/figure/Equation/Elements/Lines.d.ts +5 -0
- package/types/js/figure/Equation/Elements/Matrix.d.ts +5 -0
- package/types/js/figure/Equation/Elements/Offset.d.ts +5 -0
- package/types/js/figure/Equation/Elements/Scale.d.ts +5 -0
- package/types/js/figure/Equation/Equation.d.ts +984 -0
- package/types/js/figure/Equation/EquationForm.d.ts +139 -0
- package/types/js/figure/Equation/EquationFunctions.d.ts +3367 -0
- package/types/js/figure/Equation/EquationSymbols.d.ts +1646 -0
- package/types/js/figure/Equation/HTMLEquation.d.ts +56 -0
- package/types/js/figure/Equation/Symbols/AngleBracket.d.ts +6 -0
- package/types/js/figure/Equation/Symbols/Arrow.d.ts +17 -0
- package/types/js/figure/Equation/Symbols/Bar.d.ts +6 -0
- package/types/js/figure/Equation/Symbols/Box.d.ts +11 -0
- package/types/js/figure/Equation/Symbols/Brace.d.ts +6 -0
- package/types/js/figure/Equation/Symbols/Bracket.d.ts +8 -0
- package/types/js/figure/Equation/Symbols/Division.d.ts +8 -0
- package/types/js/figure/Equation/Symbols/Integral.d.ts +7 -0
- package/types/js/figure/Equation/Symbols/Line.d.ts +5 -0
- package/types/js/figure/Equation/Symbols/Product.d.ts +6 -0
- package/types/js/figure/Equation/Symbols/Radical.d.ts +9 -0
- package/types/js/figure/Equation/Symbols/SquareBracket.d.ts +6 -0
- package/types/js/figure/Equation/Symbols/Strike.d.ts +8 -0
- package/types/js/figure/Equation/Symbols/Sum.d.ts +6 -0
- package/types/js/figure/Equation/Symbols/SymbolNew.d.ts +15 -0
- package/types/js/figure/Equation/Symbols/Vinculum.d.ts +6 -0
- package/types/js/figure/Figure.d.ts +711 -0
- package/types/js/figure/FigureCollections/Angle.d.ts +766 -0
- package/types/js/figure/FigureCollections/Axis.d.ts +517 -0
- package/types/js/figure/FigureCollections/Axis3.d.ts +118 -0
- package/types/js/figure/FigureCollections/Button.d.ts +195 -0
- package/types/js/figure/FigureCollections/EquationLabel.d.ts +77 -0
- package/types/js/figure/FigureCollections/FigureCollections.d.ts +122 -0
- package/types/js/figure/FigureCollections/Legend.d.ts +270 -0
- package/types/js/figure/FigureCollections/Line.d.ts +587 -0
- package/types/js/figure/FigureCollections/Plot.d.ts +558 -0
- package/types/js/figure/FigureCollections/PolyLine.d.ts +487 -0
- package/types/js/figure/FigureCollections/Rectangle.d.ts +235 -0
- package/types/js/figure/FigureCollections/SlideNavigator.d.ts +255 -0
- package/types/js/figure/FigureCollections/Slider.d.ts +155 -0
- package/types/js/figure/FigureCollections/Text.d.ts +307 -0
- package/types/js/figure/FigureCollections/Toggle.d.ts +185 -0
- package/types/js/figure/FigureCollections/Trace.d.ts +237 -0
- package/types/js/figure/FigurePrimitives/FigureElementPrimitive2DText.d.ts +119 -0
- package/types/js/figure/FigurePrimitives/FigureElementPrimitiveGLText.d.ts +94 -0
- package/types/js/figure/FigurePrimitives/FigureElementPrimitiveGesture.d.ts +536 -0
- package/types/js/figure/FigurePrimitives/FigureElementPrimitiveMorph.d.ts +175 -0
- package/types/js/figure/FigurePrimitives/FigurePrimitiveTypes.d.ts +788 -0
- package/types/js/figure/FigurePrimitives/FigurePrimitiveTypes2D.d.ts +1324 -0
- package/types/js/figure/FigurePrimitives/FigurePrimitiveTypes3D.d.ts +1105 -0
- package/types/js/figure/FigurePrimitives/FigurePrimitives.d.ts +173 -0
- package/types/js/figure/FigurePrimitives/Generic.d.ts +5 -0
- package/types/js/figure/FigurePrimitives/Text.d.ts +17 -0
- package/types/js/figure/FontManager.d.ts +113 -0
- package/types/js/figure/Gesture.d.ts +39 -0
- package/types/js/figure/Recorder/Recorder.d.ts +291 -0
- package/types/js/figure/Recorder/parseState.d.ts +3 -0
- package/types/js/figure/Recorder/recorder.worker.d.ts +1 -0
- package/types/js/figure/Recorder/state.d.ts +7 -0
- package/types/js/figure/SlideNavigator.d.ts +606 -0
- package/types/js/figure/TimeKeeper.d.ts +174 -0
- package/types/js/figure/geometries/arc.d.ts +18 -0
- package/types/js/figure/geometries/arrow.d.ts +215 -0
- package/types/js/figure/geometries/buffer.d.ts +4 -0
- package/types/js/figure/geometries/copy/copy.d.ts +178 -0
- package/types/js/figure/geometries/ellipse.d.ts +17 -0
- package/types/js/figure/geometries/line.d.ts +13 -0
- package/types/js/figure/geometries/lines/corners.d.ts +7 -0
- package/types/js/figure/geometries/lines/dashes.d.ts +23 -0
- package/types/js/figure/geometries/lines/lines.d.ts +31 -0
- package/types/js/figure/geometries/polygon/polygon.d.ts +12 -0
- package/types/js/figure/geometries/rectangle.d.ts +19 -0
- package/types/js/figure/geometries/triangle.d.ts +27 -0
- package/types/js/figure/webgl/Atlas.d.ts +42 -0
- package/types/js/figure/webgl/shaders.d.ts +143 -0
- package/types/js/figure/webgl/target.d.ts +9 -0
- package/types/js/figure/webgl/webgl.d.ts +54 -0
- package/types/js/tools/FunctionMap.d.ts +69 -0
- package/types/js/tools/color.d.ts +11 -0
- package/types/js/tools/colorNames.d.ts +2 -0
- package/types/js/tools/d2/polygon.d.ts +60 -0
- package/types/js/tools/d2/triangles.d.ts +0 -0
- package/types/js/tools/d3/cone.d.ts +57 -0
- package/types/js/tools/d3/cube.d.ts +26 -0
- package/types/js/tools/d3/cylinder.d.ts +45 -0
- package/types/js/tools/d3/line3.d.ts +55 -0
- package/types/js/tools/d3/prism.d.ts +49 -0
- package/types/js/tools/d3/revolve.d.ts +87 -0
- package/types/js/tools/d3/sphere.d.ts +33 -0
- package/types/js/tools/d3/surface.d.ts +47 -0
- package/types/js/tools/g2.d.ts +242 -0
- package/types/js/tools/geometry/Bounds.d.ts +446 -0
- package/types/js/tools/geometry/Line.d.ts +314 -0
- package/types/js/tools/geometry/Path.d.ts +67 -0
- package/types/js/tools/geometry/Plane.d.ts +201 -0
- package/types/js/tools/geometry/Point.d.ts +359 -0
- package/types/js/tools/geometry/Rect.d.ts +115 -0
- package/types/js/tools/geometry/Transform.d.ts +623 -0
- package/types/js/tools/geometry/angle.d.ts +105 -0
- package/types/js/tools/geometry/common.d.ts +9 -0
- package/types/js/tools/geometry/coordinates.d.ts +30 -0
- package/types/js/tools/geometry/deceleration.d.ts +13 -0
- package/types/js/tools/geometry/polygon.d.ts +4 -0
- package/types/js/tools/geometry/quaternion.d.ts +15 -0
- package/types/js/tools/geometry/scene.d.ts +282 -0
- package/types/js/tools/geometry/tools.d.ts +8 -0
- package/types/js/tools/geometry/types.d.ts +2 -0
- package/types/js/tools/getCssColors.d.ts +1 -0
- package/types/js/tools/getCssVariables.d.ts +4 -0
- package/types/js/tools/getImageData.d.ts +1 -0
- package/types/js/tools/getScssColors.d.ts +2 -0
- package/types/js/tools/htmlGenerator.d.ts +85 -0
- package/types/js/tools/m2.d.ts +24 -0
- package/types/js/tools/m3.d.ts +71 -0
- package/types/js/tools/math.d.ts +112 -0
- package/types/js/tools/morph.d.ts +651 -0
- package/types/js/tools/styleSheets.d.ts +3 -0
- package/types/js/tools/tools.d.ts +281 -0
- package/types/js/tools/types.d.ts +305 -0
- package/figureone.worker.js +0 -1
|
@@ -0,0 +1,766 @@
|
|
|
1
|
+
import { Point } from '../../tools/g2';
|
|
2
|
+
import type { TypeParsablePoint } from '../../tools/g2';
|
|
3
|
+
import { FigureElementCollection, FigureElementPrimitive } from '../Element';
|
|
4
|
+
import EquationLabel from './EquationLabel';
|
|
5
|
+
import { Equation } from '../Equation/Equation';
|
|
6
|
+
import type { OBJ_LineArrows, OBJ_LineArrow } from '../geometries/arrow';
|
|
7
|
+
import type { OBJ_Pulse } from '../Element';
|
|
8
|
+
import type { EQN_Equation } from '../Equation/Equation';
|
|
9
|
+
import type { TypeWhen } from '../TimeKeeper';
|
|
10
|
+
import type { TypeLabelOrientation, TypeLabelLocation, TypeLabelSubLocation } from './EquationLabel';
|
|
11
|
+
import * as animation from '../Animation/Animation';
|
|
12
|
+
import type { OBJ_CustomAnimationStep, OBJ_TriggerAnimationStep } from '../Animation/Animation';
|
|
13
|
+
import type { TypeColor, OBJ_Font } from '../../tools/types';
|
|
14
|
+
import type { OBJ_Collection } from '../FigurePrimitives/FigurePrimitiveTypes';
|
|
15
|
+
import type FigureCollections from './FigureCollections';
|
|
16
|
+
/**
|
|
17
|
+
* Angle move options object.
|
|
18
|
+
*
|
|
19
|
+
* The angle corner has two arms. The `startArm` is the first arm of the angle
|
|
20
|
+
* (the one defined by <a href="adv_angle#startangle">startAngle</a>),
|
|
21
|
+
* while the `endArm` is the second arm of the corner defined by
|
|
22
|
+
* <a href="adv_angle#angle">angle</a>.
|
|
23
|
+
*
|
|
24
|
+
* Both arms can be set to either rotate the angle (`'rotation'`) or change the
|
|
25
|
+
* size of the angle (`'angle'`). Invisible touch pads are overlaid on the arms
|
|
26
|
+
* with some `width`. When these pads are touched, the corresponding arm will
|
|
27
|
+
* move. The pads extend past the arm ends by `width` as well.
|
|
28
|
+
*
|
|
29
|
+
* If `movePadRadius` is greater than 0, then a pad with that radius will be
|
|
30
|
+
* placed at the corner vertex. When this pad is touched, the angle will
|
|
31
|
+
* translate.
|
|
32
|
+
*
|
|
33
|
+
* @property {'rotation' | 'angle' | null} [startArm]
|
|
34
|
+
* @property {'rotation' | 'angle' | null} [endArm]
|
|
35
|
+
* @property {boolean} [movable] `true` to make movable, `false` to not (`true`)
|
|
36
|
+
* @property {number} [movePadRadius] radius of move pad (`0`)
|
|
37
|
+
* @property {number} [width] width of pads over lines (`0.5`)
|
|
38
|
+
* @interface
|
|
39
|
+
* @group Misc Shapes
|
|
40
|
+
*/
|
|
41
|
+
export type OBJ_MovableAngle = {
|
|
42
|
+
movable: boolean;
|
|
43
|
+
movePadRadius: number;
|
|
44
|
+
width: number;
|
|
45
|
+
startArm: 'angle' | 'rotation' | null;
|
|
46
|
+
endArm: 'angle' | 'rotation' | null;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Collections angle label options object.
|
|
50
|
+
*
|
|
51
|
+
* An angle can be annotated with a label using the `text` property and can be:
|
|
52
|
+
* - text (`string`, or Array<`string`)
|
|
53
|
+
* - an equation (`Equation`, `EQN_Equation`)
|
|
54
|
+
* - real length of line (`null`)
|
|
55
|
+
*
|
|
56
|
+
* In all cases, an actual {@link Equation} is created as the label. The
|
|
57
|
+
* equation can have multiple forms, which can be set using the `showForm`
|
|
58
|
+
* method.
|
|
59
|
+
*
|
|
60
|
+
* If `text`: `string`, then an equation with a single form named `base` will
|
|
61
|
+
* be created with a single element being the string text.
|
|
62
|
+
*
|
|
63
|
+
* If `text`: `Array<string>`, then an equation with a form for each element
|
|
64
|
+
* of the array is created. Each form is named '0', '1', '2'... corresponding
|
|
65
|
+
* with the index of the array. Each form is has a single element, being the
|
|
66
|
+
* text at that index.
|
|
67
|
+
*
|
|
68
|
+
* Use `text`: `Equation` or `EQN_Equation` to create completely custom
|
|
69
|
+
* equations with any forms desirable.
|
|
70
|
+
*
|
|
71
|
+
* If the label text is the real angle (`null`), then the number
|
|
72
|
+
* of decimal places can be selected with `precision` and the units with
|
|
73
|
+
* `units`.
|
|
74
|
+
*
|
|
75
|
+
* By default, the label is placed at the same radius as the curve (if
|
|
76
|
+
* a curve exists). An independant radius can be selected with `radius`.
|
|
77
|
+
*
|
|
78
|
+
* The space between the radius and the label is defined with `offset`. An
|
|
79
|
+
* `offset` of 0 puts the center of the label on the radius. Any
|
|
80
|
+
* positive or negative value of offset will move the label so no part of the
|
|
81
|
+
* label overlaps the line, and then the closest part of the label is separated
|
|
82
|
+
* from the line by `offset`.
|
|
83
|
+
*
|
|
84
|
+
* To situate the label, use `curvePosition`, `location` and
|
|
85
|
+
* `subLocation`. By default the label will be a percentage `curvePosition`
|
|
86
|
+
* of the angle. `location` then defines which side of the radius the label is
|
|
87
|
+
* on, while `subLocation` defines the backup location for invalid cases of
|
|
88
|
+
* `location`. See {@link TypeLabelLocation} and
|
|
89
|
+
* {@link TypeLabelSubLocation}. `location` can additionaly place the
|
|
90
|
+
* labels off the ends of the angle.
|
|
91
|
+
*
|
|
92
|
+
* To automatically update the label location and orientation as the line
|
|
93
|
+
* transform (translation, rotation or scale) changes then use `update: true`.
|
|
94
|
+
*
|
|
95
|
+
* @property {null | string | Array<string> | Equation | EQN_Equation } text
|
|
96
|
+
* or equation to show. Use `null` to show real angle.
|
|
97
|
+
* @property {'degrees' | 'radians'} units (`'degrees'`)
|
|
98
|
+
* @property {number} [precision] (`0`)
|
|
99
|
+
* @property {number} [radius] overwrite default radius
|
|
100
|
+
* @property {number} [offset] space to radius (`0`)
|
|
101
|
+
* @property {number} [curvePosition] where the label is along the curve of the
|
|
102
|
+
* angle, in percent of curve from the start of the angle (`0.5`)
|
|
103
|
+
* @property {TypeLabelLocation} [location] (`'outside'`)
|
|
104
|
+
* @property {TypeLabelSubLocation} [subLocation]
|
|
105
|
+
* @property {TypeLabelOrientation} [orientation] (`'horizontal'`)
|
|
106
|
+
* @property {number} [autoHide] hide label if angle is less than value (`null`)
|
|
107
|
+
* @property {number} [autoHideMax] hide label if angle is greater than value (`null`)
|
|
108
|
+
* @property {boolean} [update] (`false`)
|
|
109
|
+
* @property {number} [scale] size of the label
|
|
110
|
+
* @property {TypeColor} [color]
|
|
111
|
+
* @group Misc Shapes
|
|
112
|
+
*/
|
|
113
|
+
export type TypeAngleLabelOptions = {
|
|
114
|
+
text: null | string | Array<string> | Equation | EQN_Equation;
|
|
115
|
+
units?: 'degrees' | 'radians';
|
|
116
|
+
precision?: number;
|
|
117
|
+
radius?: number;
|
|
118
|
+
offset?: number;
|
|
119
|
+
curvePosition?: number;
|
|
120
|
+
location?: TypeLabelLocation;
|
|
121
|
+
subLocation?: TypeLabelSubLocation;
|
|
122
|
+
orientation?: TypeLabelOrientation;
|
|
123
|
+
autoHide?: number | null | undefined;
|
|
124
|
+
autoHideMax?: number | null | undefined;
|
|
125
|
+
update?: boolean;
|
|
126
|
+
scale?: number;
|
|
127
|
+
color?: TypeColor;
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* Angle Curve options object.
|
|
131
|
+
*
|
|
132
|
+
* The curve annotation of an Collections Angle shape.
|
|
133
|
+
*
|
|
134
|
+
* @property {number} [width] Curve line width (`0.01`)
|
|
135
|
+
* @property {boolean} [fill] Use a fill instead of a line (`false`)
|
|
136
|
+
* @property {number} [sides] Number of sides in full circle curve (`100`)
|
|
137
|
+
* @property {number} [radius] Curve radius (`0.5`)
|
|
138
|
+
* @property {number} [num] Number of curves (`1`)
|
|
139
|
+
* @property {number} [step] Step radius of curves if curve num > 1 (`0`)
|
|
140
|
+
* @property {?number} [autoHide] if angle is less than this, hide curve
|
|
141
|
+
* (`null`)
|
|
142
|
+
* @property {?number} [autoHideMax] if angle is less than this, hide curve
|
|
143
|
+
* (`null`)
|
|
144
|
+
* @property {boolean} [autoRightAngle] Right angle curve displayed when angle
|
|
145
|
+
* = π/2 (`false`)
|
|
146
|
+
* @property {number} [rightAngleRange] Range around π/2 for right angle curve
|
|
147
|
+
* display (`0.01745329...` or 1 degree)
|
|
148
|
+
* @interface
|
|
149
|
+
* @group Misc Shapes
|
|
150
|
+
*/
|
|
151
|
+
export type OBJ_AngleCurve = {
|
|
152
|
+
width?: number;
|
|
153
|
+
fill?: boolean;
|
|
154
|
+
sides?: number;
|
|
155
|
+
radius?: number;
|
|
156
|
+
num?: number;
|
|
157
|
+
step?: number;
|
|
158
|
+
autoHide?: number | null | undefined;
|
|
159
|
+
autoHideMax?: number | null | undefined;
|
|
160
|
+
autoRightAngle?: boolean;
|
|
161
|
+
rightAngleRange?: number;
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* Additional arrow properties specific to collections angle shapes.
|
|
165
|
+
*
|
|
166
|
+
* By default, the arrows are placed at the same radius as the curve, but
|
|
167
|
+
* the radius can be changed with `radius`.
|
|
168
|
+
*
|
|
169
|
+
* By default, the arrows will hide when the angle is small enough where
|
|
170
|
+
* the arrows will touch. To disable this, use `autoHide`.
|
|
171
|
+
*
|
|
172
|
+
* As the curve is a polygon with a finite amount of sides, its actual length
|
|
173
|
+
* can look like it changes when the angle changes and a smaller number of
|
|
174
|
+
* sides are used. This can result in a gap sometimes appearing between the
|
|
175
|
+
* curve and the arrow head. To eliminate this gap, allow the curve to overlap
|
|
176
|
+
* with the arrow head a little with `curveOverlap`. Beware however, if using
|
|
177
|
+
* transparency, a large overlap will be obvious as the semi opaque color will
|
|
178
|
+
* be darker in the overlap area. Also, if pulsing curve thickness, then for
|
|
179
|
+
* small arrow heads, large width pulse scales and large overlap, the curve
|
|
180
|
+
* may break through the pointy edge of the arrow head. Therefore selecting
|
|
181
|
+
* `curveOverlap` can be a delicate balance that depends on application.
|
|
182
|
+
*
|
|
183
|
+
* @property {number} [curveOverlap] the percent of the arrow that the curve
|
|
184
|
+
* overlaps with (`0.3`)
|
|
185
|
+
* @property {boolean} [autoHide] `true` will hide the arrows when the angle is
|
|
186
|
+
* small enough that the arrows start to touch (`true`)
|
|
187
|
+
* @property {number} [radius] location of the arrows, by default they will be
|
|
188
|
+
* at the radius of the curve.
|
|
189
|
+
* @interface
|
|
190
|
+
* @group Misc Shapes
|
|
191
|
+
*/
|
|
192
|
+
export type OBJ_AngleArrows = {
|
|
193
|
+
curveOverlap?: number;
|
|
194
|
+
autoHide?: boolean;
|
|
195
|
+
radius?: number;
|
|
196
|
+
};
|
|
197
|
+
/**
|
|
198
|
+
* Arrow definition for advaned angles.
|
|
199
|
+
*
|
|
200
|
+
* `string | (`{@link OBJ_LineArrows} ` & ` {@link OBJ_AngleArrows}`)`
|
|
201
|
+
*
|
|
202
|
+
* Use `single` string to specify head type of two arrows with default
|
|
203
|
+
* dimensions. Otherwise use options object to select and/or customize one or
|
|
204
|
+
* both arrows.
|
|
205
|
+
* @group Misc Shapes
|
|
206
|
+
*/
|
|
207
|
+
export type TypeAngleArrows = string | OBJ_LineArrows & OBJ_AngleArrows;
|
|
208
|
+
/**
|
|
209
|
+
* Collections angle corner definition.
|
|
210
|
+
*
|
|
211
|
+
* @property {number} [length] length of corner's arms - by default it will be
|
|
212
|
+
* twice the length of the curve.
|
|
213
|
+
* @property {number} [width] line width of the corner - by default it will be
|
|
214
|
+
* the same as the curve
|
|
215
|
+
* @property {TypeColor} [color]
|
|
216
|
+
* @property {'fill' | 'auto' | 'none'} [style] style of the corner
|
|
217
|
+
* @interface
|
|
218
|
+
* @group Misc Shapes
|
|
219
|
+
*/
|
|
220
|
+
export type OBJ_AngleCorner = {
|
|
221
|
+
length?: number;
|
|
222
|
+
width?: number;
|
|
223
|
+
color?: TypeColor;
|
|
224
|
+
style?: 'fill' | 'auto' | 'none';
|
|
225
|
+
};
|
|
226
|
+
/**
|
|
227
|
+
* Options object for setting properties of `pulseAngle`.
|
|
228
|
+
*
|
|
229
|
+
* The `curve`, `corner`, `label` and `arrow` can all be
|
|
230
|
+
* pulsed with a simple scale number, or customization using
|
|
231
|
+
* the {@type OBJ_Pulse} object.
|
|
232
|
+
*
|
|
233
|
+
* The `thick` property can be used to change the default scale pulse.
|
|
234
|
+
* When a `1` is used, the angle will pulse from the vertex of the corner
|
|
235
|
+
* in scale. When `thick` is greater than 1, then the `curve` will pulse in
|
|
236
|
+
* thickness. Use a much smaller scale for curve when doing this.
|
|
237
|
+
*
|
|
238
|
+
* NB: When pulsing the thickness of a curve, the end corners of the curve
|
|
239
|
+
* may break through when the arrow heads are small or there is a large curve
|
|
240
|
+
* overlap between curve and arrow head. Use {@link OBJ_AngleArrows} to
|
|
241
|
+
* adjust `curveOverlap` and arrow head size, reduce the thickness scale, or
|
|
242
|
+
* increase the arrow scale to compensate.
|
|
243
|
+
*
|
|
244
|
+
* @property {number | OBJ_Pulse} [curve] (`1.5`)
|
|
245
|
+
* @property {number | OBJ_Pulse} [corner] (`1.5`)
|
|
246
|
+
* @property {number | OBJ_Pulse} [label] (`1.5`)
|
|
247
|
+
* @property {number | OBJ_Pulse} [arrow] (`1.5`)
|
|
248
|
+
* @property {number} [thick] (`1`)
|
|
249
|
+
* @property {number} [duration] in seconds
|
|
250
|
+
* @property {number} [frequency] in Hz
|
|
251
|
+
* @property {TypeWhen} [when] when to start the pulse (`'nextFrame'`)
|
|
252
|
+
* @property {function(): void} [done] execute when pulsing is finished
|
|
253
|
+
* @interface
|
|
254
|
+
* @group Misc Shapes
|
|
255
|
+
*/
|
|
256
|
+
export type OBJ_PulseAngle = {
|
|
257
|
+
curve?: number | OBJ_Pulse;
|
|
258
|
+
corner?: number | OBJ_Pulse;
|
|
259
|
+
label?: number | OBJ_Pulse;
|
|
260
|
+
arrow?: number | OBJ_Pulse;
|
|
261
|
+
thick?: number;
|
|
262
|
+
duration?: number;
|
|
263
|
+
frequency?: number;
|
|
264
|
+
when?: TypeWhen;
|
|
265
|
+
done?: (() => void) | null | undefined;
|
|
266
|
+
};
|
|
267
|
+
/**
|
|
268
|
+
* {@link CollectionsAngle} options object that extends {@link OBJ_Collection}
|
|
269
|
+
* options object (without `parent`).
|
|
270
|
+
*
|
|
271
|
+
* The Collections Angle is a convient and powerful angle
|
|
272
|
+
* {@link FigureElementCollection} that can draw one or several arcs of an
|
|
273
|
+
* angle annotation, a label, arrows, and the corner of an angle. It also
|
|
274
|
+
* includes some methods to make it convient to use dynamically.
|
|
275
|
+
*
|
|
276
|
+
* There are two ways to define an angle. With a `position`, `startAngle` and
|
|
277
|
+
* `angle`, or with three points. The angle can then be annotated with a curve
|
|
278
|
+
* and a label on either side of the corner using the `direction` property.
|
|
279
|
+
*
|
|
280
|
+
* The first way to define an angle is with `position`, `startAngle` and
|
|
281
|
+
* `angle`. `position` is the location of the vertex of the corner.
|
|
282
|
+
* Two lines join to make a corner, from which an angle annotation can be
|
|
283
|
+
* superimposed. The first line is defined with `startAngle` and the second
|
|
284
|
+
* line defined by `angle` relative to the first line. `angle` can either be
|
|
285
|
+
* positive or negative to define the second line.
|
|
286
|
+
*
|
|
287
|
+
* The second way to define an angle is with three points `p1`, `p2` and `p3`.
|
|
288
|
+
* `p2` is the vertex position of the corner. Line21 is first line of the
|
|
289
|
+
* corner and Line23 is the second.
|
|
290
|
+
*
|
|
291
|
+
* An angle can be annotated with a `curve` (or many multiple curves) and a
|
|
292
|
+
* `label`. `direction` defines which side of the corner the annotations will
|
|
293
|
+
* be drawn. `direction` can either be positive or negative (`1` or `-1`).
|
|
294
|
+
*
|
|
295
|
+
* A positive direction will place the annotations:
|
|
296
|
+
* - on the angle formed between `startAngle` and `angle`
|
|
297
|
+
* - *OR* the angle formed between Line21 and Line23 in the positive rotation
|
|
298
|
+
* direction
|
|
299
|
+
*
|
|
300
|
+
* A negative direction will place the annotations on the other side of the
|
|
301
|
+
* corner.
|
|
302
|
+
*
|
|
303
|
+
* A curve with multiple lines and/or arrows can be defined with `curve`.
|
|
304
|
+
*
|
|
305
|
+
* A label that can be the real angle in degrees or radians, text or an
|
|
306
|
+
* equation can be defined with `label`.
|
|
307
|
+
*
|
|
308
|
+
* The annotations will be placed at some radius from the corner vertex.
|
|
309
|
+
* `offset` can be used to draw the line some offset away from the line
|
|
310
|
+
* definition where a positive offset is on the side of the line that the line
|
|
311
|
+
* rotates toward when rotating in the positive direction.
|
|
312
|
+
*
|
|
313
|
+
* Pulsing this collection normally would pulse the scale of everything.
|
|
314
|
+
* If it often desirable to pulse only parts of the angle in special ways.
|
|
315
|
+
* Therefore this collection provides a method `pulseAngle` to allow this.
|
|
316
|
+
* This options object can define the default values for pulseAngle if desired.
|
|
317
|
+
*
|
|
318
|
+
* @extends OBJ_Collection
|
|
319
|
+
*
|
|
320
|
+
* @property {Point} [position] position of the angle vertex
|
|
321
|
+
* @property {number} [startAngle] rotation where the angle should start
|
|
322
|
+
* @property {number} [angle] size of the angle
|
|
323
|
+
* @property {Point} [p1] alternate way to define startAngle with `p2` and `p3`
|
|
324
|
+
* @property {Point} [p2] alternate way to define position of the angle vertex
|
|
325
|
+
* with `p2` and `p3`
|
|
326
|
+
* @property {Point} [p3] alternate way to define size of angle with `p2` and
|
|
327
|
+
* `p3`
|
|
328
|
+
* @property {1 | -1} [direction] side of the corner the angle annotations
|
|
329
|
+
* reside
|
|
330
|
+
* @property {OBJ_AngleCurve} [curve] options for a curve annotation
|
|
331
|
+
* @property {TypeAngleArrows} [arrow] options for arrow annotations
|
|
332
|
+
* @property {OBJ_AngleCorner} [corner] options for drawing a corner
|
|
333
|
+
* @property {TypeAngleLabelOptions} [label] options for label annotations
|
|
334
|
+
* @property {OBJ_PulseAngle} [pulseAngle] default pulseAngle options
|
|
335
|
+
* @interface
|
|
336
|
+
* @group 2D Shape Collections
|
|
337
|
+
*/
|
|
338
|
+
export type COL_Angle = {
|
|
339
|
+
position?: Point;
|
|
340
|
+
startAngle?: number;
|
|
341
|
+
angle?: number;
|
|
342
|
+
p1?: Point;
|
|
343
|
+
p2?: Point;
|
|
344
|
+
p3?: Point;
|
|
345
|
+
direction?: 1 | -1;
|
|
346
|
+
curve?: OBJ_AngleCurve;
|
|
347
|
+
arrow: TypeAngleArrows;
|
|
348
|
+
label?: TypeAngleLabelOptions;
|
|
349
|
+
corner?: OBJ_AngleCorner;
|
|
350
|
+
pulseAngle?: OBJ_PulseAngle;
|
|
351
|
+
} & OBJ_Collection;
|
|
352
|
+
declare class AngleLabel extends EquationLabel {
|
|
353
|
+
radius: number;
|
|
354
|
+
curvePosition: number;
|
|
355
|
+
offset: number;
|
|
356
|
+
showRealAngle: boolean;
|
|
357
|
+
orientation: TypeLabelOrientation;
|
|
358
|
+
precision: number;
|
|
359
|
+
units: 'degrees' | 'radians';
|
|
360
|
+
autoHide: number | null | undefined;
|
|
361
|
+
autoHideMax: number | null | undefined;
|
|
362
|
+
location: 'left' | 'right' | 'top' | 'bottom' | 'outside' | 'inside' | 'positive' | 'negative';
|
|
363
|
+
subLocation: 'left' | 'right' | 'bottom' | 'top';
|
|
364
|
+
constructor(equation: FigureCollections, labelText: string | Equation | Array<string>, color: TypeColor, radius: number, curvePosition: number | undefined, // number where 0 is end1, and 1 is end2
|
|
365
|
+
offset: number | undefined, showRealAngle: boolean | undefined, units: "degrees" | "radians" | undefined, precision: number | undefined, autoHide: number | null | undefined, autoHideMax: number | null | undefined, orientation: TypeLabelOrientation | undefined, location: 'left' | 'right' | 'top' | 'bottom' | 'outside' | 'inside' | 'positive' | 'negative', subLocation: 'left' | 'right' | 'top' | 'bottom', scale: number | undefined, font: OBJ_Font);
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* These properties are the same as the ones with the same names in
|
|
369
|
+
* {@link COL_Angle}.
|
|
370
|
+
* @property {TypeParsablePoint} [position]
|
|
371
|
+
* @property {number} [startAngle]
|
|
372
|
+
* @property {number} [angle]
|
|
373
|
+
* @property {TypeParsablePoint} [p1]
|
|
374
|
+
* @property {TypeParsablePoint} [p2]
|
|
375
|
+
* @property {TypeParsablePoint} [p3]
|
|
376
|
+
* @interface
|
|
377
|
+
* @group Misc Shapes
|
|
378
|
+
*/
|
|
379
|
+
export type OBJ_AngleSet = {
|
|
380
|
+
position?: TypeParsablePoint;
|
|
381
|
+
startAngle?: number;
|
|
382
|
+
angle?: number;
|
|
383
|
+
p1?: TypeParsablePoint;
|
|
384
|
+
p2?: TypeParsablePoint;
|
|
385
|
+
p3?: TypeParsablePoint;
|
|
386
|
+
};
|
|
387
|
+
/**
|
|
388
|
+
* Angle animation step.
|
|
389
|
+
*
|
|
390
|
+
* @property {number} [start] start angle (`current angle`)
|
|
391
|
+
* @property {number} [target] angle to animate to (`current angle`)
|
|
392
|
+
* @extends OBJ_CustomAnimationStep
|
|
393
|
+
* @interface
|
|
394
|
+
* @group Misc Shapes
|
|
395
|
+
*/
|
|
396
|
+
export type OBJ_AngleAnimationStep = {
|
|
397
|
+
start?: number;
|
|
398
|
+
target?: number;
|
|
399
|
+
} & OBJ_CustomAnimationStep;
|
|
400
|
+
/**
|
|
401
|
+
* Pulse angle animation step - see {@link OBJ_PulseAngle} for desicription of
|
|
402
|
+
* properties.
|
|
403
|
+
* @property {number | OBJ_Pulse} [curve] (`1.5`)
|
|
404
|
+
* @property {number | OBJ_Pulse} [corner] (`1.5`)
|
|
405
|
+
* @property {number | OBJ_Pulse} [label] (`1.5`)
|
|
406
|
+
* @property {number | OBJ_Pulse} [arrow] (`1.5`)
|
|
407
|
+
* @property {number} [thick] (`1`)
|
|
408
|
+
* @property {number} [duration] in seconds
|
|
409
|
+
* @property {number} [frequency] in Hz
|
|
410
|
+
* @extends OBJ_TriggerAnimationStep
|
|
411
|
+
* @interface
|
|
412
|
+
* @group Misc Shapes
|
|
413
|
+
*/
|
|
414
|
+
export type OBJ_PulseAngleAnimationStep = {
|
|
415
|
+
curve?: number | OBJ_Pulse;
|
|
416
|
+
corner?: number | OBJ_Pulse;
|
|
417
|
+
label?: number | OBJ_Pulse;
|
|
418
|
+
arrow?: number | OBJ_Pulse;
|
|
419
|
+
thick?: number;
|
|
420
|
+
duration?: number;
|
|
421
|
+
frequency?: number;
|
|
422
|
+
} & OBJ_TriggerAnimationStep;
|
|
423
|
+
/**
|
|
424
|
+
* {@link FigureElementCollection} representing an angle.
|
|
425
|
+
*
|
|
426
|
+
* 
|
|
427
|
+
*
|
|
428
|
+
* <p class="inline_gif"><img src="./apiassets/advangle_grow.gif" class="inline_gif_image"></p>
|
|
429
|
+
*
|
|
430
|
+
* <p class="inline_gif"><img src="./apiassets/advangle_move.gif" class="inline_gif_image"></p>
|
|
431
|
+
*
|
|
432
|
+
* This object defines a convient and powerful angle
|
|
433
|
+
* {@link FigureElementCollection} that includes one or more curve annotations,
|
|
434
|
+
* arrows, a label annotation that can self align and
|
|
435
|
+
* some methods to make it convient to use dynamically.
|
|
436
|
+
*
|
|
437
|
+
* See {@link COL_Angle} for the options that can be used when creating the
|
|
438
|
+
* angle.
|
|
439
|
+
*
|
|
440
|
+
* The object contains two additional animation steps `angle` and `pulseAngle`
|
|
441
|
+
* that animate a change in angle, and animate a pulsing of the angle
|
|
442
|
+
* respectively. The animation steps are available in
|
|
443
|
+
* the animation manager ({@link FigureElement}.animations),
|
|
444
|
+
* and in the animation builder
|
|
445
|
+
* (<a href="#animationmanagernew">animations.new</a>
|
|
446
|
+
* and <a href="#animationmanagerbuilder">animations.builder</a>).
|
|
447
|
+
*
|
|
448
|
+
* Some of the useful methods included in an collections angle are:
|
|
449
|
+
* - <a href="#collectionsanglepulseangle">pulseAngle</a> - customize pulsing the
|
|
450
|
+
* angle without
|
|
451
|
+
* - <a href="#collectionsanglesetmovable">setMovable</a> - overrides
|
|
452
|
+
* <a href="#figureelementsetmovable">FigureElement.setMovable</a> and
|
|
453
|
+
* allowing for more complex move options.
|
|
454
|
+
*
|
|
455
|
+
*
|
|
456
|
+
* @see See {@link OBJ_AngleAnimationStep} for angle animation step options.
|
|
457
|
+
*
|
|
458
|
+
* See {@link OBJ_PulseAngleAnimationStep} for pulse angle animation step
|
|
459
|
+
* options.
|
|
460
|
+
*
|
|
461
|
+
* To test examples below, append them to the
|
|
462
|
+
* <a href="#drawing-boilerplate">boilerplate</a>.
|
|
463
|
+
*
|
|
464
|
+
* @example
|
|
465
|
+
* // Angle with size label
|
|
466
|
+
* figure.add({
|
|
467
|
+
* name: 'a',
|
|
468
|
+
* make: 'collections.angle',
|
|
469
|
+
* angle: Math.PI / 4,
|
|
470
|
+
* label: null,
|
|
471
|
+
* curve: {
|
|
472
|
+
* radius: 0.5,
|
|
473
|
+
* width: 0.01,
|
|
474
|
+
* },
|
|
475
|
+
* corner: {
|
|
476
|
+
* width: 0.01,
|
|
477
|
+
* length: 1,
|
|
478
|
+
* },
|
|
479
|
+
* });
|
|
480
|
+
*
|
|
481
|
+
* @example
|
|
482
|
+
* // Right angle, created from figure.collections
|
|
483
|
+
* const a = figure.collections.angle({
|
|
484
|
+
* angle: Math.PI / 2,
|
|
485
|
+
* curve: {
|
|
486
|
+
* autoRightAngle: true,
|
|
487
|
+
* width: 0.01,
|
|
488
|
+
* },
|
|
489
|
+
* corner: {
|
|
490
|
+
* width: 0.01,
|
|
491
|
+
* length: 1,
|
|
492
|
+
* },
|
|
493
|
+
* });
|
|
494
|
+
* figure.add('a', a);
|
|
495
|
+
*
|
|
496
|
+
* @example
|
|
497
|
+
* // Multi colored angle with arrows and an equation label
|
|
498
|
+
* figure.add({
|
|
499
|
+
* name: 'a',
|
|
500
|
+
* make: 'collections.angle',
|
|
501
|
+
* angle: Math.PI / 4 * 3,
|
|
502
|
+
* label: {
|
|
503
|
+
* text: {
|
|
504
|
+
* elements: {
|
|
505
|
+
* theta: { text: '\u03b8', color: [1, 0, 1, 1] },
|
|
506
|
+
* },
|
|
507
|
+
* forms: {
|
|
508
|
+
* 0: { frac: ['theta', 'vinculum', '2']},
|
|
509
|
+
* },
|
|
510
|
+
* },
|
|
511
|
+
* offset: 0.05,
|
|
512
|
+
* location: 'inside',
|
|
513
|
+
* color: [0, 0, 1, 1],
|
|
514
|
+
* },
|
|
515
|
+
* curve: {
|
|
516
|
+
* radius: 0.5,
|
|
517
|
+
* width: 0.01,
|
|
518
|
+
* },
|
|
519
|
+
* arrow: 'barb',
|
|
520
|
+
* corner: {
|
|
521
|
+
* width: 0.01,
|
|
522
|
+
* length: 1,
|
|
523
|
+
* color: [0, 0.5, 0, 1],
|
|
524
|
+
* },
|
|
525
|
+
* });
|
|
526
|
+
*
|
|
527
|
+
* @example
|
|
528
|
+
* // Multiple curve angle, without corner
|
|
529
|
+
* const a = figure.collections.angle({
|
|
530
|
+
* angle: Math.PI / 4,
|
|
531
|
+
* curve: {
|
|
532
|
+
* num: 3,
|
|
533
|
+
* step: -0.03,
|
|
534
|
+
* radius: 0.5,
|
|
535
|
+
* width: 0.01,
|
|
536
|
+
* },
|
|
537
|
+
* label: {
|
|
538
|
+
* text: 'a',
|
|
539
|
+
* offset: 0.05,
|
|
540
|
+
* },
|
|
541
|
+
* });
|
|
542
|
+
* figure.add('a', a);
|
|
543
|
+
*
|
|
544
|
+
* @example
|
|
545
|
+
* // Change angle animation
|
|
546
|
+
* figure.add({
|
|
547
|
+
* name: 'a',
|
|
548
|
+
* make: 'collections.angle',
|
|
549
|
+
* angle: Math.PI / 4,
|
|
550
|
+
* label: null,
|
|
551
|
+
* curve: {
|
|
552
|
+
* radius: 0.5,
|
|
553
|
+
* width: 0.01,
|
|
554
|
+
* },
|
|
555
|
+
* corner: {
|
|
556
|
+
* width: 0.01,
|
|
557
|
+
* length: 1,
|
|
558
|
+
* },
|
|
559
|
+
* });
|
|
560
|
+
* figure.elements._a.animations.new()
|
|
561
|
+
* .angle({ start: Math.PI / 4, target: Math.PI / 4 * 3, duration: 3 })
|
|
562
|
+
* .start();
|
|
563
|
+
*
|
|
564
|
+
* @example
|
|
565
|
+
* // Movable angle
|
|
566
|
+
* figure.add({
|
|
567
|
+
* name: 'a',
|
|
568
|
+
* make: 'collections.angle',
|
|
569
|
+
* angle: Math.PI / 4 * 3,
|
|
570
|
+
* label: {
|
|
571
|
+
* text: null,
|
|
572
|
+
* location: 'outside',
|
|
573
|
+
* orientation: 'horizontal',
|
|
574
|
+
* offset: 0.1,
|
|
575
|
+
* update: true,
|
|
576
|
+
* sides: 200,
|
|
577
|
+
* },
|
|
578
|
+
* curve: {
|
|
579
|
+
* radius: 0.3,
|
|
580
|
+
* fill: true,
|
|
581
|
+
* },
|
|
582
|
+
* corner: {
|
|
583
|
+
* width: 0.02,
|
|
584
|
+
* length: 1,
|
|
585
|
+
* color: [0.4, 0.4, 0.4, 1],
|
|
586
|
+
* },
|
|
587
|
+
* });
|
|
588
|
+
* figure.elements._a.setMovable({
|
|
589
|
+
* startArm: 'rotation',
|
|
590
|
+
* endArm: 'angle',
|
|
591
|
+
* movePadRadius: 0.3,
|
|
592
|
+
* });
|
|
593
|
+
* @group 2D Shape Collections
|
|
594
|
+
*/
|
|
595
|
+
declare class CollectionsAngle extends FigureElementCollection {
|
|
596
|
+
_curve: FigureElementPrimitive | null | undefined;
|
|
597
|
+
_curveRight: FigureElementPrimitive | null | undefined;
|
|
598
|
+
_arrow1: FigureElementPrimitive | null | undefined;
|
|
599
|
+
_arrow2: FigureElementPrimitive | null | undefined;
|
|
600
|
+
_side1: FigureElementPrimitive | null | undefined;
|
|
601
|
+
_side2: FigureElementPrimitive | null | undefined;
|
|
602
|
+
_corner: FigureElementPrimitive | null | undefined;
|
|
603
|
+
_label: Equation | null | undefined;
|
|
604
|
+
_anglePad: FigureElementPrimitive | null | undefined;
|
|
605
|
+
_rotPad: FigureElementPrimitive | null | undefined;
|
|
606
|
+
_movePad: FigureElementPrimitive | null | undefined;
|
|
607
|
+
label: AngleLabel | null | undefined;
|
|
608
|
+
arrow: {
|
|
609
|
+
start?: OBJ_LineArrow & {
|
|
610
|
+
radius: number;
|
|
611
|
+
curveOverlap: number;
|
|
612
|
+
autoHide: boolean;
|
|
613
|
+
height: number;
|
|
614
|
+
};
|
|
615
|
+
end?: OBJ_LineArrow & {
|
|
616
|
+
radius: number;
|
|
617
|
+
curveOverlap: number;
|
|
618
|
+
autoHide: boolean;
|
|
619
|
+
height: number;
|
|
620
|
+
};
|
|
621
|
+
} | null | undefined;
|
|
622
|
+
corner: {
|
|
623
|
+
width: number;
|
|
624
|
+
length: number;
|
|
625
|
+
color: TypeColor;
|
|
626
|
+
style: 'fill' | 'auto' | 'none';
|
|
627
|
+
} | null | undefined;
|
|
628
|
+
side1: {
|
|
629
|
+
width: number;
|
|
630
|
+
length: number;
|
|
631
|
+
} | null | undefined;
|
|
632
|
+
side2: {
|
|
633
|
+
width: number;
|
|
634
|
+
length: number;
|
|
635
|
+
} | null | undefined;
|
|
636
|
+
curve: any;
|
|
637
|
+
startAngle: number;
|
|
638
|
+
angle: number;
|
|
639
|
+
direction: -1 | 1;
|
|
640
|
+
lastLabelRotationOffset: number;
|
|
641
|
+
collections: FigureCollections;
|
|
642
|
+
isTouchDevice: boolean;
|
|
643
|
+
largerTouchBorder: any;
|
|
644
|
+
nextPosition: Point | null | undefined;
|
|
645
|
+
nextStartAngle: number | null | undefined;
|
|
646
|
+
pulseAngleDefaults: {
|
|
647
|
+
curve: number | OBJ_Pulse;
|
|
648
|
+
corner: number | OBJ_Pulse;
|
|
649
|
+
label: number | OBJ_Pulse;
|
|
650
|
+
arrow: number | OBJ_Pulse;
|
|
651
|
+
thick: number;
|
|
652
|
+
duration: number;
|
|
653
|
+
frequency: number;
|
|
654
|
+
};
|
|
655
|
+
autoUpdateSubscriptionId: number;
|
|
656
|
+
animations: {
|
|
657
|
+
pulseAngle: (...opt: Array<any>) => animation.TriggerAnimationStep;
|
|
658
|
+
angle: (...opt: Array<any>) => animation.CustomAnimationStep;
|
|
659
|
+
} & animation.AnimationManager;
|
|
660
|
+
calculateAngleRotationPosition(options: {
|
|
661
|
+
p1?: TypeParsablePoint;
|
|
662
|
+
p2?: TypeParsablePoint;
|
|
663
|
+
p3?: TypeParsablePoint;
|
|
664
|
+
position?: TypeParsablePoint;
|
|
665
|
+
startAngle?: number;
|
|
666
|
+
angle?: number;
|
|
667
|
+
}): void;
|
|
668
|
+
/**
|
|
669
|
+
* @hideconstructor
|
|
670
|
+
*/
|
|
671
|
+
constructor(collections: FigureCollections, isTouchDevice: boolean, animateNextFrame: () => void, options?: COL_Angle);
|
|
672
|
+
_getStateProperties(options: Record<string, any>): string[];
|
|
673
|
+
_fromState(state: Record<string, any>): this;
|
|
674
|
+
/**
|
|
675
|
+
* Turn on and off auto label location and orientation updates when angle
|
|
676
|
+
* transform changes. When an angle is created with a label, auto update
|
|
677
|
+
* is turned off by default.
|
|
678
|
+
*
|
|
679
|
+
* Manual updates can be performed with
|
|
680
|
+
* <a href="collectionsangle#udpatelabel">updateLabel</a>
|
|
681
|
+
*/
|
|
682
|
+
setAutoUpdate(update?: boolean): void;
|
|
683
|
+
setNextPositionAndRotation(): void;
|
|
684
|
+
/**
|
|
685
|
+
* Set the angle. The same direction and angle sign must be used as when
|
|
686
|
+
* originally defined.
|
|
687
|
+
*/
|
|
688
|
+
setAngle(options?: OBJ_AngleSet): void;
|
|
689
|
+
getCornerPoints(length: number): Point[];
|
|
690
|
+
addCorner(options: {
|
|
691
|
+
length: number;
|
|
692
|
+
width: number;
|
|
693
|
+
color: TypeColor;
|
|
694
|
+
style: 'fill' | 'auto' | 'none';
|
|
695
|
+
}): void;
|
|
696
|
+
addSide(index: 1 | 2, length?: number | null, width?: number | null, color?: TypeColor): void;
|
|
697
|
+
addLabel(options?: TypeAngleLabelOptions): void;
|
|
698
|
+
addCurve(curveOptions?: {
|
|
699
|
+
width?: number;
|
|
700
|
+
sides?: number;
|
|
701
|
+
}): void;
|
|
702
|
+
change(options: {
|
|
703
|
+
radius?: number;
|
|
704
|
+
curveRadius?: number;
|
|
705
|
+
curvePosition?: number;
|
|
706
|
+
offset?: number;
|
|
707
|
+
}): void;
|
|
708
|
+
addArrow(lineEnd: 'start' | 'end'): void;
|
|
709
|
+
updateCurve(primaryCurveAngle: number, angle: number, rotation: number, show: boolean): void;
|
|
710
|
+
update(labelRotationOffset?: number | null): void;
|
|
711
|
+
checkLabelForRightAngle(): void;
|
|
712
|
+
/**
|
|
713
|
+
* Get the current angle in degrees or radians
|
|
714
|
+
*/
|
|
715
|
+
getAngle(units?: 'deg' | 'rad'): number;
|
|
716
|
+
/**
|
|
717
|
+
* Set the label text
|
|
718
|
+
*/
|
|
719
|
+
setLabel(text: string): void;
|
|
720
|
+
fontUpdated(): void;
|
|
721
|
+
/**
|
|
722
|
+
* Get the label text
|
|
723
|
+
*/
|
|
724
|
+
getLabel(): string;
|
|
725
|
+
/**
|
|
726
|
+
* Set the label to be the real angle
|
|
727
|
+
*/
|
|
728
|
+
setLabelToRealAngle(): void;
|
|
729
|
+
updateLabelUnshow(): void;
|
|
730
|
+
/**
|
|
731
|
+
* Manually update the label orientations with a custom rotation offset.
|
|
732
|
+
*
|
|
733
|
+
* Automatic updating can be done with
|
|
734
|
+
* <a href="collectionsangle#setautoupdate">setAutoUpdate</a>
|
|
735
|
+
* @param {number | null} rotationOffset
|
|
736
|
+
*/
|
|
737
|
+
updateLabel(rotationOffset?: number | null | undefined, forceShow?: boolean): void;
|
|
738
|
+
/**
|
|
739
|
+
* Pulse the angle where each element can be pulsed in a custom way.
|
|
740
|
+
*
|
|
741
|
+
* The pulse scales of the curve, label, corner and arrows can all be defined
|
|
742
|
+
* separately.
|
|
743
|
+
*/
|
|
744
|
+
pulseAngle(options?: OBJ_PulseAngle): void;
|
|
745
|
+
showAll(): void;
|
|
746
|
+
/**
|
|
747
|
+
* Use this method to enable or disable movability of the line.
|
|
748
|
+
*
|
|
749
|
+
* @param {OBJ_MovableAngle | boolean} [movableOrOptions] `true` to
|
|
750
|
+
* make movable, `false` to make not movable or use options to
|
|
751
|
+
* set different kinds of movability.
|
|
752
|
+
*/
|
|
753
|
+
setMovable(movableOrOptions?: boolean | OBJ_MovableAngle): void;
|
|
754
|
+
getLength(): any;
|
|
755
|
+
addAnglePad(percentLength: number | undefined, width: number | undefined, type: 'rotation' | 'angle'): void;
|
|
756
|
+
addRotPad(percentLength: number | undefined, width: number | undefined, type: 'rotation' | 'angle'): void;
|
|
757
|
+
addMovePad(percentLength?: number): void;
|
|
758
|
+
updateMovePads(): void;
|
|
759
|
+
}
|
|
760
|
+
export default CollectionsAngle;
|
|
761
|
+
export type TypeLabelledAngle = {
|
|
762
|
+
_curve: FigureElementPrimitive;
|
|
763
|
+
_label: {
|
|
764
|
+
_base: FigureElementPrimitive;
|
|
765
|
+
} & Equation;
|
|
766
|
+
} & CollectionsAngle;
|