@teachinglab/omd 0.3.8 → 0.4.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/canvas/core/canvasConfig.js +3 -3
- package/canvas/core/omdCanvas.js +479 -479
- package/canvas/events/eventManager.js +14 -4
- package/canvas/features/focusFrameManager.js +284 -286
- package/canvas/features/resizeHandleManager.js +482 -0
- package/canvas/tools/EraserTool.js +321 -322
- package/canvas/tools/PencilTool.js +321 -324
- package/canvas/tools/PointerTool.js +71 -0
- package/canvas/tools/SelectTool.js +902 -457
- package/canvas/tools/toolManager.js +389 -393
- package/canvas/ui/cursor.js +462 -437
- package/canvas/ui/toolbar.js +291 -290
- package/docs/omd-objects.md +258 -0
- package/jsvg/jsvg.js +898 -0
- package/jsvg/jsvgComponents.js +359 -0
- package/omd/nodes/omdEquationSequenceNode.js +1280 -1246
- package/package.json +1 -1
- package/src/json-schemas.md +546 -78
- package/src/omd.js +212 -109
- package/src/omdEquation.js +188 -162
- package/src/omdProblem.js +216 -11
|
@@ -1,324 +1,321 @@
|
|
|
1
|
-
import { Tool } from './tool.js';
|
|
2
|
-
import { Stroke } from '../drawing/stroke.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Pencil tool for freehand drawing
|
|
6
|
-
*/
|
|
7
|
-
export class PencilTool extends Tool {
|
|
8
|
-
constructor(canvas, options = {}) {
|
|
9
|
-
super(canvas, {
|
|
10
|
-
strokeWidth: 5,
|
|
11
|
-
strokeColor: '#000000',
|
|
12
|
-
strokeOpacity: 1,
|
|
13
|
-
smoothing: 0.5,
|
|
14
|
-
pressureSensitive: true,
|
|
15
|
-
...options
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
this.displayName = 'Pencil';
|
|
19
|
-
this.description = 'Draw freehand strokes';
|
|
20
|
-
this.icon = 'pencil';
|
|
21
|
-
this.shortcut = 'P';
|
|
22
|
-
this.category = 'drawing';
|
|
23
|
-
|
|
24
|
-
// Drawing state
|
|
25
|
-
this.points = [];
|
|
26
|
-
this.lastPoint = null;
|
|
27
|
-
this.minDistance = 2.0; // Minimum distance between points (increased for better performance)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Start drawing a new stroke
|
|
32
|
-
*/
|
|
33
|
-
onPointerDown(event) {
|
|
34
|
-
if (!this.canUse()) return;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
this.
|
|
39
|
-
this.
|
|
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
|
-
const
|
|
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
|
-
this.
|
|
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
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
//
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
const
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
// Update
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
//
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
const
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
return `${super.getHelpText()}\nShortcuts: [ ] to adjust brush size`;
|
|
323
|
-
}
|
|
324
|
-
}
|
|
1
|
+
import { Tool } from './tool.js';
|
|
2
|
+
import { Stroke } from '../drawing/stroke.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Pencil tool for freehand drawing
|
|
6
|
+
*/
|
|
7
|
+
export class PencilTool extends Tool {
|
|
8
|
+
constructor(canvas, options = {}) {
|
|
9
|
+
super(canvas, {
|
|
10
|
+
strokeWidth: 5,
|
|
11
|
+
strokeColor: '#000000',
|
|
12
|
+
strokeOpacity: 1,
|
|
13
|
+
smoothing: 0.5,
|
|
14
|
+
pressureSensitive: true,
|
|
15
|
+
...options
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
this.displayName = 'Pencil';
|
|
19
|
+
this.description = 'Draw freehand strokes';
|
|
20
|
+
this.icon = 'pencil';
|
|
21
|
+
this.shortcut = 'P';
|
|
22
|
+
this.category = 'drawing';
|
|
23
|
+
|
|
24
|
+
// Drawing state
|
|
25
|
+
this.points = [];
|
|
26
|
+
this.lastPoint = null;
|
|
27
|
+
this.minDistance = 2.0; // Minimum distance between points (increased for better performance)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Start drawing a new stroke
|
|
32
|
+
*/
|
|
33
|
+
onPointerDown(event) {
|
|
34
|
+
if (!this.canUse()) return;
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
this.isDrawing = true;
|
|
38
|
+
this.points = [];
|
|
39
|
+
this.lastPoint = { x: event.x, y: event.y };
|
|
40
|
+
|
|
41
|
+
// Create new stroke
|
|
42
|
+
this.currentStroke = new Stroke({
|
|
43
|
+
x: event.x,
|
|
44
|
+
y: event.y,
|
|
45
|
+
strokeWidth: this.calculateStrokeWidth(event.pressure),
|
|
46
|
+
strokeColor: this.config.strokeColor,
|
|
47
|
+
strokeOpacity: this.config.strokeOpacity,
|
|
48
|
+
tool: this.name
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// Add first point
|
|
52
|
+
this.addPoint(event.x, event.y, event.pressure);
|
|
53
|
+
|
|
54
|
+
// Add stroke to canvas
|
|
55
|
+
const strokeId = this.canvas.addStroke(this.currentStroke);
|
|
56
|
+
|
|
57
|
+
this.canvas.emit('strokeStarted', {
|
|
58
|
+
stroke: this.currentStroke,
|
|
59
|
+
tool: this.name,
|
|
60
|
+
point: { x: event.x, y: event.y, pressure: event.pressure }
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Continue drawing the stroke
|
|
66
|
+
*/
|
|
67
|
+
onPointerMove(event) {
|
|
68
|
+
if (!this.isDrawing || !this.currentStroke) return;
|
|
69
|
+
|
|
70
|
+
// Process coalesced events for higher precision if available
|
|
71
|
+
if (event.coalescedEvents && event.coalescedEvents.length > 0) {
|
|
72
|
+
// Limit the number of coalesced events processed to prevent performance issues
|
|
73
|
+
const maxCoalescedEvents = 5;
|
|
74
|
+
const eventsToProcess = event.coalescedEvents.slice(0, maxCoalescedEvents);
|
|
75
|
+
|
|
76
|
+
for (const coalescedEvent of eventsToProcess) {
|
|
77
|
+
this._addPointIfNeeded(coalescedEvent.x, coalescedEvent.y, coalescedEvent.pressure);
|
|
78
|
+
}
|
|
79
|
+
} else {
|
|
80
|
+
// Fallback to regular event
|
|
81
|
+
this._addPointIfNeeded(event.x, event.y, event.pressure);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
this.canvas.emit('strokeContinued', {
|
|
85
|
+
stroke: this.currentStroke,
|
|
86
|
+
tool: this.name,
|
|
87
|
+
point: { x: event.x, y: event.y, pressure: event.pressure }
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Finish drawing the stroke
|
|
93
|
+
*/
|
|
94
|
+
onPointerUp(event) {
|
|
95
|
+
if (!this.isDrawing || !this.currentStroke) return;
|
|
96
|
+
|
|
97
|
+
// Add final point
|
|
98
|
+
this.addPoint(event.x, event.y, event.pressure);
|
|
99
|
+
|
|
100
|
+
// Finish the stroke
|
|
101
|
+
this.currentStroke.finish();
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
this.canvas.emit('strokeCompleted', {
|
|
105
|
+
stroke: this.currentStroke,
|
|
106
|
+
tool: this.name,
|
|
107
|
+
totalPoints: this.points.length
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
// Reset drawing state
|
|
111
|
+
this.isDrawing = false;
|
|
112
|
+
this.currentStroke = null;
|
|
113
|
+
this.points = [];
|
|
114
|
+
this.lastPoint = null;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Cancel current stroke
|
|
119
|
+
*/
|
|
120
|
+
onCancel() {
|
|
121
|
+
if (this.isDrawing && this.currentStroke) {
|
|
122
|
+
// Remove incomplete stroke
|
|
123
|
+
this.canvas.removeStroke(this.currentStroke.id);
|
|
124
|
+
|
|
125
|
+
this.canvas.emit('strokeCancelled', {
|
|
126
|
+
stroke: this.currentStroke,
|
|
127
|
+
tool: this.name
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
super.onCancel();
|
|
132
|
+
|
|
133
|
+
// Reset state
|
|
134
|
+
this.points = [];
|
|
135
|
+
this.lastPoint = null;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Add a point to the current stroke
|
|
140
|
+
* @private
|
|
141
|
+
*/
|
|
142
|
+
addPoint(x, y, pressure = 0.5) {
|
|
143
|
+
const point = {
|
|
144
|
+
x,
|
|
145
|
+
y,
|
|
146
|
+
pressure,
|
|
147
|
+
width: this.calculateStrokeWidth(pressure),
|
|
148
|
+
timestamp: Date.now()
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
this.points.push(point);
|
|
152
|
+
|
|
153
|
+
if (this.currentStroke) {
|
|
154
|
+
this.currentStroke.addPoint(point);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Add a point only if it meets distance requirements
|
|
160
|
+
* @private
|
|
161
|
+
*/
|
|
162
|
+
_addPointIfNeeded(x, y, pressure = 0.5) {
|
|
163
|
+
if (!this.lastPoint) {
|
|
164
|
+
this.addPoint(x, y, pressure);
|
|
165
|
+
this.lastPoint = { x, y };
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
const distance = this.getDistance(this.lastPoint, { x, y });
|
|
170
|
+
|
|
171
|
+
// Add point if moved enough distance
|
|
172
|
+
if (distance >= this.minDistance) {
|
|
173
|
+
// Only interpolate for very large gaps to prevent performance issues
|
|
174
|
+
if (distance > 8) {
|
|
175
|
+
this._interpolatePoints(this.lastPoint, { x, y, pressure });
|
|
176
|
+
} else {
|
|
177
|
+
this.addPoint(x, y, pressure);
|
|
178
|
+
}
|
|
179
|
+
this.lastPoint = { x, y };
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Add interpolated points between two points for smoother strokes
|
|
185
|
+
* @private
|
|
186
|
+
*/
|
|
187
|
+
_interpolatePoints(fromPoint, toPoint) {
|
|
188
|
+
const distance = this.getDistance(fromPoint, toPoint);
|
|
189
|
+
// Increase spacing to reduce point density - point every 3 pixels instead of 1.5
|
|
190
|
+
const steps = Math.ceil(distance / 3);
|
|
191
|
+
|
|
192
|
+
// Limit maximum interpolation steps to prevent performance issues
|
|
193
|
+
const maxSteps = 10;
|
|
194
|
+
const actualSteps = Math.min(steps, maxSteps);
|
|
195
|
+
|
|
196
|
+
for (let i = 1; i <= actualSteps; i++) {
|
|
197
|
+
const t = i / actualSteps;
|
|
198
|
+
const x = fromPoint.x + (toPoint.x - fromPoint.x) * t;
|
|
199
|
+
const y = fromPoint.y + (toPoint.y - fromPoint.y) * t;
|
|
200
|
+
const pressure = fromPoint.pressure ?
|
|
201
|
+
fromPoint.pressure + (toPoint.pressure - fromPoint.pressure) * t :
|
|
202
|
+
toPoint.pressure;
|
|
203
|
+
|
|
204
|
+
this.addPoint(x, y, pressure);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Calculate distance between two points
|
|
210
|
+
* @private
|
|
211
|
+
*/
|
|
212
|
+
getDistance(p1, p2) {
|
|
213
|
+
const dx = p2.x - p1.x;
|
|
214
|
+
const dy = p2.y - p1.y;
|
|
215
|
+
return Math.sqrt(dx * dx + dy * dy);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Update configuration and apply smoothing
|
|
220
|
+
*/
|
|
221
|
+
onConfigUpdate() {
|
|
222
|
+
// Update minimum distance based on stroke width
|
|
223
|
+
this.minDistance = Math.max(1, this.config.strokeWidth * 0.2);
|
|
224
|
+
|
|
225
|
+
// Update current stroke if drawing
|
|
226
|
+
if (this.isDrawing && this.currentStroke) {
|
|
227
|
+
this.currentStroke.updateConfig({
|
|
228
|
+
strokeColor: this.config.strokeColor,
|
|
229
|
+
strokeOpacity: this.config.strokeOpacity
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// Update cursor size
|
|
234
|
+
if (this.canvas.cursor) {
|
|
235
|
+
this.canvas.cursor.updateFromToolConfig(this.config);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Calculate stroke width with pressure sensitivity
|
|
241
|
+
*/
|
|
242
|
+
calculateStrokeWidth(pressure = 0.5) {
|
|
243
|
+
if (!this.config.pressureSensitive) {
|
|
244
|
+
return this.config.strokeWidth;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
return super.calculateStrokeWidth(pressure);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Get smoothed points using interpolation
|
|
252
|
+
* @param {Array} points - Array of points to smooth
|
|
253
|
+
* @returns {Array} Smoothed points
|
|
254
|
+
*/
|
|
255
|
+
getSmoothPath(points) {
|
|
256
|
+
if (points.length < 2) return points;
|
|
257
|
+
|
|
258
|
+
const smoothed = [];
|
|
259
|
+
const smoothing = this.config.smoothing;
|
|
260
|
+
|
|
261
|
+
// First point
|
|
262
|
+
smoothed.push(points[0]);
|
|
263
|
+
|
|
264
|
+
// Smooth intermediate points
|
|
265
|
+
for (let i = 1; i < points.length - 1; i++) {
|
|
266
|
+
const prev = points[i - 1];
|
|
267
|
+
const curr = points[i];
|
|
268
|
+
const next = points[i + 1];
|
|
269
|
+
|
|
270
|
+
const smoothedPoint = {
|
|
271
|
+
x: curr.x + smoothing * ((prev.x + next.x) / 2 - curr.x),
|
|
272
|
+
y: curr.y + smoothing * ((prev.y + next.y) / 2 - curr.y),
|
|
273
|
+
pressure: curr.pressure,
|
|
274
|
+
width: curr.width,
|
|
275
|
+
timestamp: curr.timestamp
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
smoothed.push(smoothedPoint);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
// Last point
|
|
282
|
+
if (points.length > 1) {
|
|
283
|
+
smoothed.push(points[points.length - 1]);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
return smoothed;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* Handle keyboard shortcuts specific to pencil tool
|
|
291
|
+
*/
|
|
292
|
+
onKeyboardShortcut(key, event) {
|
|
293
|
+
switch (key) {
|
|
294
|
+
case '[':
|
|
295
|
+
// Decrease brush size
|
|
296
|
+
this.updateConfig({
|
|
297
|
+
strokeWidth: Math.max(1, this.config.strokeWidth - 1)
|
|
298
|
+
});
|
|
299
|
+
// Notify tool manager of config change
|
|
300
|
+
this.canvas.toolManager.updateToolConfig(this.name, this.config);
|
|
301
|
+
return true;
|
|
302
|
+
case ']':
|
|
303
|
+
// Increase brush size
|
|
304
|
+
this.updateConfig({
|
|
305
|
+
strokeWidth: Math.min(50, this.config.strokeWidth + 1)
|
|
306
|
+
});
|
|
307
|
+
// Notify tool manager of config change
|
|
308
|
+
this.canvas.toolManager.updateToolConfig(this.name, this.config);
|
|
309
|
+
return true;
|
|
310
|
+
default:
|
|
311
|
+
return super.onKeyboardShortcut(key, event);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Get help text for pencil tool
|
|
317
|
+
*/
|
|
318
|
+
getHelpText() {
|
|
319
|
+
return `${super.getHelpText()}\nShortcuts: [ ] to adjust brush size`;
|
|
320
|
+
}
|
|
321
|
+
}
|