kfb-view 2.3.2 → 2.3.4

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.4",
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
  }
@@ -682,7 +694,6 @@ export class Area extends ViewerCommon {
682
694
  this[label.tool].drawMeasureInfo.call(this, label,
683
695
  this.getMeasureContent(label));
684
696
  } else {
685
- console.log(1);
686
697
  this.labelList.forEach((label) => {
687
698
  if (label.show === false) return;
688
699
  if (label.select && label.measure) {
package/src/view.js CHANGED
@@ -411,15 +411,18 @@ 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) {
415
+ if (event.buttons !== 2) {
416
+ isRightDown = false;
417
+ return;
418
+ }
418
419
  console.log('nonprimary drag');
419
420
  let delta = event.position.minus(dragPosition);
420
421
  dragPosition = event.position.clone();
421
422
  kv.viewer.viewport.panBy(
422
423
  kv.viewer.viewport.deltaPointsFromPixels(delta.negate()));
424
+ } else if (kv.area?.onCanvasMove) {
425
+ kv.area.onCanvasMove(event.position);
423
426
  }
424
427
  },
425
428
  });