kfb-view 2.3.4 → 2.3.6

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.4",
4
+ "version": "2.3.6",
5
5
  "author": "qifeng.fan <qifeng.fan@hzztai.com>",
6
6
  "license": "MIT",
7
7
  "main": "lib/kfb-view.js",
@@ -153,6 +153,8 @@ export class Area extends ViewerCommon {
153
153
  let selectList = [];
154
154
  let selectLabel;
155
155
  let prevSelectLabel = undefined;
156
+ const bounds = this.viewport.viewportToImageRectangle(
157
+ this.viewport.getBounds());
156
158
  this.labelList.forEach((item) => {
157
159
  if (item.tool === IMAGE) {
158
160
  return;
@@ -165,6 +167,8 @@ export class Area extends ViewerCommon {
165
167
  if (this.movePoint) {
166
168
  return;
167
169
  }
170
+ // 不在可见区域内的标注都过滤掉
171
+ if (!this.isInCanvas(item.region, bounds)) return false;
168
172
  let moveIndex = -1; // 可移动点位置
169
173
  let pointList = []; // 可移动点的集合
170
174
  const scale = this.getImageZoom(true) / item.scale;
@@ -323,7 +327,7 @@ export class Area extends ViewerCommon {
323
327
  onCanvasMove({x, y}) {
324
328
  const selectLabel = this.labelList.find(
325
329
  ({tool, select}) => tool === RECTANGLE && select);
326
- if (selectLabel) {
330
+ if (selectLabel && !this.movePoint) {
327
331
  const region = this.imageToViewerElementRectangle(selectLabel.region);
328
332
  if (this.isContainerInRegion({x, y}, {
329
333
  ...selectLabel,
@@ -27,9 +27,10 @@ export class Tailoring extends ViewerCommon {
27
27
  this.tailoringPoints = [];
28
28
  this.movePointIndex = -1;
29
29
  this.color = '#FFF';
30
+ this.contents = [];
30
31
  }
31
32
 
32
- init({width, height, left, top, color, now = false}) {
33
+ init({width, height, left, top, color, now = false, contents = []}) {
33
34
  this.isInTailoring = true;
34
35
  this.movePointIndex = -1;
35
36
  const pointList = getRectPoint({x: left, y: top},
@@ -44,6 +45,8 @@ export class Tailoring extends ViewerCommon {
44
45
  this.stopTailoring();
45
46
  } else {
46
47
  this.color = color || '#FFF';
48
+ this.contents = contents?.length ||
49
+ ['双击区域内表示完成截图', '双击区域外或按ESC表示取消截图'];
47
50
  this.change();
48
51
  }
49
52
  }
@@ -107,10 +110,14 @@ export class Tailoring extends ViewerCommon {
107
110
  ctx.fillStyle = this.color;
108
111
  ctx.font = '18px Arial';
109
112
  ctx.fillText(
110
- `区域大小为:${rightTop.x - leftTop.x}*${rightBottom.y - rightTop.y}`,
113
+ this.contents?.[3] ?? (`区域大小为:${rightTop.x -
114
+ leftTop.x}*${rightBottom.y - rightTop.y}`),
111
115
  leftTop.x, leftTop.y - 50);
112
- ctx.fillText(`双击区域内表示完成截图`, leftTop.x, leftTop.y - 30);
113
- ctx.fillText(`双击区域外或按ESC表示取消截图`, leftTop.x, leftTop.y - 10);
116
+ ctx.fillText(this.contents?.[0] ?? `双击区域内表示完成截图`, leftTop.x,
117
+ leftTop.y - 30);
118
+ ctx.fillText(this.contents?.[1] ?? `双击区域外或按ESC表示取消截图`,
119
+ leftTop.x,
120
+ leftTop.y - 10);
114
121
  ctx.stroke();
115
122
  }
116
123