kfb-view 2.1.6 → 2.1.7

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.6",
4
+ "version": "2.1.7",
5
5
  "author": "qifeng.fan <qifeng.fan@hzztai.com>",
6
6
  "license": "MIT",
7
7
  "main": "lib/kfb-view.js",
@@ -1,4 +1,3 @@
1
- import {Point} from '../../plugin/openseadragon/openseadragon';
2
1
  import {ViewerCommon} from '../common/common';
3
2
 
4
3
  /**
@@ -56,8 +55,8 @@ export class Graduation extends ViewerCommon {
56
55
  * @param {number} px
57
56
  */
58
57
  setScaleLine(txt, px) {
59
- const startPoint = this.imageToViewerElementCoordinates(new Point(0, 0));
60
- const endPoint = this.imageToViewerElementCoordinates(new Point(px, 0));
58
+ const startPoint = this.imageToViewerElementCoordinates(0, 0);
59
+ const endPoint = this.imageToViewerElementCoordinates(px, 0);
61
60
  const width = Math.abs(endPoint.x - startPoint.x);
62
61
  if (this.options.custom) {
63
62
  this.$emit('graduation-change', {width, txt});
@@ -78,7 +77,7 @@ export class Graduation extends ViewerCommon {
78
77
  if (left) {
79
78
  x = left;
80
79
  } else if (right) {
81
- x = width - right;
80
+ x = width - right - lineWidth;
82
81
  }
83
82
  if (top) {
84
83
  y = top;
@@ -97,6 +96,6 @@ export class Graduation extends ViewerCommon {
97
96
  ctx.fillStyle = '#454545';
98
97
  const t = txt.toFixed(0) + this.options.unit;
99
98
  const fontWidth = ctx.measureText(t).width;
100
- ctx.fillText(t, x + lineWidth / 2 - fontWidth / 2, y - 10);
99
+ ctx.fillText(t, x + lineWidth / 2 - fontWidth / 2, top ? y + 10 : y - 10);
101
100
  }
102
101
  }