kfb-view 3.2.9 → 3.3.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/lib/kfb-view.cjs.js +2 -0
- package/lib/kfb-view.es.js +2 -0
- package/lib/kfb-view.es.js.LICENSE.txt +9 -0
- package/lib/kfb-view.umd.js +2 -0
- package/lib/kfb-view.umd.js.LICENSE.txt +9 -0
- package/package.json +27 -31
- package/src/components/shape/index.js +1 -0
- package/src/model/label.model.js +4 -2
- package/src/view.js +23 -11
- package/lib/kfb-view.js +0 -2
- /package/lib/{kfb-view.js.LICENSE.txt → kfb-view.cjs.js.LICENSE.txt} +0 -0
package/package.json
CHANGED
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kfb-view",
|
|
3
3
|
"description": "一个在线kfb的阅片软件",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.3.1",
|
|
5
5
|
"author": "qifeng.fan <qifeng.fan@hzztai.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
|
-
"main": "lib/kfb-view.js",
|
|
7
|
+
"main": "lib/kfb-view.cjs.js",
|
|
8
|
+
"module": "lib/kfb-view.es.js",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./lib/kfb-view.es.js",
|
|
12
|
+
"require": "./lib/kfb-view.cjs.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
8
15
|
"scripts": {
|
|
9
|
-
"build:dev": "npm run clean:dist && npm run webpack -- --mode development --config config/webpack.dev.conf.js --progress --profile",
|
|
10
|
-
"build:prod": "npm run clean:dist && npm run webpack -- --mode production --config config/webpack.prod.conf.js --progress --profile --bail",
|
|
11
16
|
"build:lib": "npm run clean:lib && npm run webpack -- --mode production --config config/webpack.lib.conf.js --progress --profile --bail",
|
|
12
|
-
"build": "npm run build:
|
|
13
|
-
"clean:dist": "npm run rimraf -- dist",
|
|
17
|
+
"build": "npm run build:lib",
|
|
14
18
|
"clean:lib": "npm run rimraf -- lib",
|
|
15
19
|
"rimraf": "rimraf",
|
|
16
|
-
"server:
|
|
17
|
-
"server:dev": "npm run webpack-dev-server -- --mode development --config config/webpack.dev.conf.js --progress --profile --wascreenshottch",
|
|
20
|
+
"server:dev": "npm run webpack-dev-server -- --mode development --config config/webpack.dev.conf.js --hot --progress --profile",
|
|
18
21
|
"server": "npm run server:dev",
|
|
19
22
|
"start": "npm run build",
|
|
20
23
|
"webpack-dev-server": "node --max_old_space_size=4096 node_modules/webpack-dev-server/bin/webpack-dev-server.js",
|
|
@@ -25,7 +28,6 @@
|
|
|
25
28
|
"mitt": "^3.0.1"
|
|
26
29
|
},
|
|
27
30
|
"devDependencies": {
|
|
28
|
-
"axios": "^1.6.5",
|
|
29
31
|
"@babel/core": "^7.0.0",
|
|
30
32
|
"@babel/plugin-proposal-class-properties": "^7.0.0",
|
|
31
33
|
"@babel/plugin-proposal-decorators": "^7.0.0",
|
|
@@ -43,37 +45,31 @@
|
|
|
43
45
|
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
|
|
44
46
|
"@babel/plugin-syntax-import-meta": "^7.0.0",
|
|
45
47
|
"@babel/preset-env": "^7.0.0",
|
|
46
|
-
"@purtuga/esm-webpack-plugin": "^1.5.0",
|
|
47
48
|
"autoprefixer": "^8.6.4",
|
|
48
|
-
"
|
|
49
|
-
"babel-
|
|
50
|
-
"
|
|
49
|
+
"axios": "^1.6.5",
|
|
50
|
+
"babel-eslint": "^10.1.0",
|
|
51
|
+
"babel-loader": "^10.0.0",
|
|
51
52
|
"copy-webpack-plugin": "^4.5.2",
|
|
52
53
|
"core-js": "^3.6.5",
|
|
53
|
-
"css-loader": "^
|
|
54
|
+
"css-loader": "^7.1.2",
|
|
54
55
|
"eslint": "^5.0.1",
|
|
55
56
|
"eslint-config-google": "^0.9.1",
|
|
56
57
|
"eslint-friendly-formatter": "^4.0.1",
|
|
57
|
-
"eslint-loader": "^2.0.0",
|
|
58
58
|
"eslint-plugin-html": "^4.0.5",
|
|
59
|
-
"
|
|
60
|
-
"html-
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"postcss-
|
|
65
|
-
"postcss-loader": "^2.1.5",
|
|
59
|
+
"html-loader": "^5.1.0",
|
|
60
|
+
"html-webpack-plugin": "^5.6.3",
|
|
61
|
+
"mini-css-extract-plugin": "^2.9.2",
|
|
62
|
+
"sass": "^1.89.1",
|
|
63
|
+
"postcss-import": "^16.1.1",
|
|
64
|
+
"postcss-loader": "^8.1.1",
|
|
66
65
|
"rimraf": "^2.6.2",
|
|
67
|
-
"sass-loader": "^
|
|
68
|
-
"
|
|
69
|
-
"style-loader": "^0.21.0",
|
|
66
|
+
"sass-loader": "^16.0.5",
|
|
67
|
+
"style-loader": "^4.0.0",
|
|
70
68
|
"terser-webpack-plugin": "^4.2.2",
|
|
71
|
-
"
|
|
72
|
-
"webpack": "^
|
|
73
|
-
"webpack-
|
|
74
|
-
"webpack-
|
|
75
|
-
"webpack-merge": "^4.1.3",
|
|
76
|
-
"worker-loader": "^2.0.0"
|
|
69
|
+
"webpack": "^5.100.1",
|
|
70
|
+
"webpack-cli": "^6.0.1",
|
|
71
|
+
"webpack-dev-server": "^5.2.2",
|
|
72
|
+
"webpack-merge": "^6.0.1"
|
|
77
73
|
},
|
|
78
74
|
"engines": {
|
|
79
75
|
"node": ">= 6.11.5",
|
|
@@ -60,6 +60,7 @@ export class Shape extends ViewerCommon {
|
|
|
60
60
|
// 区域标注列表
|
|
61
61
|
const labelList = this.labelList.filter((item) => {
|
|
62
62
|
if (item.show === false) return false;
|
|
63
|
+
if (item.custom) return false;
|
|
63
64
|
if (!this[item.tool]) return false;
|
|
64
65
|
if (!this.isInCanvas(item.region, bounds)) return false;
|
|
65
66
|
if ((REGION_TYPES.includes(item.tool) || item.isClose && item.tool ===
|
package/src/model/label.model.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {DOT, FLAG, STAR} from '../const/mark';
|
|
1
|
+
import {DOT, FLAG, IMAGE, STAR} from '../const/mark';
|
|
2
2
|
|
|
3
3
|
export class LabelModel {
|
|
4
4
|
constructor(data = {}) {
|
|
@@ -25,11 +25,13 @@ export class LabelModel {
|
|
|
25
25
|
this.resize = data.resize; // 是否可拖动大小
|
|
26
26
|
this.isROI = data.isROI ?? false; // 是否是ROI
|
|
27
27
|
this.isClose = data.isClose ?? true; // 是否是闭合标注
|
|
28
|
+
this.custom = data.custom ?? false; // 是否是自定义的标注
|
|
28
29
|
this.select = data.select ?? false; // 是否是选中状态
|
|
29
30
|
this.show = data.show ?? true; // 是否显示
|
|
31
|
+
this.subType = data.subType; // 自定义类型
|
|
30
32
|
this.__other__ = data.__other__ || {}; // 其他信息
|
|
31
33
|
this.__data__ = data.__data__ ?? data; // 记录原始数据
|
|
32
|
-
if (this.src) {
|
|
34
|
+
if (this.src && this.tool === IMAGE) {
|
|
33
35
|
this.img = new Image();
|
|
34
36
|
this.img.src = this.src;
|
|
35
37
|
this.imgLoadSuccess = false;
|
package/src/view.js
CHANGED
|
@@ -2,7 +2,7 @@ import openSeadragon from './plugin/openseadragon/openseadragon';
|
|
|
2
2
|
import './util/canvas';
|
|
3
3
|
import {EventEmitter} from './util/event-emitter';
|
|
4
4
|
import {$, dataType, deepClone} from './util';
|
|
5
|
-
import {pointsToRegion} from './util/calculate';
|
|
5
|
+
import {pointsToRegion, regionToPoint} from './util/calculate';
|
|
6
6
|
import * as COMPONENTS from './const/component';
|
|
7
7
|
import * as EVENTS from './const/event';
|
|
8
8
|
import * as Components from './components';
|
|
@@ -133,11 +133,17 @@ export default class KfbView extends EventEmitter {
|
|
|
133
133
|
* @param {Array} list
|
|
134
134
|
*/
|
|
135
135
|
initLabelList(list) {
|
|
136
|
-
this.labelList = list.map((item) =>
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
136
|
+
this.labelList = list.map((item) => {
|
|
137
|
+
if (!item.points?.length) {
|
|
138
|
+
const {startPoint, endPoint} = regionToPoint(item.region);
|
|
139
|
+
item.points = [startPoint, endPoint];
|
|
140
|
+
}
|
|
141
|
+
return new LabelModel({
|
|
142
|
+
...item,
|
|
143
|
+
region: item.region || pointsToRegion(item.points),
|
|
144
|
+
__data__: deepClone(item),
|
|
145
|
+
});
|
|
146
|
+
});
|
|
141
147
|
this.board?.setLabelList?.(this.labelList);
|
|
142
148
|
this.shape?.setLabelList?.(this.labelList);
|
|
143
149
|
this.area?.setLabelList?.(this.labelList);
|
|
@@ -145,11 +151,17 @@ export default class KfbView extends EventEmitter {
|
|
|
145
151
|
|
|
146
152
|
appendLabelList(list) {
|
|
147
153
|
this.labelList = [
|
|
148
|
-
...this.labelList, ...list.map((item) =>
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
154
|
+
...this.labelList, ...list.map((item) => {
|
|
155
|
+
if (!item.points?.length) {
|
|
156
|
+
const {startPoint, endPoint} = regionToPoint(item.region);
|
|
157
|
+
item.points = [startPoint, endPoint];
|
|
158
|
+
}
|
|
159
|
+
return new LabelModel({
|
|
160
|
+
...item,
|
|
161
|
+
region: item.region || pointsToRegion(item.points),
|
|
162
|
+
__data__: deepClone(item),
|
|
163
|
+
});
|
|
164
|
+
})];
|
|
153
165
|
this.board?.setLabelList?.(this.labelList);
|
|
154
166
|
this.shape?.setLabelList?.(this.labelList);
|
|
155
167
|
this.area?.setLabelList?.(this.labelList);
|