kfb-view 2.3.2 → 2.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": "2.3.2",
4
+ "version": "2.3.3",
5
5
  "author": "qifeng.fan <qifeng.fan@hzztai.com>",
6
6
  "license": "MIT",
7
7
  "main": "lib/kfb-view.js",
@@ -42,6 +42,7 @@ export class Area extends ViewerCommon {
42
42
  this.currentPressPoint = undefined;
43
43
  this.lastPoint = undefined;
44
44
  this.draging = false;
45
+ this.isHover = false;
45
46
  MARKS.forEach((mark) => {
46
47
  this[mark] = new Tools[mark];
47
48
  });
@@ -323,18 +324,29 @@ export class Area extends ViewerCommon {
323
324
  const selectLabel = this.labelList.find(
324
325
  ({tool, select}) => tool === RECTANGLE && select);
325
326
  if (selectLabel) {
326
- const region = selectLabel.region;
327
- const startPoint = this.imageToViewerElementCoordinates(region.x,
328
- region.y);
329
- const endPoint = this.imageToViewerElementCoordinates(
330
- region.x + region.width, region.y + region.height);
331
- const pointList = getRectPoint(startPoint, endPoint);
332
- const moveIndex = pointList.findIndex(
333
- (point) => pointInOtherPoint(point, {x, y}));
334
- if (moveIndex === 4) {
335
- this.drawPoint(pointList[4], !!this.movePoint);
336
- } else {
337
- this.change();
327
+ const region = this.imageToViewerElementRectangle(selectLabel.region);
328
+ if (this.isContainerInRegion({x, y}, {
329
+ ...selectLabel,
330
+ region,
331
+ })) {
332
+ const startPoint = {
333
+ x: region.x,
334
+ y: region.y,
335
+ };
336
+ const endPoint = {
337
+ x: region.x + region.width,
338
+ y: region.y + region.height,
339
+ };
340
+ const pointList = getRectPoint(startPoint, endPoint);
341
+ const moveIndex = pointList.findIndex(
342
+ (point) => pointInOtherPoint(point, {x, y}));
343
+ if (moveIndex === 4) {
344
+ this.isHover = true;
345
+ this.drawPoint(pointList[4], !!this.movePoint);
346
+ } else if (this.isHover) {
347
+ this.isHover = false;
348
+ this.change();
349
+ }
338
350
  }
339
351
  }
340
352
  }
@@ -573,6 +585,7 @@ export class Area extends ViewerCommon {
573
585
  }, position === 4);
574
586
  this.drawPoint(points[1], position === 7);
575
587
  } else if (type === RECTANGLE) {
588
+ console.log(12);
576
589
  const sp = {
577
590
  x: points[0].x < points[1].x ? points[0].x : points[1].x,
578
591
  y: points[0].y < points[1].y ? points[0].y : points[1].y,
@@ -682,7 +695,6 @@ export class Area extends ViewerCommon {
682
695
  this[label.tool].drawMeasureInfo.call(this, label,
683
696
  this.getMeasureContent(label));
684
697
  } else {
685
- console.log(1);
686
698
  this.labelList.forEach((label) => {
687
699
  if (label.show === false) return;
688
700
  if (label.select && label.measure) {
package/src/view.js CHANGED
@@ -411,15 +411,14 @@ function initEvent(kv) {
411
411
  new openSeadragon.MouseTracker({
412
412
  element: kv.viewer.canvas,
413
413
  moveHandler: function(event) {
414
- if (kv.area?.onCanvasMove) {
415
- kv.area.onCanvasMove(event.position);
416
- }
417
414
  if (isRightDown && kv.board?.isInDraw) {
418
415
  console.log('nonprimary drag');
419
416
  let delta = event.position.minus(dragPosition);
420
417
  dragPosition = event.position.clone();
421
418
  kv.viewer.viewport.panBy(
422
419
  kv.viewer.viewport.deltaPointsFromPixels(delta.negate()));
420
+ } else if (kv.area?.onCanvasMove) {
421
+ kv.area.onCanvasMove(event.position);
423
422
  }
424
423
  },
425
424
  });