kfb-view 2.3.0 → 2.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "kfb-view",
3
3
  "description": "一个在线kfb的阅片软件",
4
- "version": "2.3.0",
4
+ "version": "2.3.1",
5
5
  "author": "qifeng.fan <qifeng.fan@hzztai.com>",
6
6
  "license": "MIT",
7
7
  "main": "lib/kfb-view.js",
@@ -573,7 +573,15 @@ export class Area extends ViewerCommon {
573
573
  }, position === 4);
574
574
  this.drawPoint(points[1], position === 7);
575
575
  } else if (type === RECTANGLE) {
576
- getRectPoint(points[0], points[1]).forEach((point, i) => {
576
+ const sp = {
577
+ x: points[0].x < points[1].x ? points[0].x : points[1].x,
578
+ y: points[0].y < points[1].y ? points[0].y : points[1].y,
579
+ };
580
+ const ep = {
581
+ x: points[0].x > points[1].x ? points[0].x : points[1].x,
582
+ y: points[0].y > points[1].y ? points[0].y : points[1].y,
583
+ };
584
+ getRectPoint(sp, ep).forEach((point, i) => {
577
585
  this.drawLine(point, i, position === i);
578
586
  });
579
587
  } else if (REGION_TYPES.includes(type)) {
@@ -190,14 +190,30 @@ export class ViewerCommon extends EventEmitter {
190
190
  if (label.points.length <= 1) return content;
191
191
  const scale = this.getImageZoom(true) / label.scale;
192
192
  const region = pointsToRegion(label.points);
193
- const startPoint = {x: region.x, y: region.y};
194
- const endPoint = {x: region.x + region.width, y: region.y + region.height};
193
+ const _startPoint = {x: region.x, y: region.y};
194
+ const _endPoint = {x: region.x + region.width, y: region.y + region.height};
195
+ const startPoint = {
196
+ x: _startPoint.x < _endPoint.x ? _startPoint.x : _endPoint.x,
197
+ y: _startPoint.y < _endPoint.y ? _startPoint.y : _endPoint.y,
198
+ };
199
+ const endPoint = {
200
+ x: _startPoint.x > _endPoint.x ? _startPoint.x : _endPoint.x,
201
+ y: _startPoint.y > _endPoint.y ? _startPoint.y : _endPoint.y,
202
+ };
195
203
  /* const p1 = label.points[0];
196
204
  const p2 = label.points[label.points.length - 1];*/
197
205
  switch (label.tool) {
198
206
  case ARROW:
199
207
  case BILATERAL:
200
208
  case LINE: {
209
+ const startPoint = {
210
+ x: _startPoint.x < _endPoint.x ? _startPoint.x : _endPoint.x,
211
+ y: _startPoint.x < _endPoint.x ? _startPoint.y : _endPoint.y,
212
+ };
213
+ const endPoint = {
214
+ x: _startPoint.x > _endPoint.x ? _startPoint.x : _endPoint.x,
215
+ y: _startPoint.x > _endPoint.x ? _startPoint.y : _endPoint.y,
216
+ };
201
217
  const w = Math.abs(endPoint.x - startPoint.x);
202
218
  const h = Math.abs(endPoint.y - startPoint.y);
203
219
  const center = {
@@ -4,6 +4,7 @@ export class LabelModel {
4
4
  constructor(data = {}) {
5
5
  if (!data) data = {};
6
6
  this.id = data.id; // id标识
7
+ this.parent_id = data.parent_id; // 父id标识
7
8
  this.lineWidth = !data.lineWidth ?
8
9
  (data.tool === STAR ? 15 :
9
10
  data.tool === FLAG ? 30 : data.tool === DOT ? 10 : 2) :