kfb-view 3.2.2 → 3.2.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.2.2",
4
+ "version": "3.2.3",
5
5
  "author": "qifeng.fan <qifeng.fan@hzztai.com>",
6
6
  "license": "MIT",
7
7
  "main": "lib/kfb-view.js",
@@ -679,33 +679,28 @@ export class Area extends ViewerCommon {
679
679
  showLabelMeasure() {
680
680
  const bounds = this.viewport.viewportToImageRectangle(
681
681
  this.viewport.getBounds());
682
- const currentScale = this.getImageZoom(true);
683
- if (currentScale * this.options.scale < this.options.measure.scale) {
684
- const label = this.labelList.find((item) => item.select);
685
- if (!label) return;
682
+ const currentScale = this.getImageZoom(true) * this.options.scale;
683
+ this.labelList.forEach((label) => {
686
684
  if (label.show === false) return;
685
+ if (!this.isInCanvas(label.region, bounds)) return;
686
+ this.labelDrawingFunc(label);
687
687
  if (label.measure === false) return;
688
- this[label.tool].drawMeasureInfo.call(this, label,
689
- this.getMeasureContent(label));
690
- } else {
691
- this.labelList.forEach((label) => {
692
- if (label.show === false) return;
693
- if (label.select && label.measure) {
694
- this[label.tool].drawMeasureInfo.call(this, label,
695
- this.getMeasureContent(label));
696
- } else if (this.options.measure.defaultShow && label.measure) {
697
- if (!this.isInCanvas(label.region, bounds)) return false;
698
- this[label.tool].drawMeasureInfo.call(this, label,
699
- this.getMeasureContent(label));
700
- }
701
- if (this.options.labelDrawing || this.options.label?.drawing) {
702
- if (!this.isInCanvas(label.region, bounds)) return false;
703
- const drawingFunc = this.options.label?.drawing ||
704
- this.options.labelDrawing;
705
- drawingFunc(this.canvas, label,
706
- this.imageToViewerElementRectangle(label.region));
707
- }
708
- });
688
+ if (label.select) {
689
+ this[label.tool].drawMeasureInfo.call(this, label,
690
+ this.getMeasureContent(label));
691
+ } else if (currentScale >= this.options.measure.scale && this.options.measure.defaultShow) {
692
+ this[label.tool].drawMeasureInfo.call(this, label,
693
+ this.getMeasureContent(label));
694
+ }
695
+ });
696
+ }
697
+
698
+ labelDrawingFunc(label) {
699
+ if (this.options.labelDrawing || this.options.label?.drawing) {
700
+ const drawingFunc = this.options.label?.drawing ||
701
+ this.options.labelDrawing;
702
+ drawingFunc(this.canvas, label,
703
+ this.imageToViewerElementRectangle(label.region));
709
704
  }
710
705
  }
711
706