@zzalai/leafer-multi-roi 1.0.4 → 1.0.5
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 +10 -21
- package/README_EN.md +48 -59
- package/docs/assets/index-C2aSwNRW.js +1 -0
- package/docs/index.html +1 -1
- package/package.json +1 -1
- package/docs/assets/index-BrSsc-mD.js +0 -1
package/README.md
CHANGED
|
@@ -36,26 +36,13 @@ pnpm add @zzalai/leafer-multi-roi
|
|
|
36
36
|
|
|
37
37
|
## 使用方法
|
|
38
38
|
|
|
39
|
-
###
|
|
40
|
-
|
|
41
|
-
```javascript
|
|
42
|
-
// main.ts
|
|
43
|
-
import { createApp } from 'vue'
|
|
44
|
-
import App from './App.vue'
|
|
45
|
-
import RoiEditor from '@zzalai/leafer-multi-roi'
|
|
46
|
-
|
|
47
|
-
const app = createApp(App)
|
|
48
|
-
app.use(RoiEditor)
|
|
49
|
-
app.mount('#app')
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
### 局部使用
|
|
39
|
+
### 基础使用
|
|
53
40
|
|
|
54
41
|
```vue
|
|
55
42
|
<template>
|
|
56
43
|
<div class="app">
|
|
57
44
|
<RoiEditor
|
|
58
|
-
:
|
|
45
|
+
:imageSource="imageSource"
|
|
59
46
|
:options="editorOptions"
|
|
60
47
|
@roiChange="handleRoiChange"
|
|
61
48
|
@loadStart="handleLoadStart"
|
|
@@ -68,10 +55,11 @@ app.mount('#app')
|
|
|
68
55
|
<script setup lang="ts">
|
|
69
56
|
import { ref, computed } from 'vue'
|
|
70
57
|
import { RoiEditor } from '@zzalai/leafer-multi-roi'
|
|
58
|
+
import '@zzalai/leafer-multi-roi/dist/leafer-multi-roi.css'
|
|
71
59
|
|
|
72
60
|
// 图片源
|
|
73
61
|
const imageUrl = ref('https://picsum.photos/1280/1080')
|
|
74
|
-
const
|
|
62
|
+
const imageSource = computed(() => ({
|
|
75
63
|
id: 'test-image',
|
|
76
64
|
url: imageUrl.value
|
|
77
65
|
}))
|
|
@@ -121,7 +109,7 @@ const handleLoadError = (error: any) => {
|
|
|
121
109
|
<div class="app">
|
|
122
110
|
<RoiEditor
|
|
123
111
|
ref="roiEditor"
|
|
124
|
-
:
|
|
112
|
+
:imageSource="imageSource"
|
|
125
113
|
/>
|
|
126
114
|
<button @click="reloadImage">重新加载图片</button>
|
|
127
115
|
<button @click="exportCanvas">导出画布</button>
|
|
@@ -132,10 +120,11 @@ const handleLoadError = (error: any) => {
|
|
|
132
120
|
<script setup lang="ts">
|
|
133
121
|
import { ref, computed } from 'vue'
|
|
134
122
|
import { RoiEditor } from '@zzalai/leafer-multi-roi'
|
|
123
|
+
import '@zzalai/leafer-multi-roi/dist/leafer-multi-roi.css'
|
|
135
124
|
|
|
136
125
|
const roiEditor = ref<InstanceType<typeof RoiEditor> | null>(null)
|
|
137
126
|
const imageUrl = ref('https://picsum.photos/1280/1080')
|
|
138
|
-
const
|
|
127
|
+
const imageSource = computed(() => ({
|
|
139
128
|
id: 'test-image',
|
|
140
129
|
url: imageUrl.value
|
|
141
130
|
}))
|
|
@@ -280,8 +269,8 @@ const importCanvas = async (event: Event) => {
|
|
|
280
269
|
## 依赖
|
|
281
270
|
|
|
282
271
|
- Vue 3.3.0+
|
|
283
|
-
- LeaferUI 2.0
|
|
284
|
-
- Tinykeys
|
|
272
|
+
- LeaferUI 2.1.0+
|
|
273
|
+
- Tinykeys 4.0.0+
|
|
285
274
|
- @zzalai/leafer-undo-redo 1.0.3+
|
|
286
275
|
|
|
287
276
|
## 许可证
|
|
@@ -290,4 +279,4 @@ MIT License
|
|
|
290
279
|
|
|
291
280
|
## 贡献
|
|
292
281
|
|
|
293
|
-
欢迎提交 Issue 和 Pull Request!
|
|
282
|
+
欢迎提交 Issue 和 Pull Request!
|
package/README_EN.md
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
# LeaferJS Multi ROI Component
|
|
2
2
|
|
|
3
|
-
[
|
|
3
|
+
中文 | [English](README.md)
|
|
4
4
|
|
|
5
|
-
A Vue3 component
|
|
5
|
+
A Vue3 component for multi-region selection on images using LeaferJS, designed for image annotation and editing.
|
|
6
6
|
|
|
7
7
|
## Features
|
|
8
8
|
|
|
9
|
-
- 🖼️
|
|
10
|
-
- 📐
|
|
11
|
-
- 🔍
|
|
12
|
-
- ⌨️
|
|
13
|
-
- 🔄
|
|
14
|
-
- 📤
|
|
15
|
-
- 🎨
|
|
9
|
+
- 🖼️ Image loading and display
|
|
10
|
+
- 📐 Rectangle region drawing, editing, and deletion
|
|
11
|
+
- 🔍 Canvas zooming and panning
|
|
12
|
+
- ⌨️ Keyboard shortcuts support
|
|
13
|
+
- 🔄 Undo/redo functionality
|
|
14
|
+
- 📤 Canvas JSON export and import
|
|
15
|
+
- 🎨 CSS variables for custom styling
|
|
16
16
|
|
|
17
17
|
## Installation
|
|
18
18
|
|
|
@@ -36,26 +36,13 @@ pnpm add @zzalai/leafer-multi-roi
|
|
|
36
36
|
|
|
37
37
|
## Usage
|
|
38
38
|
|
|
39
|
-
###
|
|
40
|
-
|
|
41
|
-
```javascript
|
|
42
|
-
// main.ts
|
|
43
|
-
import { createApp } from 'vue'
|
|
44
|
-
import App from './App.vue'
|
|
45
|
-
import RoiEditor from '@zzalai/leafer-multi-roi'
|
|
46
|
-
|
|
47
|
-
const app = createApp(App)
|
|
48
|
-
app.use(RoiEditor)
|
|
49
|
-
app.mount('#app')
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
### Local Usage
|
|
39
|
+
### Basic Usage
|
|
53
40
|
|
|
54
41
|
```vue
|
|
55
42
|
<template>
|
|
56
43
|
<div class="app">
|
|
57
44
|
<RoiEditor
|
|
58
|
-
:
|
|
45
|
+
:imageSource="imageSource"
|
|
59
46
|
:options="editorOptions"
|
|
60
47
|
@roiChange="handleRoiChange"
|
|
61
48
|
@loadStart="handleLoadStart"
|
|
@@ -68,10 +55,11 @@ app.mount('#app')
|
|
|
68
55
|
<script setup lang="ts">
|
|
69
56
|
import { ref, computed } from 'vue'
|
|
70
57
|
import { RoiEditor } from '@zzalai/leafer-multi-roi'
|
|
58
|
+
import '@zzalai/leafer-multi-roi/dist/leafer-multi-roi.css'
|
|
71
59
|
|
|
72
60
|
// Image source
|
|
73
61
|
const imageUrl = ref('https://picsum.photos/1280/1080')
|
|
74
|
-
const
|
|
62
|
+
const imageSource = computed(() => ({
|
|
75
63
|
id: 'test-image',
|
|
76
64
|
url: imageUrl.value
|
|
77
65
|
}))
|
|
@@ -121,7 +109,7 @@ const handleLoadError = (error: any) => {
|
|
|
121
109
|
<div class="app">
|
|
122
110
|
<RoiEditor
|
|
123
111
|
ref="roiEditor"
|
|
124
|
-
:
|
|
112
|
+
:imageSource="imageSource"
|
|
125
113
|
/>
|
|
126
114
|
<button @click="reloadImage">Reload Image</button>
|
|
127
115
|
<button @click="exportCanvas">Export Canvas</button>
|
|
@@ -132,10 +120,11 @@ const handleLoadError = (error: any) => {
|
|
|
132
120
|
<script setup lang="ts">
|
|
133
121
|
import { ref, computed } from 'vue'
|
|
134
122
|
import { RoiEditor } from '@zzalai/leafer-multi-roi'
|
|
123
|
+
import '@zzalai/leafer-multi-roi/dist/leafer-multi-roi.css'
|
|
135
124
|
|
|
136
125
|
const roiEditor = ref<InstanceType<typeof RoiEditor> | null>(null)
|
|
137
126
|
const imageUrl = ref('https://picsum.photos/1280/1080')
|
|
138
|
-
const
|
|
127
|
+
const imageSource = computed(() => ({
|
|
139
128
|
id: 'test-image',
|
|
140
129
|
url: imageUrl.value
|
|
141
130
|
}))
|
|
@@ -183,18 +172,18 @@ const importCanvas = async (event: Event) => {
|
|
|
183
172
|
</script>
|
|
184
173
|
```
|
|
185
174
|
|
|
186
|
-
##
|
|
175
|
+
## Use Cases
|
|
187
176
|
|
|
188
|
-
- **Image Annotation
|
|
189
|
-
- **Object Detection
|
|
190
|
-
- **Image Analysis
|
|
191
|
-
- **Medical Imaging
|
|
192
|
-
- **E-commerce
|
|
177
|
+
- **Image Annotation**: Annotate regions of interest on images
|
|
178
|
+
- **Object Detection**: Generate training data for object detection models
|
|
179
|
+
- **Image Analysis**: Mark specific regions for analysis
|
|
180
|
+
- **Medical Imaging**: Mark lesion areas on medical images
|
|
181
|
+
- **E-commerce**: Mark different parts on product images
|
|
193
182
|
|
|
194
|
-
##
|
|
183
|
+
## Keyboard Shortcuts
|
|
195
184
|
|
|
196
|
-
|
|
|
197
|
-
|
|
185
|
+
| Shortcut | Function |
|
|
186
|
+
|----------|----------|
|
|
198
187
|
| V | Select tool |
|
|
199
188
|
| M | Rectangle tool |
|
|
200
189
|
| Ctrl+Z | Undo |
|
|
@@ -203,15 +192,15 @@ const importCanvas = async (event: Event) => {
|
|
|
203
192
|
| Ctrl++ | Zoom in |
|
|
204
193
|
| Ctrl+- | Zoom out |
|
|
205
194
|
| Ctrl+0 | Reset zoom |
|
|
206
|
-
| Alt | Show/hide
|
|
195
|
+
| Alt | Show/hide shortcut hints |
|
|
207
196
|
|
|
208
197
|
## Exposed Methods
|
|
209
198
|
|
|
210
|
-
- `getROIAnnotations()
|
|
211
|
-
- `getImageInfo()
|
|
212
|
-
- `exportCanvasJSON()
|
|
213
|
-
- `importCanvasJSON(jsonString, options)
|
|
214
|
-
- `loadImage()
|
|
199
|
+
- `getROIAnnotations()`: Get all ROI annotation data
|
|
200
|
+
- `getImageInfo()`: Get image information
|
|
201
|
+
- `exportCanvasJSON()`: Export canvas information as JSON string
|
|
202
|
+
- `importCanvasJSON(jsonString, options)`: Import canvas information from JSON string
|
|
203
|
+
- `loadImage()`: Manually load image
|
|
215
204
|
|
|
216
205
|
## CSS Customizable Variables
|
|
217
206
|
|
|
@@ -221,7 +210,7 @@ const importCanvas = async (event: Event) => {
|
|
|
221
210
|
--leafer-roi-color-primary: #007aff; /* Primary color */
|
|
222
211
|
--leafer-roi-color-background: #f5f5f5; /* Background color */
|
|
223
212
|
--leafer-roi-color-background-light: #f0f0f0; /* Light background color */
|
|
224
|
-
--leafer-roi-color-white: #fff; /* White
|
|
213
|
+
--leafer-roi-color-white: #fff; /* White */
|
|
225
214
|
--leafer-roi-color-text: #333; /* Text color */
|
|
226
215
|
--leafer-roi-color-text-secondary: #666; /* Secondary text color */
|
|
227
216
|
--leafer-roi-color-text-tertiary: #999999; /* Tertiary text color */
|
|
@@ -239,23 +228,23 @@ const importCanvas = async (event: Event) => {
|
|
|
239
228
|
--leafer-roi-size-zoom-value: 60px; /* Zoom value display width */
|
|
240
229
|
--leafer-roi-font-size-hotkey: 10px; /* Hotkey hint font size */
|
|
241
230
|
--leafer-roi-padding-hotkey: 1px 3px; /* Hotkey hint padding */
|
|
242
|
-
--leafer-roi-padding-error: 20px; /* Error
|
|
243
|
-
--leafer-roi-padding-error-button: 8px 16px; /* Error
|
|
231
|
+
--leafer-roi-padding-error: 20px; /* Error message padding */
|
|
232
|
+
--leafer-roi-padding-error-button: 8px 16px; /* Error button padding */
|
|
244
233
|
|
|
245
234
|
/* Border radius */
|
|
246
235
|
--leafer-roi-border-radius-tool-button: 4px; /* Tool button border radius */
|
|
247
236
|
--leafer-roi-border-radius-hotkey: 2px; /* Hotkey hint border radius */
|
|
248
237
|
--leafer-roi-border-radius-overlay: 8px; /* Overlay border radius */
|
|
249
|
-
--leafer-roi-border-radius-zoom: 8px; /* Zoom
|
|
238
|
+
--leafer-roi-border-radius-zoom: 8px; /* Zoom control border radius */
|
|
250
239
|
|
|
251
|
-
/*
|
|
240
|
+
/* Shadow */
|
|
252
241
|
--leafer-roi-shadow-tool-button: 0 2px 4px rgba(0, 0, 0, 0.1); /* Tool button shadow */
|
|
253
242
|
--leafer-roi-shadow-tool-button-active: 0 2px 4px rgba(0, 122, 255, 0.3); /* Tool button active shadow */
|
|
254
243
|
--leafer-roi-shadow-tool-button-hover: 0 4px 6px rgba(0, 0, 0, 0.1); /* Tool button hover shadow */
|
|
255
244
|
--leafer-roi-shadow-overlay: 0 4px 12px rgba(0, 0, 0, 0.1); /* Overlay shadow */
|
|
256
|
-
--leafer-roi-shadow-zoom: 0 2px 8px rgba(0, 0, 0, 0.15); /* Zoom
|
|
245
|
+
--leafer-roi-shadow-zoom: 0 2px 8px rgba(0, 0, 0, 0.15); /* Zoom control shadow */
|
|
257
246
|
|
|
258
|
-
/*
|
|
247
|
+
/* Animation */
|
|
259
248
|
--leafer-roi-transition-time: 0.2s; /* Transition animation duration */
|
|
260
249
|
--leafer-roi-animation-gradient: 2s; /* Gradient animation duration */
|
|
261
250
|
}
|
|
@@ -263,12 +252,12 @@ const importCanvas = async (event: Event) => {
|
|
|
263
252
|
|
|
264
253
|
## Events
|
|
265
254
|
|
|
266
|
-
- `roiChange
|
|
267
|
-
- `loadStart
|
|
268
|
-
- `loadSuccess
|
|
269
|
-
- `loadError
|
|
270
|
-
- `undoStateChange
|
|
271
|
-
- `redoStateChange
|
|
255
|
+
- `roiChange`: Triggered when ROI changes
|
|
256
|
+
- `loadStart`: Triggered when image starts loading
|
|
257
|
+
- `loadSuccess`: Triggered when image loads successfully
|
|
258
|
+
- `loadError`: Triggered when image fails to load
|
|
259
|
+
- `undoStateChange`: Triggered when undo state changes
|
|
260
|
+
- `redoStateChange`: Triggered when redo state changes
|
|
272
261
|
|
|
273
262
|
## Browser Compatibility
|
|
274
263
|
|
|
@@ -280,14 +269,14 @@ const importCanvas = async (event: Event) => {
|
|
|
280
269
|
## Dependencies
|
|
281
270
|
|
|
282
271
|
- Vue 3.3.0+
|
|
283
|
-
- LeaferUI 2.0
|
|
284
|
-
- Tinykeys
|
|
272
|
+
- LeaferUI 2.1.0+
|
|
273
|
+
- Tinykeys 4.0.0+
|
|
285
274
|
- @zzalai/leafer-undo-redo 1.0.3+
|
|
286
275
|
|
|
287
276
|
## License
|
|
288
277
|
|
|
289
278
|
MIT License
|
|
290
279
|
|
|
291
|
-
##
|
|
280
|
+
## Contributing
|
|
292
281
|
|
|
293
|
-
Welcome to submit
|
|
282
|
+
Welcome to submit issues and pull requests!
|