plotboilerplate 1.27.1 → 1.28.1
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/dist/index.esm.js +135 -36
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.esm.min.js.map +1 -1
- package/dist/plotboilerplate.browser.min.js +1 -1
- package/dist/plotboilerplate.browser.min.js.map +1 -1
- package/dist/plotboilerplate.js +96 -17
- package/dist/plotboilerplate.min.js +1 -1
- package/package.json +2 -1
- package/src/cjs/PlotBoilerplate.d.ts +11 -1
- package/src/cjs/PlotBoilerplate.js +23 -7
- package/src/cjs/PlotBoilerplate.js.map +1 -1
- package/src/cjs/VertexListeners.d.ts +2 -1
- package/src/cjs/VertexListeners.js +5 -1
- package/src/cjs/VertexListeners.js.map +1 -1
- package/src/cjs/draw.d.ts +18 -2
- package/src/cjs/draw.js +21 -2
- package/src/cjs/draw.js.map +1 -1
- package/src/cjs/drawgl.d.ts +18 -3
- package/src/cjs/drawgl.js +19 -2
- package/src/cjs/drawgl.js.map +1 -1
- package/src/cjs/drawutilssvg.d.ts +19 -1
- package/src/cjs/drawutilssvg.js +28 -5
- package/src/cjs/drawutilssvg.js.map +1 -1
- package/src/cjs/interfaces/DrawLib.d.ts +18 -1
- package/src/cjs/interfaces/DrawLib.js +2 -0
- package/src/cjs/interfaces/DrawLib.js.map +1 -1
- package/src/cjs/utils/Params.d.ts +3 -2
- package/src/cjs/utils/Params.js +11 -3
- package/src/cjs/utils/Params.js.map +1 -1
- package/src/cjs/utils/WebColors.d.ts +2 -1
- package/src/cjs/utils/WebColors.js +15 -2
- package/src/cjs/utils/WebColors.js.map +1 -1
- package/src/cjs/utils/algorithms/HobbyPath.js +13 -16
- package/src/cjs/utils/algorithms/HobbyPath.js.map +1 -1
- package/src/cjs/utils/helpers/BezierResizeHelper.d.ts +144 -0
- package/src/cjs/utils/helpers/BezierResizeHelper.js +319 -0
- package/src/cjs/utils/helpers/BezierResizeHelper.js.map +1 -0
- package/src/esm/PlotBoilerplate.d.ts +11 -1
- package/src/esm/PlotBoilerplate.js +23 -7
- package/src/esm/PlotBoilerplate.js.map +1 -1
- package/src/esm/VertexListeners.d.ts +2 -1
- package/src/esm/VertexListeners.js +5 -1
- package/src/esm/VertexListeners.js.map +1 -1
- package/src/esm/draw.d.ts +18 -2
- package/src/esm/draw.js +21 -2
- package/src/esm/draw.js.map +1 -1
- package/src/esm/drawgl.d.ts +18 -3
- package/src/esm/drawgl.js +19 -2
- package/src/esm/drawgl.js.map +1 -1
- package/src/esm/drawutilssvg.d.ts +19 -1
- package/src/esm/drawutilssvg.js +28 -5
- package/src/esm/drawutilssvg.js.map +1 -1
- package/src/esm/interfaces/DrawLib.d.ts +18 -1
- package/src/esm/interfaces/DrawLib.js +2 -0
- package/src/esm/interfaces/DrawLib.js.map +1 -1
- package/src/esm/utils/Params.d.ts +3 -2
- package/src/esm/utils/Params.js +11 -3
- package/src/esm/utils/Params.js.map +1 -1
- package/src/esm/utils/WebColors.d.ts +2 -1
- package/src/esm/utils/WebColors.js +15 -2
- package/src/esm/utils/WebColors.js.map +1 -1
- package/src/esm/utils/algorithms/HobbyPath.js +13 -16
- package/src/esm/utils/algorithms/HobbyPath.js.map +1 -1
- package/src/esm/utils/helpers/BezierResizeHelper.d.ts +144 -0
- package/src/esm/utils/helpers/BezierResizeHelper.js +314 -0
- package/src/esm/utils/helpers/BezierResizeHelper.js.map +1 -0
- package/src/ts/PlotBoilerplate.ts +37 -11
- package/src/ts/VertexListeners.ts +5 -1
- package/src/ts/draw.ts +32 -2
- package/src/ts/drawgl.ts +38 -3
- package/src/ts/drawutilssvg.ts +33 -6
- package/src/ts/interfaces/DrawLib.ts +19 -1
- package/src/ts/utils/Params.ts +11 -3
- package/src/ts/utils/WebColors.ts +15 -2
- package/src/ts/utils/algorithms/HobbyPath.ts +248 -272
- package/src/ts/utils/helpers/BezierResizeHelper.ts +390 -0
- package/src/cjs/utils/_gup.js_ +0 -13
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A helper to resize bezier paths in horizontal and vertical orientation.
|
|
3
|
+
*
|
|
4
|
+
* @requires PlotBoilerplate
|
|
5
|
+
* @requires BezierPath
|
|
6
|
+
* @requires Vertex
|
|
7
|
+
*
|
|
8
|
+
* @author Ikaros Kappler
|
|
9
|
+
* @date 2026-04-04 Copied from the ngdg project, made minor type adaptions.
|
|
10
|
+
* @version 1.2.0
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
import { Vertex } from "../../Vertex";
|
|
14
|
+
// A closure to hide helper functions.
|
|
15
|
+
export class BezierResizeHelper {
|
|
16
|
+
/**
|
|
17
|
+
* The constructor.
|
|
18
|
+
*
|
|
19
|
+
* @param {PlotBoilerplate} pb
|
|
20
|
+
* @param {BezierPath} bezierPath
|
|
21
|
+
* @param {function} updateCallback
|
|
22
|
+
*/
|
|
23
|
+
constructor(pb, bezierPath, updateCallback) {
|
|
24
|
+
this.pb = pb;
|
|
25
|
+
this.bezierPath = bezierPath;
|
|
26
|
+
// @public
|
|
27
|
+
this.topResizeHandle = new Vertex(0, 0);
|
|
28
|
+
this.leftResizeHandle = new Vertex(0, 0);
|
|
29
|
+
this.bottomResizeHandle = new Vertex(0, 0);
|
|
30
|
+
this.rightResizeHandle = new Vertex(0, 0);
|
|
31
|
+
// @private
|
|
32
|
+
this.topHandleDragStartPosition = null;
|
|
33
|
+
this.leftHandleDragStartPosition = null;
|
|
34
|
+
this.bottomHandleDragStartPosition = null;
|
|
35
|
+
this.rightHandleDragStartPosition = null;
|
|
36
|
+
this.__listeners = this.__installListeners(this, pb, bezierPath, updateCallback);
|
|
37
|
+
this.updateResizeHandles();
|
|
38
|
+
}
|
|
39
|
+
draw(draw, fill) {
|
|
40
|
+
this.drawHandleLines(draw, fill, "grey");
|
|
41
|
+
this.drawTriangles(draw, fill, "rgba(0,192,192,1.0)");
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Call this method from the outside to see active helper lines for those edges
|
|
45
|
+
* that are currently dragged.
|
|
46
|
+
*
|
|
47
|
+
* @param {DrawLib<any>} draw
|
|
48
|
+
* @param {DrawLib<any>} fill
|
|
49
|
+
* @param {string} lineColor
|
|
50
|
+
*/
|
|
51
|
+
drawHandleLines(draw, fill, lineColor) {
|
|
52
|
+
// console.log("drawResizeHandleLines", bezierResizer.verticalResizeHandleDragStartPosition);
|
|
53
|
+
var bounds = this.bezierPath.getBounds();
|
|
54
|
+
if (this.topHandleDragStartPosition) {
|
|
55
|
+
draw.line({ x: bounds.min.x, y: this.topResizeHandle.y }, { x: bounds.max.x, y: this.topResizeHandle.y }, lineColor, 1.0, {
|
|
56
|
+
dashOffset: 0.0,
|
|
57
|
+
dashArray: [5, 5]
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
if (this.leftHandleDragStartPosition) {
|
|
61
|
+
draw.line({ x: this.leftResizeHandle.x, y: bounds.min.y }, { x: this.leftResizeHandle.x, y: bounds.max.y }, lineColor, 1.0, { dashOffset: 0.0, dashArray: [5, 5] });
|
|
62
|
+
}
|
|
63
|
+
if (this.bottomHandleDragStartPosition) {
|
|
64
|
+
draw.line({ x: bounds.min.x, y: this.bottomResizeHandle.y }, { x: bounds.max.x, y: this.bottomResizeHandle.y }, lineColor, 1.0, {
|
|
65
|
+
dashOffset: 0.0,
|
|
66
|
+
dashArray: [5, 5]
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
if (this.rightHandleDragStartPosition) {
|
|
70
|
+
draw.line({ x: this.rightResizeHandle.x, y: bounds.min.y }, { x: this.rightResizeHandle.x, y: bounds.max.y }, lineColor, 1.0, { dashOffset: 0.0, dashArray: [5, 5] });
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
drawTriangles(draw, _fill, color) {
|
|
74
|
+
// this.__drawUpTriangle(draw, this.topResizeHandle, color);
|
|
75
|
+
// this.__drawDownTriangle(draw, this.bottomResizeHandle, color);
|
|
76
|
+
// this.__drawLeftTriangle(draw, this.leftResizeHandle, color);
|
|
77
|
+
// this.__drawRightTriangle(draw, this.rightResizeHandle, color);
|
|
78
|
+
this.drawTopTriangle(draw, _fill, color);
|
|
79
|
+
this.drawLeftTriangle(draw, _fill, color);
|
|
80
|
+
this.drawBottomTriangle(draw, _fill, color);
|
|
81
|
+
this.drawRightTriangle(draw, _fill, color);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Draws an up-trinangle at the top handle position.
|
|
85
|
+
*
|
|
86
|
+
* @param draw
|
|
87
|
+
* @param position
|
|
88
|
+
* @param color
|
|
89
|
+
*/
|
|
90
|
+
drawTopTriangle(draw, _fill, color) {
|
|
91
|
+
this.__drawUpTriangle(draw, _fill, this.topResizeHandle, color);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Draws an up-trinangle at the top handle position.
|
|
95
|
+
*
|
|
96
|
+
* @param draw
|
|
97
|
+
* @param position
|
|
98
|
+
* @param color
|
|
99
|
+
*/
|
|
100
|
+
drawLeftTriangle(draw, _fill, color) {
|
|
101
|
+
this.__drawLeftTriangle(draw, _fill, this.leftResizeHandle, color);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Draws an up-trinangle at the top handle position.
|
|
105
|
+
*
|
|
106
|
+
* @param draw
|
|
107
|
+
* @param position
|
|
108
|
+
* @param color
|
|
109
|
+
*/
|
|
110
|
+
drawBottomTriangle(draw, _fill, color) {
|
|
111
|
+
this.__drawDownTriangle(draw, _fill, this.bottomResizeHandle, color);
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Draws an right-trinangle at the top handle position.
|
|
115
|
+
*
|
|
116
|
+
* @param draw
|
|
117
|
+
* @param position
|
|
118
|
+
* @param color
|
|
119
|
+
*/
|
|
120
|
+
drawRightTriangle(draw, _fill, color) {
|
|
121
|
+
this.__drawRightTriangle(draw, _fill, this.rightResizeHandle, color);
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Draws an up-trinangle at the top handle position.
|
|
125
|
+
*
|
|
126
|
+
* @param draw
|
|
127
|
+
* @param position
|
|
128
|
+
* @param color
|
|
129
|
+
*/
|
|
130
|
+
__drawUpTriangle(draw, _fill, position, color) {
|
|
131
|
+
const arrowSize = 6.0;
|
|
132
|
+
const arrowSizeH = arrowSize / this.pb.config.scaleX;
|
|
133
|
+
const arrowSizeV = arrowSize / this.pb.config.scaleY;
|
|
134
|
+
const verts = [
|
|
135
|
+
{ x: position.x - arrowSizeH, y: position.y + arrowSizeV * 0.5 }, // left corner
|
|
136
|
+
{ x: position.x, y: position.y - arrowSizeV }, // up corner
|
|
137
|
+
{ x: position.x + arrowSizeH, y: position.y + arrowSizeV * 0.5 } // right corner
|
|
138
|
+
];
|
|
139
|
+
draw.polyline(verts, false, color, 1.0);
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Draws an left-trinangle at the left handle position.
|
|
143
|
+
*
|
|
144
|
+
* @param draw
|
|
145
|
+
* @param position
|
|
146
|
+
* @param color
|
|
147
|
+
*/
|
|
148
|
+
__drawLeftTriangle(draw, _fill, position, color) {
|
|
149
|
+
const arrowSize = 6.0;
|
|
150
|
+
const arrowSizeH = arrowSize / this.pb.config.scaleX;
|
|
151
|
+
const arrowSizeV = arrowSize / this.pb.config.scaleY;
|
|
152
|
+
const verts = [
|
|
153
|
+
{ x: position.x - arrowSizeH, y: position.y }, // left corner
|
|
154
|
+
{ x: position.x + arrowSizeH * 0.5, y: position.y - arrowSizeV }, // up corner
|
|
155
|
+
{ x: position.x + arrowSizeH * 0.5, y: position.y + arrowSizeV } // down corner
|
|
156
|
+
];
|
|
157
|
+
draw.polyline(verts, false, color, 1.0);
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Draws a down-trinangle at the top handle position.
|
|
161
|
+
*
|
|
162
|
+
* @param draw
|
|
163
|
+
* @param position
|
|
164
|
+
* @param color
|
|
165
|
+
*/
|
|
166
|
+
__drawDownTriangle(draw, _fill, position, color) {
|
|
167
|
+
const arrowSize = 6.0;
|
|
168
|
+
const arrowSizeH = arrowSize / this.pb.config.scaleX;
|
|
169
|
+
const arrowSizeV = arrowSize / this.pb.config.scaleY;
|
|
170
|
+
const verts = [
|
|
171
|
+
{ x: position.x + arrowSizeH, y: position.y - arrowSizeV * 0.5 }, // right corner
|
|
172
|
+
{ x: position.x, y: position.y + arrowSizeV }, // down corner
|
|
173
|
+
{ x: position.x - arrowSizeH, y: position.y - arrowSizeV * 0.5 } // left corner
|
|
174
|
+
];
|
|
175
|
+
draw.polyline(verts, false, color, 1.0);
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Draws an left-trinangle at the left handle position.
|
|
179
|
+
*
|
|
180
|
+
* @param draw
|
|
181
|
+
* @param position
|
|
182
|
+
* @param color
|
|
183
|
+
*/
|
|
184
|
+
__drawRightTriangle(draw, _fill, position, color) {
|
|
185
|
+
const arrowSize = 6.0;
|
|
186
|
+
const arrowSizeH = arrowSize / this.pb.config.scaleX;
|
|
187
|
+
const arrowSizeV = arrowSize / this.pb.config.scaleY;
|
|
188
|
+
const verts = [
|
|
189
|
+
{ x: position.x + arrowSizeH, y: position.y }, // left corner
|
|
190
|
+
{ x: position.x - arrowSizeH * 0.5, y: position.y - arrowSizeV }, // up corner
|
|
191
|
+
{ x: position.x - arrowSizeH * 0.5, y: position.y + arrowSizeV } // down corner
|
|
192
|
+
];
|
|
193
|
+
draw.polyline(verts, false, color, 1.0);
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Destroys this helper by removing all previously installed vertex listeners.
|
|
197
|
+
*/
|
|
198
|
+
destroy() {
|
|
199
|
+
this.topResizeHandle.listeners.removeDragStartListener(this.__listeners[0]);
|
|
200
|
+
this.topResizeHandle.listeners.removeDragEndListener(this.__listeners[1]);
|
|
201
|
+
this.leftResizeHandle.listeners.removeDragStartListener(this.__listeners[2]);
|
|
202
|
+
this.leftResizeHandle.listeners.removeDragEndListener(this.__listeners[3]);
|
|
203
|
+
this.bottomResizeHandle.listeners.removeDragStartListener(this.__listeners[4]);
|
|
204
|
+
this.bottomResizeHandle.listeners.removeDragEndListener(this.__listeners[5]);
|
|
205
|
+
this.rightResizeHandle.listeners.removeDragStartListener(this.__listeners[6]);
|
|
206
|
+
this.rightResizeHandle.listeners.removeDragEndListener(this.__listeners[7]);
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Install all required drag-start and drag-end listeners.
|
|
210
|
+
*/
|
|
211
|
+
__installListeners(_self, pb, bezierPath, updateCallback) {
|
|
212
|
+
var listeners = [];
|
|
213
|
+
listeners.push(_self.topResizeHandle.listeners.addDragStartListener(function (e) {
|
|
214
|
+
var relPos = pb.transformMousePosition(e.params.draggedFrom.x, e.params.draggedFrom.y);
|
|
215
|
+
_self.topHandleDragStartPosition = relPos;
|
|
216
|
+
}));
|
|
217
|
+
listeners.push(_self.topResizeHandle.listeners.addDragEndListener(function (e) {
|
|
218
|
+
var relTargetPos = pb.transformMousePosition(e.params.pos.x, e.params.pos.y);
|
|
219
|
+
var targetHeightDifference = _self.topHandleDragStartPosition.y - relTargetPos.y;
|
|
220
|
+
_self.__changePathHeightTop(bezierPath, targetHeightDifference);
|
|
221
|
+
_self.updateResizeHandles();
|
|
222
|
+
_self.topHandleDragStartPosition = null;
|
|
223
|
+
updateCallback();
|
|
224
|
+
}));
|
|
225
|
+
listeners.push(_self.leftResizeHandle.listeners.addDragStartListener(function (e) {
|
|
226
|
+
var relPos = pb.transformMousePosition(e.params.draggedFrom.x, e.params.draggedFrom.y);
|
|
227
|
+
_self.leftHandleDragStartPosition = relPos;
|
|
228
|
+
}));
|
|
229
|
+
listeners.push(_self.leftResizeHandle.listeners.addDragEndListener(function (e) {
|
|
230
|
+
var relTargetPos = pb.transformMousePosition(e.params.pos.x, e.params.pos.y);
|
|
231
|
+
var targetWidthDifference = _self.leftHandleDragStartPosition.x - relTargetPos.x;
|
|
232
|
+
_self.__changePathWidthLeft(bezierPath, targetWidthDifference);
|
|
233
|
+
_self.updateResizeHandles();
|
|
234
|
+
_self.leftHandleDragStartPosition = null;
|
|
235
|
+
updateCallback();
|
|
236
|
+
}));
|
|
237
|
+
listeners.push(_self.bottomResizeHandle.listeners.addDragStartListener(function (e) {
|
|
238
|
+
var relPos = pb.transformMousePosition(e.params.draggedFrom.x, e.params.draggedFrom.y);
|
|
239
|
+
_self.bottomHandleDragStartPosition = relPos;
|
|
240
|
+
}));
|
|
241
|
+
listeners.push(_self.bottomResizeHandle.listeners.addDragEndListener(function (e) {
|
|
242
|
+
var relTargetPos = pb.transformMousePosition(e.params.pos.x, e.params.pos.y);
|
|
243
|
+
var targetHeightDifference = relTargetPos.y - _self.bottomHandleDragStartPosition.y;
|
|
244
|
+
_self.__changePathHeightBottom(bezierPath, targetHeightDifference);
|
|
245
|
+
_self.updateResizeHandles();
|
|
246
|
+
_self.bottomHandleDragStartPosition = null;
|
|
247
|
+
updateCallback();
|
|
248
|
+
}));
|
|
249
|
+
listeners.push(_self.rightResizeHandle.listeners.addDragStartListener(function (e) {
|
|
250
|
+
var relPos = pb.transformMousePosition(e.params.draggedFrom.x, e.params.draggedFrom.y);
|
|
251
|
+
_self.rightHandleDragStartPosition = relPos;
|
|
252
|
+
}));
|
|
253
|
+
listeners.push(_self.rightResizeHandle.listeners.addDragEndListener(function (e) {
|
|
254
|
+
var relTargetPos = pb.transformMousePosition(e.params.pos.x, e.params.pos.y);
|
|
255
|
+
var targetWidthDifference = relTargetPos.x - _self.rightHandleDragStartPosition.x;
|
|
256
|
+
_self.__changePathWidthRight(bezierPath, targetWidthDifference);
|
|
257
|
+
_self.updateResizeHandles();
|
|
258
|
+
_self.rightHandleDragStartPosition = null;
|
|
259
|
+
updateCallback();
|
|
260
|
+
}));
|
|
261
|
+
return listeners;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* @param {BezierPath} bezierPath - The path to update.
|
|
265
|
+
* @param {number} heightAmount - The height difference to apply. Can be positive or negative or zero.
|
|
266
|
+
*/
|
|
267
|
+
__changePathHeightTop(bezierPath, heightAmount) {
|
|
268
|
+
const bounds = bezierPath.getBounds();
|
|
269
|
+
const scaleAnchor = bounds.max;
|
|
270
|
+
const verticalScaleFactor = (bounds.height + heightAmount) / bounds.height;
|
|
271
|
+
bezierPath.scaleXY({ x: 1.0, y: verticalScaleFactor }, scaleAnchor);
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* @param {BezierPath} bezierPath - The path to update.
|
|
275
|
+
* @param {number} widthAmount - The width difference to apply. Can be positive or negative or zero.
|
|
276
|
+
*/
|
|
277
|
+
__changePathWidthLeft(bezierPath, widthAmount) {
|
|
278
|
+
const bounds = bezierPath.getBounds();
|
|
279
|
+
const scaleAnchor = bounds.max;
|
|
280
|
+
const horizontalScaleFactor = (bounds.width + widthAmount) / bounds.width;
|
|
281
|
+
bezierPath.scaleXY({ x: horizontalScaleFactor, y: 1.0 }, scaleAnchor);
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* @param {BezierPath} bezierPath - The path to update.
|
|
285
|
+
* @param {number} heightAmount - The height difference to apply. Can be positive or negative or zero.
|
|
286
|
+
*/
|
|
287
|
+
__changePathHeightBottom(bezierPath, heightAmount) {
|
|
288
|
+
const bounds = bezierPath.getBounds();
|
|
289
|
+
const scaleAnchor = bounds.min;
|
|
290
|
+
const verticalScaleFactor = (bounds.height + heightAmount) / bounds.height;
|
|
291
|
+
bezierPath.scaleXY({ x: 1.0, y: verticalScaleFactor }, scaleAnchor);
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* @param {BezierPath} bezierPath - The path to update.
|
|
295
|
+
* @param {number} widthAmount - The width difference to apply. Can be positive or negative or zero.
|
|
296
|
+
*/
|
|
297
|
+
__changePathWidthRight(bezierPath, widthAmount) {
|
|
298
|
+
const bounds = bezierPath.getBounds();
|
|
299
|
+
const scaleAnchor = bounds.min;
|
|
300
|
+
const horizontalScaleFactor = (bounds.width + widthAmount) / bounds.width;
|
|
301
|
+
bezierPath.scaleXY({ x: horizontalScaleFactor, y: 1.0 }, scaleAnchor);
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Set the handles to the new position after the path was resized.
|
|
305
|
+
*/
|
|
306
|
+
updateResizeHandles() {
|
|
307
|
+
const bounds = this.bezierPath.getBounds();
|
|
308
|
+
this.leftResizeHandle.set(bounds.min.x, bounds.min.y + bounds.height / 2.0);
|
|
309
|
+
this.topResizeHandle.set(bounds.min.x + bounds.width / 2.0, bounds.min.y);
|
|
310
|
+
this.rightResizeHandle.set(bounds.max.x, bounds.min.y + bounds.height / 2.0);
|
|
311
|
+
this.bottomResizeHandle.set(bounds.min.x + bounds.width / 2.0, bounds.max.y);
|
|
312
|
+
}
|
|
313
|
+
} // END class
|
|
314
|
+
//# sourceMappingURL=BezierResizeHelper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BezierResizeHelper.js","sourceRoot":"","sources":["../../../ts/utils/helpers/BezierResizeHelper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAGtC,sCAAsC;AACtC,MAAM,OAAO,kBAAkB;IAe7B;;;;;;OAMG;IACH,YAAY,EAAmB,EAAE,UAAsB,EAAE,cAA0B;QACjF,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAE7B,UAAU;QACV,IAAI,CAAC,eAAe,GAAG,IAAI,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACxC,IAAI,CAAC,gBAAgB,GAAG,IAAI,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACzC,IAAI,CAAC,kBAAkB,GAAG,IAAI,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAC3C,IAAI,CAAC,iBAAiB,GAAG,IAAI,MAAM,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@@ -92,8 +92,9 @@
|
|
|
92
92
|
* @modified 2025-05-07 Moving full vectors now by default when vector point a is moved.
|
|
93
93
|
* @modified 2025-05-20 Applying `lineWith` parameter in the draw routine for vectors (had been missing).
|
|
94
94
|
* @modified 2026-03-13 Changed visibility of `setZoom` and `setOffset` to public. There was no good reason to have the private.
|
|
95
|
+
* @modified 2026-04-04 Added `isInPanningMode` attribute and `isPanning` method.
|
|
95
96
|
*
|
|
96
|
-
* @version 1.
|
|
97
|
+
* @version 1.22.0
|
|
97
98
|
*
|
|
98
99
|
* @file PlotBoilerplate
|
|
99
100
|
* @fileoverview The main class.
|
|
@@ -320,6 +321,15 @@ export class PlotBoilerplate {
|
|
|
320
321
|
*/
|
|
321
322
|
hooks: IHooks;
|
|
322
323
|
|
|
324
|
+
/**
|
|
325
|
+
* Indicator if the instance is currently in 'panning' mode.
|
|
326
|
+
* Please use `isPanning()` method to determine value.
|
|
327
|
+
* @member {boolean}
|
|
328
|
+
* @memberof PlotBoilerplate
|
|
329
|
+
* @instance
|
|
330
|
+
*/
|
|
331
|
+
private isInPanningMode: boolean;
|
|
332
|
+
|
|
323
333
|
/**
|
|
324
334
|
* A list of content change listeners.
|
|
325
335
|
*/
|
|
@@ -756,6 +766,10 @@ export class PlotBoilerplate {
|
|
|
756
766
|
this.updateCSSscale();
|
|
757
767
|
}
|
|
758
768
|
|
|
769
|
+
public isPanning(): boolean {
|
|
770
|
+
return this.isInPanningMode;
|
|
771
|
+
}
|
|
772
|
+
|
|
759
773
|
/**
|
|
760
774
|
* Set the current zoom and draw offset to fit the given bounds.
|
|
761
775
|
*
|
|
@@ -1714,22 +1728,21 @@ export class PlotBoilerplate {
|
|
|
1714
1728
|
**/
|
|
1715
1729
|
// TODO: this was moved to the DOM utils
|
|
1716
1730
|
private getAvailableContainerSpace(): XYDimension {
|
|
1717
|
-
const
|
|
1718
|
-
|
|
1719
|
-
_self.canvas.style.display = "none";
|
|
1731
|
+
const container: HTMLElement = this.canvas.parentNode as unknown as HTMLElement; // Element | Document | DocumentFragment;
|
|
1732
|
+
this.canvas.style.display = "none";
|
|
1720
1733
|
var padding: number = this.getFProp(container, "padding") || 0,
|
|
1721
|
-
border: number = this.getFProp(
|
|
1734
|
+
border: number = this.getFProp(this.canvas, "border-width") || 0,
|
|
1722
1735
|
pl: number = this.getFProp(container, "padding-left") || padding,
|
|
1723
1736
|
pr: number = this.getFProp(container, "padding-right") || padding,
|
|
1724
1737
|
pt: number = this.getFProp(container, "padding-top") || padding,
|
|
1725
1738
|
pb: number = this.getFProp(container, "padding-bottom") || padding,
|
|
1726
|
-
bl: number = this.getFProp(
|
|
1727
|
-
br: number = this.getFProp(
|
|
1728
|
-
bt: number = this.getFProp(
|
|
1729
|
-
bb: number = this.getFProp(
|
|
1739
|
+
bl: number = this.getFProp(this.canvas, "border-left-width") || border,
|
|
1740
|
+
br: number = this.getFProp(this.canvas, "border-right-width") || border,
|
|
1741
|
+
bt: number = this.getFProp(this.canvas, "border-top-width") || border,
|
|
1742
|
+
bb: number = this.getFProp(this.canvas, "border-bottom-width") || border;
|
|
1730
1743
|
var w: number = container.clientWidth;
|
|
1731
1744
|
var h: number = container.clientHeight;
|
|
1732
|
-
|
|
1745
|
+
this.canvas.style.display = "block";
|
|
1733
1746
|
return { width: w - pl - pr - bl - br, height: h - pt - pb - bt - bb };
|
|
1734
1747
|
}
|
|
1735
1748
|
|
|
@@ -1990,7 +2003,8 @@ export class PlotBoilerplate {
|
|
|
1990
2003
|
// not this one. So this tab will never receive any [Ctrl-down] events
|
|
1991
2004
|
// until next keypress; the implication is, that [Ctrl] would still
|
|
1992
2005
|
// considered to be pressed which is not true.
|
|
1993
|
-
if (this.keyHandler && (this.keyHandler.isDown("alt") || this.keyHandler.isDown("spacebar"))) {
|
|
2006
|
+
// if (this.keyHandler && (this.keyHandler.isDown("alt") || this.keyHandler.isDown("spacebar"))) {
|
|
2007
|
+
if (this.isInPanningMode) {
|
|
1994
2008
|
if (!this.config.enablePan) {
|
|
1995
2009
|
return;
|
|
1996
2010
|
}
|
|
@@ -2345,6 +2359,18 @@ export class PlotBoilerplate {
|
|
|
2345
2359
|
_self.selectVerticesInPolygon(_self.selectPolygon);
|
|
2346
2360
|
_self.selectPolygon = null;
|
|
2347
2361
|
_self.redraw();
|
|
2362
|
+
})
|
|
2363
|
+
.down("alt", function () {
|
|
2364
|
+
_self.isInPanningMode = true;
|
|
2365
|
+
})
|
|
2366
|
+
.up("alt", function () {
|
|
2367
|
+
_self.isInPanningMode = false;
|
|
2368
|
+
})
|
|
2369
|
+
.down("spacebar", function () {
|
|
2370
|
+
_self.isInPanningMode = true;
|
|
2371
|
+
})
|
|
2372
|
+
.up("spacebar", function () {
|
|
2373
|
+
_self.isInPanningMode = false;
|
|
2348
2374
|
});
|
|
2349
2375
|
} // END IF enableKeys?
|
|
2350
2376
|
else {
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
* @modified 2020-02-22 Added 'return this' to the add* functions (for chanining).
|
|
7
7
|
* @modified 2020-03-23 Ported to Typescript from JS.
|
|
8
8
|
* @modified 2020-11-17 Added the `click` handler.
|
|
9
|
-
* @
|
|
9
|
+
* @modified 2026-04-04 Adding null-listeners will now throw an error.
|
|
10
|
+
* @version 1.2.0
|
|
10
11
|
*
|
|
11
12
|
* @file VertexListeners
|
|
12
13
|
* @public
|
|
@@ -275,6 +276,9 @@ export class VertexListeners {
|
|
|
275
276
|
* @private
|
|
276
277
|
*/
|
|
277
278
|
private static _addListener(listeners: Array<(e: VertEvent) => void>, newListener: (e: VertEvent) => void): boolean {
|
|
279
|
+
if (!newListener) {
|
|
280
|
+
throw new Error("Cannot add null listener. This would lead to unpredictable errors during event handling.");
|
|
281
|
+
}
|
|
278
282
|
for (var i in listeners) {
|
|
279
283
|
if (listeners[i] == newListener) return false;
|
|
280
284
|
}
|
package/src/ts/draw.ts
CHANGED
|
@@ -59,13 +59,25 @@
|
|
|
59
59
|
* @modified 2024-09-13 Remoed the scaling of `lineWidth` in the `polygon` and `polyline` methods. This makes no sense here and doesn't match up with the behavior of other line functions.
|
|
60
60
|
* @modified 2026-01-04 Adding `lineJoin` attribute to the `StrokeOptions`.
|
|
61
61
|
* @modified 2026-03-18 Adding `isOpen` parameter to `cubicBezierPath` draw method.
|
|
62
|
-
* @
|
|
62
|
+
* @modified 2026-04-04 Added the method `bounds`.
|
|
63
|
+
* @modified 2026-04-04 Handling the `lineCap` attribute in the `StrokeOptions`.
|
|
64
|
+
* @version 1.15.0
|
|
63
65
|
**/
|
|
64
66
|
|
|
65
67
|
import { CubicBezierCurve } from "./CubicBezierCurve";
|
|
66
68
|
import { Polygon } from "./Polygon";
|
|
67
69
|
import { Vertex } from "./Vertex";
|
|
68
|
-
import {
|
|
70
|
+
import {
|
|
71
|
+
DrawLib,
|
|
72
|
+
SVGPathParams,
|
|
73
|
+
XYCoords,
|
|
74
|
+
UID,
|
|
75
|
+
DrawLibConfiguration,
|
|
76
|
+
FontStyle,
|
|
77
|
+
FontWeight,
|
|
78
|
+
StrokeOptions,
|
|
79
|
+
IBounds
|
|
80
|
+
} from "./interfaces";
|
|
69
81
|
import { drawutilssvg } from "./drawutilssvg";
|
|
70
82
|
import { Bounds } from "./Bounds";
|
|
71
83
|
import { Vector } from "./Vector";
|
|
@@ -143,6 +155,7 @@ export class drawutils implements DrawLib<void> {
|
|
|
143
155
|
);
|
|
144
156
|
this.ctx.lineDashOffset = (strokeOptions?.dashOffset ?? 0) * this.scale.x;
|
|
145
157
|
this.ctx.lineJoin = strokeOptions?.lineJoin ?? null;
|
|
158
|
+
this.ctx.lineCap = strokeOptions?.lineCap ?? null;
|
|
146
159
|
}
|
|
147
160
|
|
|
148
161
|
// +---------------------------------------------------------------------------------
|
|
@@ -590,6 +603,23 @@ export class drawutils implements DrawLib<void> {
|
|
|
590
603
|
this.ctx.restore();
|
|
591
604
|
}
|
|
592
605
|
|
|
606
|
+
/**
|
|
607
|
+
* Draw a rectangle at the given bounds; and with the specified line width and (CSS-) color.<br>
|
|
608
|
+
*
|
|
609
|
+
* @method bounds
|
|
610
|
+
* @param {IBounds} bounds - The bounds rectangle to be drawn.
|
|
611
|
+
* @param {string} color - The CSS color to draw the rectangle with.
|
|
612
|
+
* @param {number=} lineWidth - (optional) The line width to use; default is 1.
|
|
613
|
+
* @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
|
|
614
|
+
*
|
|
615
|
+
* @return {R}
|
|
616
|
+
* @instance
|
|
617
|
+
* @memberof DrawLib
|
|
618
|
+
*/
|
|
619
|
+
bounds(bounds: IBounds, color: string, lineWidth?: number, strokeOptions?: StrokeOptions): void {
|
|
620
|
+
this.rect(bounds.min, bounds.max.x - bounds.min.x, bounds.max.y - bounds.min.y, color, lineWidth, strokeOptions);
|
|
621
|
+
}
|
|
622
|
+
|
|
593
623
|
/**
|
|
594
624
|
* Draw the given (cubic) bézier curve.
|
|
595
625
|
*
|
package/src/ts/drawgl.ts
CHANGED
|
@@ -17,12 +17,23 @@
|
|
|
17
17
|
* @modified 2023-09-29 Added the `cubicBezierArrow(...)` function to the 'DrawLib.arrow()` interface.
|
|
18
18
|
* @modified 2023-09-29 Added the `lineDashes` attribute.
|
|
19
19
|
* @modified 2026-03-18 Adding `isOpen` parameter to `cubicBezierPath` draw method.
|
|
20
|
-
* @
|
|
20
|
+
* @modified 2026-04-04 Added the method `bounds`.
|
|
21
|
+
* @version 0.0.11
|
|
21
22
|
**/
|
|
22
23
|
|
|
23
24
|
import { Polygon } from "./Polygon";
|
|
24
25
|
import { Vertex } from "./Vertex";
|
|
25
|
-
import {
|
|
26
|
+
import {
|
|
27
|
+
DrawLib,
|
|
28
|
+
XYCoords,
|
|
29
|
+
SVGPathParams,
|
|
30
|
+
UID,
|
|
31
|
+
DrawLibConfiguration,
|
|
32
|
+
FontStyle,
|
|
33
|
+
FontWeight,
|
|
34
|
+
StrokeOptions,
|
|
35
|
+
IBounds
|
|
36
|
+
} from "./interfaces";
|
|
26
37
|
import { Bounds } from "./Bounds";
|
|
27
38
|
|
|
28
39
|
/**
|
|
@@ -569,10 +580,34 @@ export class drawutilsgl implements DrawLib<void> {
|
|
|
569
580
|
* @param {string} color - The color to use.
|
|
570
581
|
* @param {number=1} lineWidth - (optional) The line with to use (default is 1).
|
|
571
582
|
**/
|
|
572
|
-
rect(
|
|
583
|
+
rect(
|
|
584
|
+
position: XYCoords,
|
|
585
|
+
width: number,
|
|
586
|
+
height: number,
|
|
587
|
+
color: string,
|
|
588
|
+
lineWidth?: number,
|
|
589
|
+
strokeOptions?: StrokeOptions
|
|
590
|
+
): void {
|
|
573
591
|
// NOT YET IMPLEMENTED
|
|
574
592
|
}
|
|
575
593
|
|
|
594
|
+
/**
|
|
595
|
+
* Draw a rectangle at the given bounds; and with the specified line width and (CSS-) color.<br>
|
|
596
|
+
*
|
|
597
|
+
* @method bounds
|
|
598
|
+
* @param {IBounds} bounds - The bounds rectangle to be drawn.
|
|
599
|
+
* @param {string} color - The CSS color to draw the rectangle with.
|
|
600
|
+
* @param {number=} lineWidth - (optional) The line width to use; default is 1.
|
|
601
|
+
* @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
|
|
602
|
+
*
|
|
603
|
+
* @return {R}
|
|
604
|
+
* @instance
|
|
605
|
+
* @memberof DrawLib
|
|
606
|
+
*/
|
|
607
|
+
bounds(bounds: IBounds, color: string, lineWidth?: number, strokeOptions?: StrokeOptions): void {
|
|
608
|
+
this.rect(bounds.min, bounds.max.x - bounds.min.x, bounds.max.y - bounds.min.y, color, lineWidth, strokeOptions);
|
|
609
|
+
}
|
|
610
|
+
|
|
576
611
|
/**
|
|
577
612
|
* Draw a grid of horizontal and vertical lines with the given (CSS-) color.
|
|
578
613
|
*
|
package/src/ts/drawutilssvg.ts
CHANGED
|
@@ -51,6 +51,9 @@
|
|
|
51
51
|
* @modified 2026-01-04 Adding `lineJoin` attribute to the methods' `StrokeOptions` param.
|
|
52
52
|
* @modified 2026-01-04 Fixing missing `strokeOptions` param in the `drawutilssvg.polygon` method.
|
|
53
53
|
* @modified 2026-03-18 Adding `isOpen` parameter to `cubicBezierPath` draw method.
|
|
54
|
+
* @modified 2026-04-04 Added the method `bounds`.
|
|
55
|
+
* @modified 2026-04-04 Handling the `stroke-linecap` option now from the `StrokeOptions` interface.
|
|
56
|
+
* @modified 2026-04-04 Chaning the `copyPathData` method by usind `Array.slice()`.
|
|
54
57
|
* @version 1.7.0
|
|
55
58
|
**/
|
|
56
59
|
|
|
@@ -69,7 +72,8 @@ import {
|
|
|
69
72
|
DrawLibConfiguration,
|
|
70
73
|
FontStyle,
|
|
71
74
|
FontWeight,
|
|
72
|
-
StrokeOptions
|
|
75
|
+
StrokeOptions,
|
|
76
|
+
IBounds
|
|
73
77
|
} from "./interfaces";
|
|
74
78
|
import { Bounds } from "./Bounds";
|
|
75
79
|
import { UIDGenerator } from "./UIDGenerator";
|
|
@@ -681,6 +685,11 @@ export class drawutilssvg implements DrawLib<void | SVGElement> {
|
|
|
681
685
|
if (strokeOptions && strokeOptions.lineJoin && drawutilssvg.nodeSupportsLineJoin(node.tagName)) {
|
|
682
686
|
node.setAttribute("stroke-linejoin", strokeOptions.lineJoin);
|
|
683
687
|
}
|
|
688
|
+
|
|
689
|
+
// Set lineCap option?
|
|
690
|
+
if (strokeOptions && strokeOptions.lineCap && drawutilssvg.nodeSupportsLineCap(node.tagName)) {
|
|
691
|
+
node.setAttribute("stroke-linecap", strokeOptions.lineCap);
|
|
692
|
+
}
|
|
684
693
|
}
|
|
685
694
|
|
|
686
695
|
private _x(x: number): number {
|
|
@@ -1295,6 +1304,23 @@ export class drawutilssvg implements DrawLib<void | SVGElement> {
|
|
|
1295
1304
|
return this._bindFillDraw(node, "rect", color, lineWidth || 1);
|
|
1296
1305
|
}
|
|
1297
1306
|
|
|
1307
|
+
/**
|
|
1308
|
+
* Draw a rectangle at the given bounds; and with the specified line width and (CSS-) color.<br>
|
|
1309
|
+
*
|
|
1310
|
+
* @method bounds
|
|
1311
|
+
* @param {IBounds} bounds - The bounds rectangle to be drawn.
|
|
1312
|
+
* @param {string} color - The CSS color to draw the rectangle with.
|
|
1313
|
+
* @param {number=} lineWidth - (optional) The line width to use; default is 1.
|
|
1314
|
+
* @param {StrokeOptions=} strokeOptions - (optional) Stroke settings to use.
|
|
1315
|
+
*
|
|
1316
|
+
* @return {R}
|
|
1317
|
+
* @instance
|
|
1318
|
+
* @memberof DrawLib
|
|
1319
|
+
*/
|
|
1320
|
+
bounds(bounds: IBounds, color: string, lineWidth?: number, strokeOptions?: StrokeOptions): void {
|
|
1321
|
+
this.rect(bounds.min, bounds.max.x - bounds.min.x, bounds.max.y - bounds.min.y, color, lineWidth, strokeOptions);
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1298
1324
|
/**
|
|
1299
1325
|
* Draw a grid of horizontal and vertical lines with the given (CSS-) color.
|
|
1300
1326
|
*
|
|
@@ -1801,11 +1827,8 @@ export class drawutilssvg implements DrawLib<void | SVGElement> {
|
|
|
1801
1827
|
* @memberof drawutilssvg
|
|
1802
1828
|
*/
|
|
1803
1829
|
static copyPathData(data: SVGPathParams): SVGPathParams {
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
copy[i] = data[i];
|
|
1807
|
-
}
|
|
1808
|
-
return copy;
|
|
1830
|
+
// To create a shallow copy we can just use the `slice` method.
|
|
1831
|
+
return data.slice();
|
|
1809
1832
|
}
|
|
1810
1833
|
|
|
1811
1834
|
/**
|
|
@@ -1983,6 +2006,10 @@ export class drawutilssvg implements DrawLib<void | SVGElement> {
|
|
|
1983
2006
|
return ["line", "path", "circle", "ellipse", "rectangle", "rect"].includes(nodeName);
|
|
1984
2007
|
}
|
|
1985
2008
|
|
|
2009
|
+
private static nodeSupportsLineCap(nodeName: string) {
|
|
2010
|
+
return ["line", "path", "circle", "ellipse", "rectangle", "rect"].includes(nodeName);
|
|
2011
|
+
}
|
|
2012
|
+
|
|
1986
2013
|
/**
|
|
1987
2014
|
* Creates a basic <line> node with start and end coordinates. The created node will not
|
|
1988
2015
|
* be bound to any root node.
|