kfb-view 3.0.7 → 3.0.8

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": "3.0.7",
4
+ "version": "3.0.8",
5
5
  "author": "qifeng.fan <qifeng.fan@hzztai.com>",
6
6
  "license": "MIT",
7
7
  "main": "lib/kfb-view.js",
@@ -26,7 +26,11 @@ export class Grid extends ViewerCommon {
26
26
  const imageViewYEndPoint = this.viewerElementToImageCoordinates(0,
27
27
  this.canvas.height);
28
28
  let currentZoom = this.getImageZoom(true) * this.options.scale;
29
- let baseScale = this.options.scale === 40 ? 3200 : 1600;
29
+ const pxConversion = this.options.pxConversion ?
30
+ this.options.imageCapRes : 1;
31
+ let baseScale = this.options.scale === 40 ?
32
+ (this.options.pxConversion ? 1600 / this.options.imageCapRes : 3200) :
33
+ (this.options.pxConversion ? 800 / this.options.imageCapRes : 1600);
30
34
  let twoCount = 0;
31
35
  if (currentZoom >= 1) {
32
36
  while (currentZoom / 2 >= 1) {
@@ -91,7 +95,8 @@ export class Grid extends ViewerCommon {
91
95
  ctx.moveTo(point.x + (basePx / 5) * j, 16);
92
96
  ctx.lineTo(point.x + (basePx / 5) * j, 20);
93
97
  if (i !== minX) {
94
- ctx.fillText(i * baseScale, point.x + 5, 13);
98
+ ctx.fillText((i * baseScale * pxConversion).toFixed(0), point.x + 5,
99
+ 13);
95
100
  }
96
101
  }
97
102
  }
@@ -106,7 +111,7 @@ export class Grid extends ViewerCommon {
106
111
  ctx.save();
107
112
  ctx.translate(3, point.y + 5);
108
113
  ctx.rotate(Math.PI / 2);
109
- ctx.fillText(i * baseScale, 0, 0);
114
+ ctx.fillText((i * baseScale * pxConversion).toFixed(0), 0, 0);
110
115
  ctx.restore();
111
116
  }
112
117
  }
package/src/view.js CHANGED
@@ -68,6 +68,7 @@ export default class KfbView extends EventEmitter {
68
68
  * @param {boolean=} config.grid.disabled 是否禁用网格线
69
69
  * @param {boolean=} config.grid.show 是否显示网格线
70
70
  * @param {boolean=} config.grid.ruler 是否启用标尺
71
+ * @param {boolean=} config.grid.pxConversion 是否启用标尺
71
72
  * @param {function=} config.measure.handler 标注信息的回调处理
72
73
  * @param {function=} config.measure.selectHandler 标注信息选中时的回调处理
73
74
  * @param {boolean=} config.measure.color 标注注释颜色