@xtctwins/tctwins-dxf-next-viewer 0.0.3 → 0.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 +273 -3
- package/dist/tctwins-dxf-next-viewer.css +1 -1
- package/dist/tctwins-dxf-next-viewer.css.gz +0 -0
- package/dist/tctwins-dxf-next-viewer.d.ts +4 -4
- package/dist/tctwins-dxf-next-viewer.es.js +800 -789
- package/dist/tctwins-dxf-next-viewer.es.js.gz +0 -0
- package/dist/tctwins-dxf-next-viewer.umd.js +26 -26
- package/dist/tctwins-dxf-next-viewer.umd.js.gz +0 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,5 +1,275 @@
|
|
|
1
|
-
#
|
|
1
|
+
# xtd 二维文件查看器 VUE3
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# 安装相关依赖
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## 网络请求 axios
|
|
6
|
+
|
|
7
|
+
<https://www.npmjs.com/package/axios>
|
|
8
|
+
|
|
9
|
+
```ssh
|
|
10
|
+
npm i axios
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## UI element-plus
|
|
14
|
+
|
|
15
|
+
<https://www.npmjs.com/package/element-plus>
|
|
16
|
+
|
|
17
|
+
```ssh
|
|
18
|
+
npm i element-plus
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## 事件总线 mitt
|
|
22
|
+
|
|
23
|
+
<https://www.npmjs.com/package/mitt>
|
|
24
|
+
|
|
25
|
+
```ssh
|
|
26
|
+
npm i mitt
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## 状态管理 pinia
|
|
30
|
+
|
|
31
|
+
<https://www.npmjs.com/package/pinia>
|
|
32
|
+
|
|
33
|
+
```ssh
|
|
34
|
+
npm i pinia
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## 3D three
|
|
38
|
+
|
|
39
|
+
<https://www.npmjs.com/package/three>
|
|
40
|
+
|
|
41
|
+
```ssh
|
|
42
|
+
npm i three
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
# 安装依赖
|
|
46
|
+
|
|
47
|
+
```ssh
|
|
48
|
+
npm i @xtctwins/tctwins-dxf-next-viewer
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
# 拷贝资源
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
拷贝文件夹@xtctwins/tctwins-dxf-next-viewer/dist/tctwins-dxf-viewer到项目public目录下,确保资源访问路径为:http://{访问域名}/tctwins-dxf-viewer/*
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
# Example
|
|
58
|
+
|
|
59
|
+
```vue
|
|
60
|
+
<template>
|
|
61
|
+
<TctwinsDxf
|
|
62
|
+
is-pc
|
|
63
|
+
reset
|
|
64
|
+
measure
|
|
65
|
+
comment
|
|
66
|
+
hidden
|
|
67
|
+
layer
|
|
68
|
+
anno
|
|
69
|
+
screenshot
|
|
70
|
+
:dxf-file-url="fileUrl"
|
|
71
|
+
:fonts="fonts"
|
|
72
|
+
:panel-right-keys="['anno']"
|
|
73
|
+
:panel-right-width="300"
|
|
74
|
+
@event-handle="eventHandle">
|
|
75
|
+
<template #leftpanel>
|
|
76
|
+
<!-- 左侧面板内容示例 -->
|
|
77
|
+
<!-- <transition name="dxf-panel-transition">
|
|
78
|
+
<PLayerTool v-if="props.isPc && toolbar.isToolActiveByKey('layer')" />
|
|
79
|
+
</transition> -->
|
|
80
|
+
</template>
|
|
81
|
+
<template #rightpanel>
|
|
82
|
+
<!-- 右侧面板内容示例 -->
|
|
83
|
+
<!-- <transition name="dxf-panel-transition">
|
|
84
|
+
<PCommentTool v-if="props.isPc && toolbar.isToolActiveByKey('comment')" />
|
|
85
|
+
</transition>
|
|
86
|
+
<transition name="dxf-panel-transition">
|
|
87
|
+
<PAnnoTool v-if="props.isPc && toolbar.isToolActiveByKey('anno')" />
|
|
88
|
+
</transition> -->
|
|
89
|
+
</template>
|
|
90
|
+
<template #toolpanel>
|
|
91
|
+
<!-- 工具面板内容示例 -->
|
|
92
|
+
<!-- <PToolbar
|
|
93
|
+
v-if="props.isPc"
|
|
94
|
+
:toolbars="toolbar.visibleTools" /> -->
|
|
95
|
+
</template>
|
|
96
|
+
</TctwinsDxf>
|
|
97
|
+
</template>
|
|
98
|
+
<script setup>
|
|
99
|
+
import { ref } from "vue";
|
|
100
|
+
import { TctwinsDxf } from "@xtctwins/tctwins-dxf-next-viewer";
|
|
101
|
+
const fileUrl = ref("https://xxxxxx/demo.xtd");
|
|
102
|
+
// 字体链接列表,默认字体可取tctwins-dxf-viewer/fonts下的文字路径
|
|
103
|
+
const fonts = ref([]);
|
|
104
|
+
const eventHandle = (event) => {
|
|
105
|
+
console.log("通知事件", event);
|
|
106
|
+
};
|
|
107
|
+
</script>
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
# Components
|
|
111
|
+
|
|
112
|
+
## 组件 TctwinsDxf
|
|
113
|
+
|
|
114
|
+
查看器组件
|
|
115
|
+
|
|
116
|
+
### Attributes
|
|
117
|
+
|
|
118
|
+
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
|
119
|
+
| --------------- | -------------------------------- | ----------- | ------ | --------- |
|
|
120
|
+
| isPc | 是否为 PC 端 | boolean | - | true |
|
|
121
|
+
| fonts | 字体链接列表 | string[] | - | - |
|
|
122
|
+
| dxfFileUrl | xtd 文件 url | string | - | - |
|
|
123
|
+
| dxfBuffer | xtd 文件 buffer | ArrayBuffer | - | - |
|
|
124
|
+
| reset | 开启重置功能 | boolean | - | false |
|
|
125
|
+
| measure | 开启测量功能 | boolean | - | false |
|
|
126
|
+
| comment | 开启批注功能 | boolean | - | false |
|
|
127
|
+
| anno | 开启标注功能 | boolean | - | false |
|
|
128
|
+
| layer | 开启图层功能 | boolean | - | false |
|
|
129
|
+
| hidden | 隐藏批注、测量、标注等信息 | boolean | - | false |
|
|
130
|
+
| screenshot | 开启截图功能 | boolean | - | false |
|
|
131
|
+
| panelLeftWidth | 右侧面板宽度 | number | - | 240 |
|
|
132
|
+
| panelRightWidth | 右侧面板宽度 | number | - | 240 |
|
|
133
|
+
| panelLeftKeys | 左侧面板显示内容 | string[] | - | ['layer'] |
|
|
134
|
+
| panelRightKeys | 右侧面板显示内容 | string[] | - | [] |
|
|
135
|
+
| panelExtraKeys | 操作其他功能时,不需要关闭的面板 | number | - | ['layer'] |
|
|
136
|
+
|
|
137
|
+
### Events
|
|
138
|
+
|
|
139
|
+
| 事件名 | 说明 | 回调参数 |
|
|
140
|
+
| ----------- | -------- | ------------------------------------------------------------- |
|
|
141
|
+
| eventHandle | 事件总线 | event: { eventTarget: string;eventName: string;content: any;} |
|
|
142
|
+
|
|
143
|
+
### Slots
|
|
144
|
+
|
|
145
|
+
| 方法名 | 说明 |
|
|
146
|
+
| ---------- | ------------ |
|
|
147
|
+
| leftpanel | 左侧面板内容 |
|
|
148
|
+
| toolpanel | 工具面板内容 |
|
|
149
|
+
| rightpanel | 右侧面板内容 |
|
|
150
|
+
|
|
151
|
+
## 组件 TctwinsDxfPanel
|
|
152
|
+
|
|
153
|
+
自定义左侧或右侧面板组件时使用,可添加到 TctwinsDxf 组件的 leftpanel 或 rightpanel 插槽中使用
|
|
154
|
+
|
|
155
|
+
### Attributes
|
|
156
|
+
|
|
157
|
+
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
|
158
|
+
| ----- | ---- | ------ | ------ | ------ |
|
|
159
|
+
| title | 标题 | string | - | - |
|
|
160
|
+
|
|
161
|
+
### Events
|
|
162
|
+
|
|
163
|
+
| 事件名 | 说明 | 回调参数 |
|
|
164
|
+
| ---------- | -------- | -------- |
|
|
165
|
+
| closePanel | 关闭面板 | - |
|
|
166
|
+
|
|
167
|
+
### Slots
|
|
168
|
+
|
|
169
|
+
| 方法名 | 说明 |
|
|
170
|
+
| ------- | ---- |
|
|
171
|
+
| default | - |
|
|
172
|
+
|
|
173
|
+
## 组件 TctwinsDxfDialog
|
|
174
|
+
|
|
175
|
+
自定义左侧或右侧可拖动面板组件时使用,可添加到 TctwinsDxf 组件的 leftpanel 或 rightpanel 插槽中使用
|
|
176
|
+
|
|
177
|
+
### Attributes
|
|
178
|
+
|
|
179
|
+
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
|
180
|
+
| ----- | -------- | ---- | ------ | ------ |
|
|
181
|
+
| title | 标题名称 | - | - | 标题 |
|
|
182
|
+
| width | 宽度 | - | - | 240 |
|
|
183
|
+
|
|
184
|
+
### Events
|
|
185
|
+
|
|
186
|
+
| 事件名 | 说明 | 回调参数 |
|
|
187
|
+
| ---------- | -------- | -------- |
|
|
188
|
+
| closePanel | 关闭面板 | - |
|
|
189
|
+
|
|
190
|
+
### Slots
|
|
191
|
+
|
|
192
|
+
| 方法名 | 说明 |
|
|
193
|
+
| ------- | ---- |
|
|
194
|
+
| default | - |
|
|
195
|
+
|
|
196
|
+
## 组件 TctwinsDxfTool
|
|
197
|
+
|
|
198
|
+
自定义工具面板组件时使用,可添加到 TctwinsDxf 组件的 toolpanel 插槽中使用
|
|
199
|
+
|
|
200
|
+
### Attributes
|
|
201
|
+
|
|
202
|
+
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
|
203
|
+
| ----------- | -------------------------------- | ------- | ------ | ------ |
|
|
204
|
+
| hideAllTool | 工具显示时,是否隐藏其他全部按钮 | boolean | - | false |
|
|
205
|
+
|
|
206
|
+
### Slots
|
|
207
|
+
|
|
208
|
+
| 方法名 | 说明 |
|
|
209
|
+
| ------- | ---- |
|
|
210
|
+
| default | - |
|
|
211
|
+
|
|
212
|
+
# 工具方法
|
|
213
|
+
|
|
214
|
+
## 方法: setToolStatusByKey(key: string, isOpen?: boolean)
|
|
215
|
+
|
|
216
|
+
激活或关闭工具
|
|
217
|
+
|
|
218
|
+
### 参数
|
|
219
|
+
|
|
220
|
+
| 参数 | 说明 |
|
|
221
|
+
| ------ | -------- |
|
|
222
|
+
| key | 工具 key |
|
|
223
|
+
| isOpen | 是否激活 |
|
|
224
|
+
|
|
225
|
+
### 示例
|
|
226
|
+
|
|
227
|
+
```ts
|
|
228
|
+
// 激活重置工具
|
|
229
|
+
setToolStatusByKey("reset", true);
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
## 方法: isToolStatusByKey(key: string)
|
|
233
|
+
|
|
234
|
+
判断工具是否激活
|
|
235
|
+
|
|
236
|
+
### 参数
|
|
237
|
+
|
|
238
|
+
| 参数 | 说明 |
|
|
239
|
+
| ---- | -------- |
|
|
240
|
+
| key | 工具 key |
|
|
241
|
+
|
|
242
|
+
### 示例
|
|
243
|
+
|
|
244
|
+
```ts
|
|
245
|
+
if (isToolStatusByKey("reset")) {
|
|
246
|
+
console.log("重置工具已激活");
|
|
247
|
+
}
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
## 方法: closeAllTool()
|
|
251
|
+
|
|
252
|
+
关闭所有工具
|
|
253
|
+
|
|
254
|
+
### 示例
|
|
255
|
+
|
|
256
|
+
```ts
|
|
257
|
+
closeAllTool();
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
## 方法: toggleAllTool(showState: boolean)
|
|
261
|
+
|
|
262
|
+
显示或隐藏所有工具
|
|
263
|
+
|
|
264
|
+
### 参数
|
|
265
|
+
|
|
266
|
+
| 参数 | 说明 |
|
|
267
|
+
| --------- | -------------- |
|
|
268
|
+
| showState | 显示或隐藏工具 |
|
|
269
|
+
|
|
270
|
+
### 示例
|
|
271
|
+
|
|
272
|
+
```ts
|
|
273
|
+
// 显示所有工具
|
|
274
|
+
toggleAllTool(true);
|
|
275
|
+
```
|