@zzalai/leafer-point-annotation 1.0.0 → 1.1.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/README.md +57 -2
- package/README_EN.md +57 -2
- package/docs/assets/{index-L8gL3x2V.js → index-CPn8AE3g.js} +1 -1
- package/docs/assets/index-Dqqq7qvI.css +1 -0
- package/docs/index.html +2 -2
- package/package.json +9 -3
- package/project-docs/ARCHITECTURE.md +47 -4
- package/project-docs/IMPLEMENTATION_PLAN.md +37 -19
- package/project-docs/REQUIREMENTS.md +27 -8
- package/src/App.vue +8 -5
- package/src/components/PointAnnotation.vue +224 -25
- package/tsconfig.json +5 -1
- package/vite.config.ts +6 -1
- package/docs/assets/index-DGiYiG5f.css +0 -1
package/README.md
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
- 🔍 **画布缩放** - 支持缩放、平移、重置
|
|
15
15
|
- ⌨️ **热键支持** - V/P/B/E/Ctrl+Z/Ctrl+Y 等
|
|
16
16
|
- 📱 **响应式设计** - Vue3 组件化架构
|
|
17
|
+
- 🖼️ **本地上传** - 支持本地图片上传和拖拽上传
|
|
17
18
|
|
|
18
19
|
## 安装
|
|
19
20
|
|
|
@@ -37,7 +38,7 @@ pnpm add @zzalai/leafer-point-annotation
|
|
|
37
38
|
|
|
38
39
|
## 快速开始
|
|
39
40
|
|
|
40
|
-
###
|
|
41
|
+
### 使用远程图片
|
|
41
42
|
|
|
42
43
|
```vue
|
|
43
44
|
<template>
|
|
@@ -59,6 +60,7 @@ pnpm add @zzalai/leafer-point-annotation
|
|
|
59
60
|
<script setup lang="ts">
|
|
60
61
|
import { ref, computed } from 'vue'
|
|
61
62
|
import { PointAnnotation } from '@zzalai/leafer-point-annotation'
|
|
63
|
+
import '@zzalai/leafer-point-annotation/dist/leafer-point-annotation.css'
|
|
62
64
|
|
|
63
65
|
const annotationRef = ref<InstanceType<typeof PointAnnotation> | null>(null)
|
|
64
66
|
const imageSource = computed(() => ({
|
|
@@ -126,13 +128,66 @@ const exportMask = async () => {
|
|
|
126
128
|
</style>
|
|
127
129
|
```
|
|
128
130
|
|
|
131
|
+
### 使用本地图片上传
|
|
132
|
+
|
|
133
|
+
不提供 `imageSource` prop 时,会显示本地上传界面,支持点击选择或拖拽上传。
|
|
134
|
+
|
|
135
|
+
```vue
|
|
136
|
+
<template>
|
|
137
|
+
<div class="demo-container">
|
|
138
|
+
<PointAnnotation
|
|
139
|
+
ref="annotationRef"
|
|
140
|
+
:options="options"
|
|
141
|
+
@pointChange="handlePointChange"
|
|
142
|
+
@loadSuccess="handleLoadSuccess"
|
|
143
|
+
/>
|
|
144
|
+
</div>
|
|
145
|
+
</template>
|
|
146
|
+
|
|
147
|
+
<script setup lang="ts">
|
|
148
|
+
import { ref } from 'vue'
|
|
149
|
+
import { PointAnnotation } from '@zzalai/leafer-point-annotation'
|
|
150
|
+
import '@zzalai/leafer-point-annotation/dist/leafer-point-annotation.css'
|
|
151
|
+
|
|
152
|
+
const annotationRef = ref<InstanceType<typeof PointAnnotation> | null>(null)
|
|
153
|
+
|
|
154
|
+
const options = ref({
|
|
155
|
+
pointStyle: {
|
|
156
|
+
circleFill: '#ff4d4f',
|
|
157
|
+
circleStroke: '#ffffff',
|
|
158
|
+
labelBackgroundColor: '#ffffff'
|
|
159
|
+
},
|
|
160
|
+
brushStyle: {
|
|
161
|
+
color: '#ff4d4f',
|
|
162
|
+
opacity: 0.55,
|
|
163
|
+
size: 100
|
|
164
|
+
}
|
|
165
|
+
})
|
|
166
|
+
|
|
167
|
+
const handlePointChange = (points) => {
|
|
168
|
+
console.log('标注点变化:', points)
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const handleLoadSuccess = () => {
|
|
172
|
+
console.log('图片加载成功')
|
|
173
|
+
}
|
|
174
|
+
</script>
|
|
175
|
+
|
|
176
|
+
<style scoped>
|
|
177
|
+
.demo-container {
|
|
178
|
+
width: 100%;
|
|
179
|
+
height: 600px;
|
|
180
|
+
}
|
|
181
|
+
</style>
|
|
182
|
+
```
|
|
183
|
+
|
|
129
184
|
## API 文档
|
|
130
185
|
|
|
131
186
|
### Props
|
|
132
187
|
|
|
133
188
|
| 属性名 | 类型 | 默认值 | 说明 |
|
|
134
189
|
|--------|------|--------|------|
|
|
135
|
-
| imageSource | `{ id?: string; url: string }` |
|
|
190
|
+
| imageSource | `{ id?: string; url: string }` | `null` | 图片源配置(可选,不提供时显示本地上传入口) |
|
|
136
191
|
| options | `Object` | `{}` | 配置选项 |
|
|
137
192
|
|
|
138
193
|
#### Options 配置
|
package/README_EN.md
CHANGED
|
@@ -14,6 +14,7 @@ A point annotation and brush painting tool based on Vue3 + LeaferJS, supporting
|
|
|
14
14
|
- 🔍 **Canvas Zoom** - Zoom, pan, reset support
|
|
15
15
|
- ⌨️ **Hotkeys** - V/P/B/E/Ctrl+Z/Ctrl+Y and more
|
|
16
16
|
- 📱 **Responsive Design** - Vue3 component architecture
|
|
17
|
+
- 🖼️ **Local Upload** - Support local image upload and drag-and-drop
|
|
17
18
|
|
|
18
19
|
## Installation
|
|
19
20
|
|
|
@@ -37,7 +38,7 @@ pnpm add @zzalai/leafer-point-annotation
|
|
|
37
38
|
|
|
38
39
|
## Quick Start
|
|
39
40
|
|
|
40
|
-
###
|
|
41
|
+
### Using Remote Image
|
|
41
42
|
|
|
42
43
|
```vue
|
|
43
44
|
<template>
|
|
@@ -59,6 +60,7 @@ pnpm add @zzalai/leafer-point-annotation
|
|
|
59
60
|
<script setup lang="ts">
|
|
60
61
|
import { ref, computed } from 'vue'
|
|
61
62
|
import { PointAnnotation } from '@zzalai/leafer-point-annotation'
|
|
63
|
+
import '@zzalai/leafer-point-annotation/dist/leafer-point-annotation.css'
|
|
62
64
|
|
|
63
65
|
const annotationRef = ref<InstanceType<typeof PointAnnotation> | null>(null)
|
|
64
66
|
const imageSource = computed(() => ({
|
|
@@ -126,13 +128,66 @@ const exportMask = async () => {
|
|
|
126
128
|
</style>
|
|
127
129
|
```
|
|
128
130
|
|
|
131
|
+
### Using Local Image Upload
|
|
132
|
+
|
|
133
|
+
When not providing the `imageSource` prop, the local upload interface will be displayed, supporting click to select or drag and drop.
|
|
134
|
+
|
|
135
|
+
```vue
|
|
136
|
+
<template>
|
|
137
|
+
<div class="demo-container">
|
|
138
|
+
<PointAnnotation
|
|
139
|
+
ref="annotationRef"
|
|
140
|
+
:options="options"
|
|
141
|
+
@pointChange="handlePointChange"
|
|
142
|
+
@loadSuccess="handleLoadSuccess"
|
|
143
|
+
/>
|
|
144
|
+
</div>
|
|
145
|
+
</template>
|
|
146
|
+
|
|
147
|
+
<script setup lang="ts">
|
|
148
|
+
import { ref } from 'vue'
|
|
149
|
+
import { PointAnnotation } from '@zzalai/leafer-point-annotation'
|
|
150
|
+
import '@zzalai/leafer-point-annotation/dist/leafer-point-annotation.css'
|
|
151
|
+
|
|
152
|
+
const annotationRef = ref<InstanceType<typeof PointAnnotation> | null>(null)
|
|
153
|
+
|
|
154
|
+
const options = ref({
|
|
155
|
+
pointStyle: {
|
|
156
|
+
circleFill: '#ff4d4f',
|
|
157
|
+
circleStroke: '#ffffff',
|
|
158
|
+
labelBackgroundColor: '#ffffff'
|
|
159
|
+
},
|
|
160
|
+
brushStyle: {
|
|
161
|
+
color: '#ff4d4f',
|
|
162
|
+
opacity: 0.55,
|
|
163
|
+
size: 100
|
|
164
|
+
}
|
|
165
|
+
})
|
|
166
|
+
|
|
167
|
+
const handlePointChange = (points) => {
|
|
168
|
+
console.log('Points changed:', points)
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const handleLoadSuccess = () => {
|
|
172
|
+
console.log('Image loaded successfully')
|
|
173
|
+
}
|
|
174
|
+
</script>
|
|
175
|
+
|
|
176
|
+
<style scoped>
|
|
177
|
+
.demo-container {
|
|
178
|
+
width: 100%;
|
|
179
|
+
height: 600px;
|
|
180
|
+
}
|
|
181
|
+
</style>
|
|
182
|
+
```
|
|
183
|
+
|
|
129
184
|
## API Documentation
|
|
130
185
|
|
|
131
186
|
### Props
|
|
132
187
|
|
|
133
188
|
| Property | Type | Default | Description |
|
|
134
189
|
|----------|------|---------|-------------|
|
|
135
|
-
| imageSource | `{ id?: string; url: string }` |
|
|
190
|
+
| imageSource | `{ id?: string; url: string }` | `null` | Image source configuration (optional, shows upload UI when not provided) |
|
|
136
191
|
| options | `Object` | `{}` | Configuration options |
|
|
137
192
|
|
|
138
193
|
#### Options Configuration
|