kfb-view 2.1.13 → 2.1.16

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.1.13",
4
+ "version": "2.1.16",
5
5
  "author": "qifeng.fan <qifeng.fan@hzztai.com>",
6
6
  "license": "MIT",
7
7
  "main": "lib/kfb-view.js",
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  HAS_REGION_TYPES, MARKS,
3
- NO_NORMAL_REGION_TYPES, POINT_TYPES,
3
+ NO_NORMAL_REGION_TYPES, POINT_TYPES, POLYGON, REGION_TYPES,
4
4
  } from '../../const/mark';
5
5
  import {ViewerCommon} from '../common/common';
6
6
  import * as Tools from '../../tool';
@@ -59,7 +59,8 @@ export class Shape extends ViewerCommon {
59
59
  this.clearCanvas();
60
60
  // 区域标注列表
61
61
  const regionLabelList = this.labelList.filter(
62
- ({tool, isClose}) => HAS_REGION_TYPES.includes(tool) && isClose).
62
+ ({tool, isClose}) => REGION_TYPES.includes(tool) || isClose && tool ===
63
+ POLYGON).
63
64
  map((item) => ({
64
65
  ...item,
65
66
  child: [],
@@ -42,13 +42,13 @@ class Combination extends Brush {
42
42
  points[0].y + region.height - centerPoint.y);
43
43
  ctx.lineTo(points[0].x - centerPoint.x, points[0].y - centerPoint.y);
44
44
  } else if (tool === ELLIPSE) {
45
- ctx.drawOval(0, 0, region.width / 2, region.height / 2, false);
45
+ ctx.drawOval(0, 0, Math.abs(region.width / 2),
46
+ Math.abs(region.height / 2), false);
46
47
  }
47
48
  ctx.closePath();
48
49
  ctx.restore();
49
50
  children.forEach(({tool, points}) => {
50
51
  ctx.save();
51
- ctx.beginPath();
52
52
  const region = pointsToRegion(points);
53
53
  const centerPoint = {
54
54
  x: region.x + region.width / 2,
@@ -71,11 +71,8 @@ class Combination extends Brush {
71
71
  points[0].y - centerPoint.y);
72
72
  ctx.lineTo(points[0].x - centerPoint.x, points[0].y - centerPoint.y);
73
73
  } else if (tool === ELLIPSE) {
74
- ctx.drawOval(0, 0, region.width / 2, region.height / 2, true);
75
- }
76
- if (this.options.fillStyle) {
77
- ctx.fillStyle = this.options.fillStyle;
78
- ctx.fill();
74
+ ctx.drawOval(0, 0, Math.abs(region.width / 2),
75
+ Math.abs(region.height / 2), true);
79
76
  }
80
77
  ctx.restore();
81
78
  });
@@ -60,6 +60,7 @@ CanvasRenderingContext2D.prototype.drawOval = function drawOval(
60
60
  this.save();
61
61
  // 选择a、b中的较大者作为arc方法的半径参数
62
62
  const r = (a > b) ? a : b;
63
+ console.log(r);
63
64
  const ratioX = a / r; // 横轴缩放比率
64
65
  const ratioY = b / r; // 纵轴缩放比率
65
66
  this.scale(ratioX, ratioY); // 进行缩放(均匀压缩)
package/src/view.js CHANGED
@@ -106,7 +106,7 @@ export default class KfbView extends EventEmitter {
106
106
 
107
107
  appendLabelList(list) {
108
108
  this.labelList = [
109
- ...this.labelList, list.map((item) => new LabelModel({
109
+ ...this.labelList, ...list.map((item) => new LabelModel({
110
110
  ...item,
111
111
  region: item.region || pointsToRegion(item.points),
112
112
  strokeStyle: item.strokeStyle || '#0000FF',