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/.idea/workspace.xml +61 -46
- package/config/webpack.dev.conf.js +2 -1
- package/example/index.js +155 -28
- 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 +24 -13
- package/src/view.js +6 -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
|
}
|
|
@@ -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
|
});
|