@markup-canvas/core 1.0.0 → 1.0.3
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/README.md +86 -63
- package/dist/markup-canvas.cjs.js +1 -1
- package/dist/markup-canvas.esm.js +1 -1
- package/dist/markup-canvas.umd.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
# @markup-canvas/core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Lightweight, canvas-like container with smooth pan and zoom capabilities. Simply add your HTML or React content inside.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🚀 **High Performance**: 60fps smooth animations with GPU acceleration
|
|
8
|
+
- 🎯 **Precise Control**: Zoom, pan, and navigate with mouse, keyboard, or touch
|
|
9
|
+
- 📏 **Rulers & Grid**: Optional rulers and grid overlay
|
|
10
|
+
- 🔧 **Event System**: Built-in EventEmitter for reactive updates
|
|
11
|
+
- 📦 **TypeScript**: Full TypeScript support with comprehensive types
|
|
4
12
|
|
|
5
13
|
## ✨ Live Demo
|
|
6
14
|
|
|
@@ -38,6 +46,83 @@ const canvas = new MarkupCanvas(container, {
|
|
|
38
46
|
});
|
|
39
47
|
```
|
|
40
48
|
|
|
49
|
+
### Config Options
|
|
50
|
+
|
|
51
|
+
#### Canvas Dimensions
|
|
52
|
+
|
|
53
|
+
| Option | Type | Default | Description |
|
|
54
|
+
|--------|------|---------|-------------|
|
|
55
|
+
| `width` | `number` | - | Canvas width in pixels |
|
|
56
|
+
| `height` | `number` | - | Canvas height in pixels |
|
|
57
|
+
| `enableAcceleration` | `boolean` | `true` | Enable hardware acceleration |
|
|
58
|
+
|
|
59
|
+
#### Interaction Controls
|
|
60
|
+
|
|
61
|
+
| Option | Type | Default | Description |
|
|
62
|
+
|--------|------|---------|-------------|
|
|
63
|
+
| `enableZoom` | `boolean` | `true` | Enable zoom functionality |
|
|
64
|
+
| `enablePan` | `boolean` | `true` | Enable pan functionality |
|
|
65
|
+
| `enableTouch` | `boolean` | `true` | Enable touch gestures |
|
|
66
|
+
| `enableKeyboard` | `boolean` | `true` | Enable keyboard controls |
|
|
67
|
+
| `limitKeyboardEventsToCanvas` | `boolean` | `true` | Limit keyboard events to when canvas is focused |
|
|
68
|
+
|
|
69
|
+
#### Zoom Behavior
|
|
70
|
+
|
|
71
|
+
| Option | Type | Default | Description |
|
|
72
|
+
|--------|------|---------|-------------|
|
|
73
|
+
| `zoomSpeed` | `number` | `1.2` | Zoom speed factor |
|
|
74
|
+
| `minZoom` | `number` | `0.1` | Minimum zoom level |
|
|
75
|
+
| `maxZoom` | `number` | `10` | Maximum zoom level |
|
|
76
|
+
| `enableTransition` | `boolean` | `false` | Enable smooth transitions |
|
|
77
|
+
| `transitionDuration` | `number` | `300` | Transition duration in ms |
|
|
78
|
+
| `enableAdaptiveSpeed` | `boolean` | `true` | Enable adaptive zoom speed |
|
|
79
|
+
|
|
80
|
+
#### Pan Behavior
|
|
81
|
+
|
|
82
|
+
| Option | Type | Default | Description |
|
|
83
|
+
|--------|------|---------|-------------|
|
|
84
|
+
| `enableLeftDrag` | `boolean` | `true` | Enable left mouse button drag |
|
|
85
|
+
| `enableMiddleDrag` | `boolean` | `true` | Enable middle mouse button drag |
|
|
86
|
+
| `requireSpaceForMouseDrag` | `boolean` | `false` | Require space key for mouse drag |
|
|
87
|
+
| `keyboardPanStep` | `number` | `50` | Keyboard pan step size in pixels |
|
|
88
|
+
| `keyboardFastMultiplier` | `number` | `3` | Fast pan multiplier (with shift key) |
|
|
89
|
+
| `keyboardZoomStep` | `number` | `0.2` | Keyboard zoom step size |
|
|
90
|
+
|
|
91
|
+
#### Click-to-Zoom
|
|
92
|
+
|
|
93
|
+
| Option | Type | Default | Description |
|
|
94
|
+
|--------|------|---------|-------------|
|
|
95
|
+
| `enableClickToZoom` | `boolean` | `false` | Enable click to zoom |
|
|
96
|
+
| `clickZoomLevel` | `number` | `2` | Target zoom level for click-to-zoom |
|
|
97
|
+
| `requireOptionForClickZoom` | `boolean` | `false` | Require Option/Alt key for click-to-zoom |
|
|
98
|
+
|
|
99
|
+
#### Visual Elements
|
|
100
|
+
|
|
101
|
+
| Option | Type | Default | Description |
|
|
102
|
+
|--------|------|---------|-------------|
|
|
103
|
+
| `enableRulers` | `boolean` | `true` | Show rulers on top and left |
|
|
104
|
+
| `enableGrid` | `boolean` | `false` | Show background grid |
|
|
105
|
+
| `gridColor` | `string` | `"#e0e0e0"` | Grid line color |
|
|
106
|
+
|
|
107
|
+
#### Ruler Styling
|
|
108
|
+
|
|
109
|
+
| Option | Type | Default | Description |
|
|
110
|
+
|--------|------|---------|-------------|
|
|
111
|
+
| `rulerBackgroundColor` | `string` | `"#f5f5f5"` | Ruler background color |
|
|
112
|
+
| `rulerBorderColor` | `string` | `"#d0d0d0"` | Ruler border color |
|
|
113
|
+
| `rulerTextColor` | `string` | `"#666666"` | Ruler text color |
|
|
114
|
+
| `rulerMajorTickColor` | `string` | `"#666666"` | Major tick mark color |
|
|
115
|
+
| `rulerMinorTickColor` | `string` | `"#999999"` | Minor tick mark color |
|
|
116
|
+
| `rulerFontSize` | `number` | `12` | Ruler font size in pixels |
|
|
117
|
+
| `rulerFontFamily` | `string` | `"monospace"` | Ruler font family |
|
|
118
|
+
| `rulerUnits` | `string` | `"px"` | Ruler units label |
|
|
119
|
+
|
|
120
|
+
#### Callbacks
|
|
121
|
+
|
|
122
|
+
| Option | Type | Description |
|
|
123
|
+
|--------|------|-------------|
|
|
124
|
+
| `onTransformUpdate` | `(transform: Transform) => void` | Called continuously during transform updates |
|
|
125
|
+
|
|
41
126
|
### Event Handling
|
|
42
127
|
|
|
43
128
|
Listen to various events emitted by the canvas:
|
|
@@ -171,68 +256,6 @@ Here's a complete example with HTML:
|
|
|
171
256
|
</html>
|
|
172
257
|
```
|
|
173
258
|
|
|
174
|
-
## Features
|
|
175
|
-
|
|
176
|
-
- 🚀 **High Performance**: 60fps smooth animations with GPU acceleration
|
|
177
|
-
- 🎯 **Precise Control**: Zoom, pan, and navigate with mouse, keyboard, or touch
|
|
178
|
-
- 📏 **Rulers & Grid**: Optional rulers and grid overlay
|
|
179
|
-
- 🎨 **Pure HTML**: Use any HTML content or framework components
|
|
180
|
-
- 🔧 **Event System**: Built-in EventEmitter for reactive updates
|
|
181
|
-
- 📦 **TypeScript**: Full TypeScript support with comprehensive types
|
|
182
|
-
|
|
183
|
-
## Configuration Options
|
|
184
|
-
|
|
185
|
-
### Canvas Dimensions
|
|
186
|
-
- `width?: number` - Canvas width in pixels
|
|
187
|
-
- `height?: number` - Canvas height in pixels
|
|
188
|
-
- `enableAcceleration?: boolean` - Enable hardware acceleration
|
|
189
|
-
|
|
190
|
-
### Interaction Controls
|
|
191
|
-
- `enableZoom?: boolean` - Enable zoom functionality
|
|
192
|
-
- `enablePan?: boolean` - Enable pan functionality
|
|
193
|
-
- `enableTouch?: boolean` - Enable touch gestures
|
|
194
|
-
- `enableKeyboard?: boolean` - Enable keyboard controls
|
|
195
|
-
- `limitKeyboardEventsToCanvas?: boolean` - Limit keyboard events to when canvas is focused
|
|
196
|
-
|
|
197
|
-
### Zoom Behavior
|
|
198
|
-
- `zoomSpeed?: number` - Zoom speed factor
|
|
199
|
-
- `minZoom?: number` - Minimum zoom level
|
|
200
|
-
- `maxZoom?: number` - Maximum zoom level
|
|
201
|
-
- `enableTransition?: boolean` - Enable smooth transitions
|
|
202
|
-
- `transitionDuration?: number` - Transition duration in ms
|
|
203
|
-
- `enableAdaptiveSpeed?: boolean` - Enable adaptive zoom speed
|
|
204
|
-
|
|
205
|
-
### Pan Behavior
|
|
206
|
-
- `enableLeftDrag?: boolean` - Enable left mouse button drag
|
|
207
|
-
- `enableMiddleDrag?: boolean` - Enable middle mouse button drag
|
|
208
|
-
- `requireSpaceForMouseDrag?: boolean` - Require space key for mouse drag
|
|
209
|
-
- `keyboardPanStep?: number` - Keyboard pan step size
|
|
210
|
-
- `keyboardFastMultiplier?: number` - Fast pan multiplier (with shift)
|
|
211
|
-
- `keyboardZoomStep?: number` - Keyboard zoom step size
|
|
212
|
-
|
|
213
|
-
### Click-to-Zoom
|
|
214
|
-
- `enableClickToZoom?: boolean` - Enable click to zoom
|
|
215
|
-
- `clickZoomLevel?: number` - Target zoom level for click-to-zoom
|
|
216
|
-
- `requireOptionForClickZoom?: boolean` - Require Option/Alt key for click-to-zoom
|
|
217
|
-
|
|
218
|
-
### Visual Elements
|
|
219
|
-
- `enableRulers?: boolean` - Show rulers
|
|
220
|
-
- `enableGrid?: boolean` - Show background grid
|
|
221
|
-
- `gridColor?: string` - Grid line color
|
|
222
|
-
|
|
223
|
-
### Ruler Styling
|
|
224
|
-
- `rulerBackgroundColor?: string` - Ruler background color
|
|
225
|
-
- `rulerBorderColor?: string` - Ruler border color
|
|
226
|
-
- `rulerTextColor?: string` - Ruler text color
|
|
227
|
-
- `rulerMajorTickColor?: string` - Major tick mark color
|
|
228
|
-
- `rulerMinorTickColor?: string` - Minor tick mark color
|
|
229
|
-
- `rulerFontSize?: number` - Ruler font size
|
|
230
|
-
- `rulerFontFamily?: string` - Ruler font family
|
|
231
|
-
- `rulerUnits?: string` - Ruler units label
|
|
232
|
-
|
|
233
|
-
### Callbacks
|
|
234
|
-
- `onTransformUpdate?: (transform: Transform) => void` - Called on transform update
|
|
235
|
-
|
|
236
259
|
## API
|
|
237
260
|
|
|
238
261
|
See the [main documentation](../../README.md) for full API reference.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markup-canvas/core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "High-performance canvas-like container with pan and zoom capabilities",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/markup-canvas.cjs.js",
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"bugs": {
|
|
53
53
|
"url": "https://github.com/fritzbenning/markup-canvas/issues"
|
|
54
54
|
},
|
|
55
|
-
"homepage": "https://
|
|
55
|
+
"homepage": "https://markup-canvas.vercel.app"
|
|
56
56
|
}
|