@konfuzio/document-validation-ui 0.2.0 → 0.2.1-dev.1
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/dist/css/app.css +1 -1
- package/dist/index.html +1 -1
- package/dist/js/app.js +1 -1
- package/dist/js/app.js.map +1 -1
- package/dist/js/chunk-vendors.js +1 -1
- package/dist/js/chunk-vendors.js.map +1 -1
- package/package.json +2 -2
- package/src/components/DocumentAnnotations/AnnotationContent.vue +0 -1
- package/src/components/DocumentPage/DocumentPage.vue +3 -6
- package/src/components/DocumentPage/SpanSelection.vue +11 -9
- package/src/store/selection.js +6 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@konfuzio/document-validation-ui",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1-dev.1",
|
|
4
4
|
"repository": "https://github.com/konfuzio-ai/document-validation-ui",
|
|
5
5
|
"main": "dist/app.js",
|
|
6
6
|
"scripts": {
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"splitpanes": "^3.1.8",
|
|
37
37
|
"vue": "^3.5.13",
|
|
38
38
|
"vue-i18n": "^10.0.6",
|
|
39
|
-
"vue-konva": "^3.2.
|
|
39
|
+
"vue-konva": "^3.2.1",
|
|
40
40
|
"vue3-observe-visibility": "^1.0.3",
|
|
41
41
|
"vuedraggable": "^4.1.0",
|
|
42
42
|
"vuex": "^4.1.0"
|
|
@@ -554,21 +554,18 @@ export default {
|
|
|
554
554
|
},
|
|
555
555
|
getAnnotationLabelPosition(annotation) {
|
|
556
556
|
if (annotation && this.$refs.stage) {
|
|
557
|
-
const padding = 8;
|
|
558
557
|
const maxCharacters = 10;
|
|
559
558
|
const minimumSpaceTopY = 50;
|
|
560
|
-
const rect = this.bboxToRect(this.page, annotation.span
|
|
559
|
+
const rect = this.bboxToRect(this.page, annotation.span);
|
|
561
560
|
|
|
562
561
|
if (
|
|
563
562
|
annotation.labelName.length > maxCharacters &&
|
|
564
563
|
rect.y < minimumSpaceTopY
|
|
565
564
|
) {
|
|
566
|
-
return `left: ${rect.x}px; top: ${
|
|
567
|
-
rect.y + rect.height * 3 + padding
|
|
568
|
-
}px`;
|
|
565
|
+
return `left: ${rect.x}px; top: ${rect.y + rect.height}px`;
|
|
569
566
|
} else {
|
|
570
567
|
return `left: ${rect.x}px; bottom: ${
|
|
571
|
-
this.$refs.stage.$el.clientHeight - rect.y
|
|
568
|
+
this.$refs.stage.$el.clientHeight - rect.y
|
|
572
569
|
}px`;
|
|
573
570
|
}
|
|
574
571
|
} else {
|
|
@@ -121,15 +121,17 @@ export default {
|
|
|
121
121
|
|
|
122
122
|
moveSelection(points) {
|
|
123
123
|
// only apply when we have a large enough selection, otherwise we risk counting misclicks
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
124
|
+
if (this.selection) {
|
|
125
|
+
const xDiff = Math.abs(this.selection.start.x - points.end.x);
|
|
126
|
+
const yDiff = Math.abs(this.selection.start.y - points.end.y);
|
|
127
|
+
if (xDiff > 5 && yDiff > 5) {
|
|
128
|
+
const { start, end } = points;
|
|
129
|
+
if (start) {
|
|
130
|
+
this.selection.start = start;
|
|
131
|
+
}
|
|
132
|
+
if (end) {
|
|
133
|
+
this.selection.end = end;
|
|
134
|
+
}
|
|
133
135
|
}
|
|
134
136
|
}
|
|
135
137
|
},
|
package/src/store/selection.js
CHANGED
|
@@ -75,10 +75,12 @@ const actions = {
|
|
|
75
75
|
|
|
76
76
|
moveSelection: ({ commit, state, dispatch }, points) => {
|
|
77
77
|
// only apply when we have a large enough selection, otherwise we risk counting misclicks
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
78
|
+
if (state.selection && state.selection.start) {
|
|
79
|
+
const xDiff = Math.abs(state.selection.start.x - points.end.x);
|
|
80
|
+
const yDiff = Math.abs(state.selection.start.y - points.end.y);
|
|
81
|
+
if (xDiff > 5 && yDiff > 5) {
|
|
82
|
+
commit("MOVE_SELECTION", points);
|
|
83
|
+
}
|
|
82
84
|
}
|
|
83
85
|
},
|
|
84
86
|
|