@hpcc-js/common 3.6.5 → 3.7.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/LICENSE +43 -43
- package/README.md +59 -59
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +1 -1
- package/dist/index.umd.cjs.map +1 -1
- package/package.json +2 -2
- package/src/CanvasWidget.ts +31 -31
- package/src/Class.ts +72 -72
- package/src/Database.ts +860 -860
- package/src/Entity.ts +235 -235
- package/src/EntityCard.ts +66 -66
- package/src/EntityPin.ts +103 -103
- package/src/EntityRect.css +15 -15
- package/src/EntityRect.ts +254 -254
- package/src/EntityVertex.ts +86 -86
- package/src/FAChar.css +2 -2
- package/src/FAChar.ts +89 -89
- package/src/HTMLWidget.ts +191 -191
- package/src/IList.ts +4 -4
- package/src/IMenu.ts +5 -5
- package/src/Icon.css +9 -9
- package/src/Icon.ts +176 -176
- package/src/Image.ts +104 -104
- package/src/List.css +13 -13
- package/src/List.ts +102 -102
- package/src/Menu.css +23 -23
- package/src/Menu.ts +139 -139
- package/src/Palette.ts +341 -341
- package/src/Platform.ts +125 -125
- package/src/ProgressBar.ts +115 -115
- package/src/PropertyExt.ts +770 -770
- package/src/ResizeSurface.css +39 -39
- package/src/ResizeSurface.ts +225 -225
- package/src/SVGWidget.ts +583 -583
- package/src/SVGZoomWidget.css +12 -12
- package/src/SVGZoomWidget.ts +427 -427
- package/src/Shape.css +3 -3
- package/src/Shape.ts +186 -186
- package/src/Surface.css +35 -35
- package/src/Surface.ts +364 -364
- package/src/Text.css +4 -4
- package/src/Text.ts +131 -131
- package/src/TextBox.css +4 -4
- package/src/TextBox.ts +183 -183
- package/src/TitleBar.css +114 -114
- package/src/TitleBar.ts +407 -407
- package/src/Transition.ts +45 -45
- package/src/Utility.ts +843 -839
- package/src/Widget.css +8 -8
- package/src/Widget.ts +731 -731
- package/src/WidgetArray.ts +15 -15
- package/src/__package__.ts +3 -3
- package/src/index.ts +55 -55
package/src/ResizeSurface.css
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
.resizeN {
|
|
2
|
-
cursor: ns-resize;
|
|
3
|
-
opacity: 0;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
.resizeNE {
|
|
7
|
-
cursor: ne-resize;
|
|
8
|
-
opacity: 0;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.resizeE {
|
|
12
|
-
cursor: ew-resize;
|
|
13
|
-
opacity: 0;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.resizeSE {
|
|
17
|
-
cursor: se-resize;
|
|
18
|
-
opacity: 0;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.resizeS {
|
|
22
|
-
cursor: ns-resize;
|
|
23
|
-
opacity: 0;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.resizeSW {
|
|
27
|
-
cursor: sw-resize;
|
|
28
|
-
opacity: 0;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.resizeW {
|
|
32
|
-
cursor: ew-resize;
|
|
33
|
-
opacity: 0;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.resizeNW {
|
|
37
|
-
cursor: nw-resize;
|
|
38
|
-
opacity: 0;
|
|
39
|
-
}
|
|
1
|
+
.resizeN {
|
|
2
|
+
cursor: ns-resize;
|
|
3
|
+
opacity: 0;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.resizeNE {
|
|
7
|
+
cursor: ne-resize;
|
|
8
|
+
opacity: 0;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.resizeE {
|
|
12
|
+
cursor: ew-resize;
|
|
13
|
+
opacity: 0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.resizeSE {
|
|
17
|
+
cursor: se-resize;
|
|
18
|
+
opacity: 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.resizeS {
|
|
22
|
+
cursor: ns-resize;
|
|
23
|
+
opacity: 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.resizeSW {
|
|
27
|
+
cursor: sw-resize;
|
|
28
|
+
opacity: 0;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.resizeW {
|
|
32
|
+
cursor: ew-resize;
|
|
33
|
+
opacity: 0;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.resizeNW {
|
|
37
|
+
cursor: nw-resize;
|
|
38
|
+
opacity: 0;
|
|
39
|
+
}
|
package/src/ResizeSurface.ts
CHANGED
|
@@ -1,225 +1,225 @@
|
|
|
1
|
-
import { dispatch as d3Dispatch } from "d3-dispatch";
|
|
2
|
-
import { drag as d3Drag } from "d3-drag";
|
|
3
|
-
import { event as d3Event, select as d3Select } from "d3-selection";
|
|
4
|
-
import { Surface } from "./Surface.ts";
|
|
5
|
-
|
|
6
|
-
import "../src/ResizeSurface.css";
|
|
7
|
-
|
|
8
|
-
export class ResizeSurface extends Surface {
|
|
9
|
-
|
|
10
|
-
protected handleWidth;
|
|
11
|
-
protected handles;
|
|
12
|
-
protected dispatch;
|
|
13
|
-
protected drag;
|
|
14
|
-
protected _domNode;
|
|
15
|
-
protected _dragHandlePos;
|
|
16
|
-
protected _dragStartPos;
|
|
17
|
-
protected _dragStartSize;
|
|
18
|
-
protected _prevPosSize;
|
|
19
|
-
protected _textPosSize;
|
|
20
|
-
protected _iconPosSize;
|
|
21
|
-
|
|
22
|
-
constructor() {
|
|
23
|
-
super();
|
|
24
|
-
|
|
25
|
-
this.handleWidth = 8;
|
|
26
|
-
this.handles = [{ loc: "NW" }, { loc: "N" }, { loc: "NE" }, { loc: "E" }, { loc: "SE" }, { loc: "S" }, { loc: "SW" }, { loc: "W" }];
|
|
27
|
-
|
|
28
|
-
const context = this;
|
|
29
|
-
this.dispatch = d3Dispatch("sizestart", "size", "sizeend");
|
|
30
|
-
this.drag = d3Drag()
|
|
31
|
-
.subject(function (d) { return d; })
|
|
32
|
-
;
|
|
33
|
-
this.drag
|
|
34
|
-
.on("start", function (d) {
|
|
35
|
-
context.dispatch.call("sizestart", context, d.loc);
|
|
36
|
-
if (context.allowResize()) {
|
|
37
|
-
d3Event.sourceEvent.stopPropagation();
|
|
38
|
-
context._dragHandlePos = { x: d.x, y: d.y };
|
|
39
|
-
context._dragStartPos = context.pos();
|
|
40
|
-
context._dragStartSize = context.size();
|
|
41
|
-
context._prevPosSize = {
|
|
42
|
-
x: context._dragStartPos.x,
|
|
43
|
-
y: context._dragStartPos.y,
|
|
44
|
-
width: context._dragStartSize.width,
|
|
45
|
-
height: context._dragStartSize.height
|
|
46
|
-
};
|
|
47
|
-
context._textPosSize = context._textWidget.getBBox(true);
|
|
48
|
-
context._iconPosSize = context._iconWidget.getBBox(true);
|
|
49
|
-
context.showContent(false);
|
|
50
|
-
}
|
|
51
|
-
})
|
|
52
|
-
.on("drag", function (d) {
|
|
53
|
-
if (context.allowResize()) {
|
|
54
|
-
d3Event.sourceEvent.stopPropagation();
|
|
55
|
-
const _dx = d3Event.x - context._dragHandlePos.x;
|
|
56
|
-
const _dy = d3Event.y - context._dragHandlePos.y;
|
|
57
|
-
const delta = { x: 0, y: 0, w: 0, h: 0 };
|
|
58
|
-
switch (d.loc) {
|
|
59
|
-
case "NW":
|
|
60
|
-
delta.x = _dx / 2;
|
|
61
|
-
delta.w = -_dx;
|
|
62
|
-
/* falls through */
|
|
63
|
-
case "N":
|
|
64
|
-
delta.y = _dy / 2;
|
|
65
|
-
delta.h = -_dy;
|
|
66
|
-
break;
|
|
67
|
-
case "NE":
|
|
68
|
-
delta.y = _dy / 2;
|
|
69
|
-
delta.h = -_dy;
|
|
70
|
-
/* falls through */
|
|
71
|
-
case "E":
|
|
72
|
-
delta.x = _dx / 2;
|
|
73
|
-
delta.w = _dx;
|
|
74
|
-
break;
|
|
75
|
-
case "SE":
|
|
76
|
-
delta.x = _dx / 2;
|
|
77
|
-
delta.w = _dx;
|
|
78
|
-
/* falls through */
|
|
79
|
-
case "S":
|
|
80
|
-
delta.y = _dy / 2;
|
|
81
|
-
delta.h = _dy;
|
|
82
|
-
break;
|
|
83
|
-
case "SW":
|
|
84
|
-
delta.y = _dy / 2;
|
|
85
|
-
delta.h = _dy;
|
|
86
|
-
/* falls through */
|
|
87
|
-
case "W":
|
|
88
|
-
delta.x = _dx / 2;
|
|
89
|
-
delta.w = -_dx;
|
|
90
|
-
break;
|
|
91
|
-
}
|
|
92
|
-
const posSize = {
|
|
93
|
-
x: context._dragStartPos.x + delta.x,
|
|
94
|
-
y: context._dragStartPos.y + delta.y,
|
|
95
|
-
width: context._dragStartSize.width + delta.w,
|
|
96
|
-
height: context._dragStartSize.height + delta.h
|
|
97
|
-
};
|
|
98
|
-
if (posSize.width < context._iconPosSize.width * 2 + context._textPosSize.width) {
|
|
99
|
-
posSize.x = context._prevPosSize.x;
|
|
100
|
-
posSize.width = context._prevPosSize.width;
|
|
101
|
-
}
|
|
102
|
-
if (posSize.height < context._textPosSize.height + 48) {
|
|
103
|
-
posSize.y = context._prevPosSize.y;
|
|
104
|
-
posSize.height = context._prevPosSize.height;
|
|
105
|
-
}
|
|
106
|
-
context
|
|
107
|
-
.pos({ x: posSize.x, y: posSize.y })
|
|
108
|
-
.size({ width: posSize.width, height: posSize.height })
|
|
109
|
-
.render()
|
|
110
|
-
.getBBox(true)
|
|
111
|
-
;
|
|
112
|
-
context.dispatch.call("size", context, d.loc);
|
|
113
|
-
context._prevPosSize = posSize;
|
|
114
|
-
}
|
|
115
|
-
})
|
|
116
|
-
.on("end", function (d) {
|
|
117
|
-
if (context.allowResize()) {
|
|
118
|
-
d3Event.sourceEvent.stopPropagation();
|
|
119
|
-
context
|
|
120
|
-
.showContent(true)
|
|
121
|
-
.render()
|
|
122
|
-
;
|
|
123
|
-
context._containerWidget.getBBox(true);
|
|
124
|
-
context._titleRectWidget.getBBox(true);
|
|
125
|
-
context.dispatch.call("sizeend", context, d.loc);
|
|
126
|
-
}
|
|
127
|
-
})
|
|
128
|
-
;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
move(_) {
|
|
132
|
-
const retVal = super.move.apply(this, arguments);
|
|
133
|
-
this.updateHandles(this._domNode, this._element);
|
|
134
|
-
return retVal;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
update(domNode, element) {
|
|
138
|
-
super.update(domNode, element);
|
|
139
|
-
this.updateHandles(domNode, element);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
updateHandles(_domNode, _element) {
|
|
143
|
-
const sizeHandles = this._placeholderElement.selectAll("rect").data(this.handles, function (d) { return d.loc; });
|
|
144
|
-
const sizeHandlesEnter = sizeHandles.enter().append("rect")
|
|
145
|
-
.attr("class", function (d) { return "resize" + d.loc; })
|
|
146
|
-
.call(this.drag)
|
|
147
|
-
;
|
|
148
|
-
|
|
149
|
-
const l = this._pos.x + this._containerWidget._pos.x - this._containerWidget.width() / 2;
|
|
150
|
-
const t = this._pos.y + this._titleRectWidget._pos.y - this._titleRectWidget.height() / 2;
|
|
151
|
-
const r = this._pos.x + this._containerWidget._pos.x + this._containerWidget.width() / 2;
|
|
152
|
-
const b = this._pos.y + this._containerWidget._pos.y + this._containerWidget.height() / 2;
|
|
153
|
-
const w = r - l;
|
|
154
|
-
const h = b - t;
|
|
155
|
-
const context = this;
|
|
156
|
-
sizeHandlesEnter.merge(sizeHandles)
|
|
157
|
-
.each(function (d) {
|
|
158
|
-
switch (d.loc) {
|
|
159
|
-
case "NW":
|
|
160
|
-
d.x = l - context.handleWidth / 2;
|
|
161
|
-
d.y = t - context.handleWidth / 2;
|
|
162
|
-
d.width = context.handleWidth;
|
|
163
|
-
d.height = context.handleWidth;
|
|
164
|
-
break;
|
|
165
|
-
case "N":
|
|
166
|
-
d.x = l + context.handleWidth / 2;
|
|
167
|
-
d.y = t - context.handleWidth / 2;
|
|
168
|
-
d.width = w - context.handleWidth;
|
|
169
|
-
d.height = context.handleWidth;
|
|
170
|
-
break;
|
|
171
|
-
case "NE":
|
|
172
|
-
d.x = r - context.handleWidth / 2;
|
|
173
|
-
d.y = t - context.handleWidth / 2;
|
|
174
|
-
d.width = context.handleWidth;
|
|
175
|
-
d.height = context.handleWidth;
|
|
176
|
-
break;
|
|
177
|
-
case "E":
|
|
178
|
-
d.x = r - context.handleWidth / 2;
|
|
179
|
-
d.y = t + context.handleWidth / 2;
|
|
180
|
-
d.width = context.handleWidth;
|
|
181
|
-
d.height = h - context.handleWidth;
|
|
182
|
-
break;
|
|
183
|
-
case "SE":
|
|
184
|
-
d.x = r - context.handleWidth / 2;
|
|
185
|
-
d.y = b - context.handleWidth / 2;
|
|
186
|
-
d.width = context.handleWidth;
|
|
187
|
-
d.height = context.handleWidth;
|
|
188
|
-
break;
|
|
189
|
-
case "S":
|
|
190
|
-
d.x = l + context.handleWidth / 2;
|
|
191
|
-
d.y = b - context.handleWidth / 2;
|
|
192
|
-
d.width = w - context.handleWidth;
|
|
193
|
-
d.height = context.handleWidth;
|
|
194
|
-
break;
|
|
195
|
-
case "SW":
|
|
196
|
-
d.x = l - context.handleWidth / 2;
|
|
197
|
-
d.y = b - context.handleWidth / 2;
|
|
198
|
-
d.width = context.handleWidth;
|
|
199
|
-
d.height = context.handleWidth;
|
|
200
|
-
break;
|
|
201
|
-
case "W":
|
|
202
|
-
d.x = l - context.handleWidth / 2;
|
|
203
|
-
d.y = t + context.handleWidth / 2;
|
|
204
|
-
d.width = context.handleWidth;
|
|
205
|
-
d.height = h - context.handleWidth;
|
|
206
|
-
break;
|
|
207
|
-
}
|
|
208
|
-
d3Select(this)
|
|
209
|
-
.attr("x", d.x)
|
|
210
|
-
.attr("y", d.y)
|
|
211
|
-
.attr("width", d.width)
|
|
212
|
-
.attr("height", d.height)
|
|
213
|
-
;
|
|
214
|
-
})
|
|
215
|
-
;
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
ResizeSurface.prototype._class += " common_ResizeSurface";
|
|
219
|
-
|
|
220
|
-
export interface ResizeSurface {
|
|
221
|
-
allowResize(): boolean;
|
|
222
|
-
allowResize(_: boolean): this;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
ResizeSurface.prototype.publish("allowResize", true, "boolean", "Sets if surface can be resized", null, { tags: ["Private", "Shared"] });
|
|
1
|
+
import { dispatch as d3Dispatch } from "d3-dispatch";
|
|
2
|
+
import { drag as d3Drag } from "d3-drag";
|
|
3
|
+
import { event as d3Event, select as d3Select } from "d3-selection";
|
|
4
|
+
import { Surface } from "./Surface.ts";
|
|
5
|
+
|
|
6
|
+
import "../src/ResizeSurface.css";
|
|
7
|
+
|
|
8
|
+
export class ResizeSurface extends Surface {
|
|
9
|
+
|
|
10
|
+
protected handleWidth;
|
|
11
|
+
protected handles;
|
|
12
|
+
protected dispatch;
|
|
13
|
+
protected drag;
|
|
14
|
+
protected _domNode;
|
|
15
|
+
protected _dragHandlePos;
|
|
16
|
+
protected _dragStartPos;
|
|
17
|
+
protected _dragStartSize;
|
|
18
|
+
protected _prevPosSize;
|
|
19
|
+
protected _textPosSize;
|
|
20
|
+
protected _iconPosSize;
|
|
21
|
+
|
|
22
|
+
constructor() {
|
|
23
|
+
super();
|
|
24
|
+
|
|
25
|
+
this.handleWidth = 8;
|
|
26
|
+
this.handles = [{ loc: "NW" }, { loc: "N" }, { loc: "NE" }, { loc: "E" }, { loc: "SE" }, { loc: "S" }, { loc: "SW" }, { loc: "W" }];
|
|
27
|
+
|
|
28
|
+
const context = this;
|
|
29
|
+
this.dispatch = d3Dispatch("sizestart", "size", "sizeend");
|
|
30
|
+
this.drag = d3Drag()
|
|
31
|
+
.subject(function (d) { return d; })
|
|
32
|
+
;
|
|
33
|
+
this.drag
|
|
34
|
+
.on("start", function (d) {
|
|
35
|
+
context.dispatch.call("sizestart", context, d.loc);
|
|
36
|
+
if (context.allowResize()) {
|
|
37
|
+
d3Event.sourceEvent.stopPropagation();
|
|
38
|
+
context._dragHandlePos = { x: d.x, y: d.y };
|
|
39
|
+
context._dragStartPos = context.pos();
|
|
40
|
+
context._dragStartSize = context.size();
|
|
41
|
+
context._prevPosSize = {
|
|
42
|
+
x: context._dragStartPos.x,
|
|
43
|
+
y: context._dragStartPos.y,
|
|
44
|
+
width: context._dragStartSize.width,
|
|
45
|
+
height: context._dragStartSize.height
|
|
46
|
+
};
|
|
47
|
+
context._textPosSize = context._textWidget.getBBox(true);
|
|
48
|
+
context._iconPosSize = context._iconWidget.getBBox(true);
|
|
49
|
+
context.showContent(false);
|
|
50
|
+
}
|
|
51
|
+
})
|
|
52
|
+
.on("drag", function (d) {
|
|
53
|
+
if (context.allowResize()) {
|
|
54
|
+
d3Event.sourceEvent.stopPropagation();
|
|
55
|
+
const _dx = d3Event.x - context._dragHandlePos.x;
|
|
56
|
+
const _dy = d3Event.y - context._dragHandlePos.y;
|
|
57
|
+
const delta = { x: 0, y: 0, w: 0, h: 0 };
|
|
58
|
+
switch (d.loc) {
|
|
59
|
+
case "NW":
|
|
60
|
+
delta.x = _dx / 2;
|
|
61
|
+
delta.w = -_dx;
|
|
62
|
+
/* falls through */
|
|
63
|
+
case "N":
|
|
64
|
+
delta.y = _dy / 2;
|
|
65
|
+
delta.h = -_dy;
|
|
66
|
+
break;
|
|
67
|
+
case "NE":
|
|
68
|
+
delta.y = _dy / 2;
|
|
69
|
+
delta.h = -_dy;
|
|
70
|
+
/* falls through */
|
|
71
|
+
case "E":
|
|
72
|
+
delta.x = _dx / 2;
|
|
73
|
+
delta.w = _dx;
|
|
74
|
+
break;
|
|
75
|
+
case "SE":
|
|
76
|
+
delta.x = _dx / 2;
|
|
77
|
+
delta.w = _dx;
|
|
78
|
+
/* falls through */
|
|
79
|
+
case "S":
|
|
80
|
+
delta.y = _dy / 2;
|
|
81
|
+
delta.h = _dy;
|
|
82
|
+
break;
|
|
83
|
+
case "SW":
|
|
84
|
+
delta.y = _dy / 2;
|
|
85
|
+
delta.h = _dy;
|
|
86
|
+
/* falls through */
|
|
87
|
+
case "W":
|
|
88
|
+
delta.x = _dx / 2;
|
|
89
|
+
delta.w = -_dx;
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
const posSize = {
|
|
93
|
+
x: context._dragStartPos.x + delta.x,
|
|
94
|
+
y: context._dragStartPos.y + delta.y,
|
|
95
|
+
width: context._dragStartSize.width + delta.w,
|
|
96
|
+
height: context._dragStartSize.height + delta.h
|
|
97
|
+
};
|
|
98
|
+
if (posSize.width < context._iconPosSize.width * 2 + context._textPosSize.width) {
|
|
99
|
+
posSize.x = context._prevPosSize.x;
|
|
100
|
+
posSize.width = context._prevPosSize.width;
|
|
101
|
+
}
|
|
102
|
+
if (posSize.height < context._textPosSize.height + 48) {
|
|
103
|
+
posSize.y = context._prevPosSize.y;
|
|
104
|
+
posSize.height = context._prevPosSize.height;
|
|
105
|
+
}
|
|
106
|
+
context
|
|
107
|
+
.pos({ x: posSize.x, y: posSize.y })
|
|
108
|
+
.size({ width: posSize.width, height: posSize.height })
|
|
109
|
+
.render()
|
|
110
|
+
.getBBox(true)
|
|
111
|
+
;
|
|
112
|
+
context.dispatch.call("size", context, d.loc);
|
|
113
|
+
context._prevPosSize = posSize;
|
|
114
|
+
}
|
|
115
|
+
})
|
|
116
|
+
.on("end", function (d) {
|
|
117
|
+
if (context.allowResize()) {
|
|
118
|
+
d3Event.sourceEvent.stopPropagation();
|
|
119
|
+
context
|
|
120
|
+
.showContent(true)
|
|
121
|
+
.render()
|
|
122
|
+
;
|
|
123
|
+
context._containerWidget.getBBox(true);
|
|
124
|
+
context._titleRectWidget.getBBox(true);
|
|
125
|
+
context.dispatch.call("sizeend", context, d.loc);
|
|
126
|
+
}
|
|
127
|
+
})
|
|
128
|
+
;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
move(_) {
|
|
132
|
+
const retVal = super.move.apply(this, arguments);
|
|
133
|
+
this.updateHandles(this._domNode, this._element);
|
|
134
|
+
return retVal;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
update(domNode, element) {
|
|
138
|
+
super.update(domNode, element);
|
|
139
|
+
this.updateHandles(domNode, element);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
updateHandles(_domNode, _element) {
|
|
143
|
+
const sizeHandles = this._placeholderElement.selectAll("rect").data(this.handles, function (d) { return d.loc; });
|
|
144
|
+
const sizeHandlesEnter = sizeHandles.enter().append("rect")
|
|
145
|
+
.attr("class", function (d) { return "resize" + d.loc; })
|
|
146
|
+
.call(this.drag)
|
|
147
|
+
;
|
|
148
|
+
|
|
149
|
+
const l = this._pos.x + this._containerWidget._pos.x - this._containerWidget.width() / 2;
|
|
150
|
+
const t = this._pos.y + this._titleRectWidget._pos.y - this._titleRectWidget.height() / 2;
|
|
151
|
+
const r = this._pos.x + this._containerWidget._pos.x + this._containerWidget.width() / 2;
|
|
152
|
+
const b = this._pos.y + this._containerWidget._pos.y + this._containerWidget.height() / 2;
|
|
153
|
+
const w = r - l;
|
|
154
|
+
const h = b - t;
|
|
155
|
+
const context = this;
|
|
156
|
+
sizeHandlesEnter.merge(sizeHandles)
|
|
157
|
+
.each(function (d) {
|
|
158
|
+
switch (d.loc) {
|
|
159
|
+
case "NW":
|
|
160
|
+
d.x = l - context.handleWidth / 2;
|
|
161
|
+
d.y = t - context.handleWidth / 2;
|
|
162
|
+
d.width = context.handleWidth;
|
|
163
|
+
d.height = context.handleWidth;
|
|
164
|
+
break;
|
|
165
|
+
case "N":
|
|
166
|
+
d.x = l + context.handleWidth / 2;
|
|
167
|
+
d.y = t - context.handleWidth / 2;
|
|
168
|
+
d.width = w - context.handleWidth;
|
|
169
|
+
d.height = context.handleWidth;
|
|
170
|
+
break;
|
|
171
|
+
case "NE":
|
|
172
|
+
d.x = r - context.handleWidth / 2;
|
|
173
|
+
d.y = t - context.handleWidth / 2;
|
|
174
|
+
d.width = context.handleWidth;
|
|
175
|
+
d.height = context.handleWidth;
|
|
176
|
+
break;
|
|
177
|
+
case "E":
|
|
178
|
+
d.x = r - context.handleWidth / 2;
|
|
179
|
+
d.y = t + context.handleWidth / 2;
|
|
180
|
+
d.width = context.handleWidth;
|
|
181
|
+
d.height = h - context.handleWidth;
|
|
182
|
+
break;
|
|
183
|
+
case "SE":
|
|
184
|
+
d.x = r - context.handleWidth / 2;
|
|
185
|
+
d.y = b - context.handleWidth / 2;
|
|
186
|
+
d.width = context.handleWidth;
|
|
187
|
+
d.height = context.handleWidth;
|
|
188
|
+
break;
|
|
189
|
+
case "S":
|
|
190
|
+
d.x = l + context.handleWidth / 2;
|
|
191
|
+
d.y = b - context.handleWidth / 2;
|
|
192
|
+
d.width = w - context.handleWidth;
|
|
193
|
+
d.height = context.handleWidth;
|
|
194
|
+
break;
|
|
195
|
+
case "SW":
|
|
196
|
+
d.x = l - context.handleWidth / 2;
|
|
197
|
+
d.y = b - context.handleWidth / 2;
|
|
198
|
+
d.width = context.handleWidth;
|
|
199
|
+
d.height = context.handleWidth;
|
|
200
|
+
break;
|
|
201
|
+
case "W":
|
|
202
|
+
d.x = l - context.handleWidth / 2;
|
|
203
|
+
d.y = t + context.handleWidth / 2;
|
|
204
|
+
d.width = context.handleWidth;
|
|
205
|
+
d.height = h - context.handleWidth;
|
|
206
|
+
break;
|
|
207
|
+
}
|
|
208
|
+
d3Select(this)
|
|
209
|
+
.attr("x", d.x)
|
|
210
|
+
.attr("y", d.y)
|
|
211
|
+
.attr("width", d.width)
|
|
212
|
+
.attr("height", d.height)
|
|
213
|
+
;
|
|
214
|
+
})
|
|
215
|
+
;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
ResizeSurface.prototype._class += " common_ResizeSurface";
|
|
219
|
+
|
|
220
|
+
export interface ResizeSurface {
|
|
221
|
+
allowResize(): boolean;
|
|
222
|
+
allowResize(_: boolean): this;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
ResizeSurface.prototype.publish("allowResize", true, "boolean", "Sets if surface can be resized", null, { tags: ["Private", "Shared"] });
|