kfb-view 2.3.3 → 2.3.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "kfb-view",
3
3
  "description": "一个在线kfb的阅片软件",
4
- "version": "2.3.3",
4
+ "version": "2.3.5",
5
5
  "author": "qifeng.fan <qifeng.fan@hzztai.com>",
6
6
  "license": "MIT",
7
7
  "main": "lib/kfb-view.js",
@@ -585,7 +585,6 @@ export class Area extends ViewerCommon {
585
585
  }, position === 4);
586
586
  this.drawPoint(points[1], position === 7);
587
587
  } else if (type === RECTANGLE) {
588
- console.log(12);
589
588
  const sp = {
590
589
  x: points[0].x < points[1].x ? points[0].x : points[1].x,
591
590
  y: points[0].y < points[1].y ? points[0].y : points[1].y,
@@ -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,13 @@ 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表示取消截图`, leftTop.x,
119
+ leftTop.y - 10);
114
120
  ctx.stroke();
115
121
  }
116
122
 
package/src/view.js CHANGED
@@ -412,6 +412,10 @@ function initEvent(kv) {
412
412
  element: kv.viewer.canvas,
413
413
  moveHandler: function(event) {
414
414
  if (isRightDown && kv.board?.isInDraw) {
415
+ if (event.buttons !== 2) {
416
+ isRightDown = false;
417
+ return;
418
+ }
415
419
  console.log('nonprimary drag');
416
420
  let delta = event.position.minus(dragPosition);
417
421
  dragPosition = event.position.clone();