-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathShapeAnnotationConfig.js
More file actions
153 lines (135 loc) · 3.5 KB
/
ShapeAnnotationConfig.js
File metadata and controls
153 lines (135 loc) · 3.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
import Thickness from '../graphics/structs/Thickness';
import Size from '../graphics/structs/Size';
import {AnnotationType, ZOrderType, ShapeType, PlacementType, LineType } from '../enums';
/**
* @class ShapeAnnotationConfig
* @classdesc Shape annotation draws geometrical shapes over nodes
* of the diagram. Consider them as free-hand figures drawn over nodes with a highlighter.
*
* @param {object} arg0 Object properties.
*/
export default function ShapeAnnotationConfig(arg0) {
var property;
/**
* Annotation type property explicitly defines annotation object type when
* it is defined as a JSON object. The `annotations` collection contains
* a mixture of all kinds of control annotations.
*
* @type {AnnotationType}
*/
this.annotationType = AnnotationType.Shape;
/**
* Sets annotation z-order placement relative to the diagram items.
* Diagram visual elements are drawn in layers on top of each other.
* If you place annotations over diagram nodes, you block mouse events
* of UI elements in nodes templates. Browsers don't support mouse events
* transparency consistently yet. So to avoid mouse events blocking UI
* elements in node templates, you have to place annotation items under
* nodes or manipulate z-index for UI interactive controls and make them
* placed on top of other visual elements. The component puts the buttons panel
* on top of everything, so annotations drawn over the diagram nodes are not blocked.
*
* @type {ZOrderType}
*/
this.zOrderType = ZOrderType.Auto;
/**
* Collection of nodes ids this shape annotation is drawn for.
*
* @type {string[]}
*/
this.items = [];
/**
* Shape
*
* @type {ShapeType}
*/
this.shapeType = ShapeType.Rectangle;
/**
* Shape offset around annotated items.
*
* @type {Thickness}
*/
this.offset = new Thickness(0, 0, 0, 0);
/**
* Border line width
*
* @type {number}
*/
this.lineWidth = 2;
/**
* Adds rounded corners for applicable shapes. Radius is defined in percents or pixels.
*
* @type {string|number}
*/
this.cornerRadius = "10%";
/**
* Background color opacity
*
* @type {number}
*/
this.opacity = 1;
/**
* Shape border line color
*
* @type {string}
*/
this.borderColor = null;
/**
* Shape fill color
*
* @type {string}
*/
this.fillColor = null;
/**
* Border line type
*
* @type {LineType}
*/
this.lineType = LineType.Solid;
/**
* If true, annotated nodes are shown in their expanded form using item
* templates regardless of controls autofit mode and available screen space.
*
* @type {boolean}
*/
this.selectItems = false;
/**
* Annotation label, it is styled with 'bp-connector-label' CSS class
*
* @type {string}
*/
this.label = null;
/**
* Label size
*
* @type {Size}
*/
this.labelSize = new Size(60, 30);
/**
* Label placement around the annotation.
*
* @type {PlacementType}
*/
this.labelPlacement = PlacementType.Auto;
/**
* Label offset in pixels.
*
* @type {number}
*/
this.labelOffset = 4;
switch (arguments.length) {
case 1:
if (arg0 !== null) {
if (arg0 instanceof Array) {
this.items = arg0;
} else if (typeof arg0 == "object") {
for (property in arg0) {
if (arg0.hasOwnProperty(property)) {
this[property] = arg0[property];
}
}
}
}
break;
}
};