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/.idea/workspace.xml +38 -28
- package/config/webpack.dev.conf.js +2 -1
- package/example/index.js +113 -23
- package/example/label/check.svg +8 -0
- package/example/label/check_empty.svg +9 -0
- package/example/label/cross.svg +6 -0
- package/example/label/cross_empty.svg +6 -0
- package/example/label/delete.svg +8 -0
- package/example/label/delete_empty.svg +8 -0
- package/example/label/hasAudit.svg +26 -0
- package/lib/kfb-view.js +1 -1
- package/package.json +1 -1
- package/src/components/area/index.js +25 -13
- package/src/view.js +2 -3
package/package.json
CHANGED
|
@@ -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
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
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
|
});
|