kfb-view 3.3.1 → 3.3.3

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.3.1",
4
+ "version": "3.3.3",
5
5
  "author": "qifeng.fan <qifeng.fan@hzztai.com>",
6
6
  "license": "MIT",
7
7
  "main": "lib/kfb-view.cjs.js",
@@ -271,7 +271,7 @@ export class ViewerCommon {
271
271
  `${this.translate('long_axis')}:${this.getUnitNumber(a)}`,
272
272
  `${this.translate('short_axis')}:${this.getUnitNumber(b)}`,
273
273
  `${this.translate('perimeter')}:${this.getUnitNumber(4 * (a - b) + 2 * Math.PI * b)}`,
274
- `${this.translate('area')}:${this.getUnitNumber(Math.PI * a * b / this.options.binary)}²`],
274
+ `${this.translate('area')}:${this.getUnitNumber(Math.PI * a * b, 2)}²`],
275
275
  };
276
276
  }
277
277
  break;
@@ -279,7 +279,7 @@ export class ViewerCommon {
279
279
  const w = Math.abs(endPoint.x - startPoint.x) * this.options.imageCapRes;
280
280
  const h = Math.abs(endPoint.y - startPoint.y) * this.options.imageCapRes;
281
281
  const pt = (w + h) * 2;
282
- const ac = w * h / this.options.binary;
282
+ const ac = w * h;
283
283
  const rightTop = getRectPoint(startPoint, endPoint)[2];
284
284
  const p = this.imageToViewerElementCoordinates(rightTop.x,
285
285
  rightTop.y);
@@ -291,7 +291,7 @@ export class ViewerCommon {
291
291
  `${this.translate('length')}:${this.getUnitNumber(w)}`,
292
292
  `${this.translate('width')}:${this.getUnitNumber(h)}`,
293
293
  `${this.translate('perimeter')}:${this.getUnitNumber(pt)}`,
294
- `${this.translate('area')}:${this.getUnitNumber(ac)}²`],
294
+ `${this.translate('area')}:${this.getUnitNumber(ac, 2)}²`],
295
295
  };
296
296
  }
297
297
  break;
@@ -312,7 +312,7 @@ export class ViewerCommon {
312
312
  texts: [
313
313
  `${this.translate('perimeter')}:${this.getUnitNumber((pt * this.options.imageCapRes).toFixed(2))}`,
314
314
  `${this.translate('area')}:${this.getUnitNumber(
315
- calculatePolygonArea(points, this.options.imageCapRes) / this.options.binary)}²`],
315
+ calculatePolygonArea(points, this.options.imageCapRes), 2)}²`],
316
316
  };
317
317
  }
318
318
  break;
@@ -335,8 +335,9 @@ export class ViewerCommon {
335
335
  };
336
336
  }
337
337
 
338
- getUnitNumber(number, index) {
339
- return getUnitNumber(number, this.options.units, this.options.binary, index);
338
+ getUnitNumber(number, index = 1) {
339
+ const binary = Math.pow(this.options.binary, index);
340
+ return getUnitNumber(number, this.options.units, binary);
340
341
  }
341
342
 
342
343
  /**
@@ -383,8 +383,8 @@ export class Tailoring extends ViewerCommon {
383
383
  copyCtx.putImageData(imageData, 0, 0, 0, 0, disWidth, disHeight);
384
384
  const shapeCanvas = this.kv.shape?.canvas;
385
385
  if (shapeCanvas && this.options.shape) {
386
- copyCtx.drawImage(shapeCanvas, startPoint.x * radioX,
387
- startPoint.y * radioY, disWidth, disHeight, 0, 0, disWidth,
386
+ copyCtx.drawImage(shapeCanvas, startPoint.x,
387
+ startPoint.y, disWidth, disHeight, 0, 0, disWidth,
388
388
  disHeight);
389
389
  }
390
390
  if (copyCanvas.width > this.options.resolution) {