@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
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Tool } from './tool.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Pointer/Browse tool
|
|
5
|
+
* Allows browsing and interacting with interactive components without selecting or moving items.
|
|
6
|
+
* Use this tool to click buttons, interact with UI elements, etc. without modifying the canvas.
|
|
7
|
+
*/
|
|
8
|
+
export class PointerTool extends Tool {
|
|
9
|
+
/**
|
|
10
|
+
* @param {OMDCanvas} canvas
|
|
11
|
+
* @param {object} [options={}]
|
|
12
|
+
*/
|
|
13
|
+
constructor(canvas, options = {}) {
|
|
14
|
+
super(canvas, { ...options });
|
|
15
|
+
|
|
16
|
+
this.displayName = 'Pointer';
|
|
17
|
+
this.description = 'Browse and interact with components';
|
|
18
|
+
this.icon = 'pointer';
|
|
19
|
+
this.shortcut = 'V';
|
|
20
|
+
this.category = 'navigation';
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
onActivate() {
|
|
24
|
+
this.isActive = true;
|
|
25
|
+
if (this.canvas.cursor) {
|
|
26
|
+
this.canvas.cursor.show();
|
|
27
|
+
this.canvas.cursor.setShape('pointer');
|
|
28
|
+
}
|
|
29
|
+
super.onActivate();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
onDeactivate() {
|
|
33
|
+
this.isActive = false;
|
|
34
|
+
super.onDeactivate();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
onPointerDown(event) {
|
|
38
|
+
// Pointer tool is completely passive - it does nothing
|
|
39
|
+
// This allows click events to pass through to interactive components
|
|
40
|
+
// but prevents any canvas manipulation (drawing, selecting, moving)
|
|
41
|
+
|
|
42
|
+
// Explicitly ensure we are not entering a drawing/dragging state
|
|
43
|
+
if (this.canvas?.eventManager) {
|
|
44
|
+
this.canvas.eventManager.isDrawing = false;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
onPointerMove(event) {
|
|
49
|
+
// No-op: allow hovering without any interaction
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
onPointerUp(event) {
|
|
53
|
+
// No-op: do not modify selections or positions
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
onKeyboardShortcut(key, event) {
|
|
57
|
+
// No shortcuts to handle for passive pointer tool
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
onKeyboardShortcut(key, event) {
|
|
62
|
+
// No shortcuts to handle for passive pointer tool
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
getCursor() {
|
|
67
|
+
return 'pointer';
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
|