@konfuzio/document-validation-ui 0.2.1-dev.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@konfuzio/document-validation-ui",
3
- "version": "0.2.1-dev.0",
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.0",
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"
@@ -62,7 +62,6 @@ export default {
62
62
  },
63
63
  computed: {
64
64
  ...mapGetters("document", ["isAnnotationInEditMode", "isDocumentReviewed"]),
65
- ...mapGetters("display", ["bboxToRect"]),
66
65
  ...mapState("document", [
67
66
  "editAnnotation",
68
67
  "publicView",
@@ -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, true);
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 - rect.height - padding
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
- const xDiff = Math.abs(this.selection.start.x - points.end.x);
125
- const yDiff = Math.abs(this.selection.start.y - points.end.y);
126
- if (xDiff > 5 && yDiff > 5) {
127
- const { start, end } = points;
128
- if (start) {
129
- this.selection.start = start;
130
- }
131
- if (end) {
132
- this.selection.end = end;
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
  },
@@ -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
- const xDiff = Math.abs(state.selection.start.x - points.end.x);
79
- const yDiff = Math.abs(state.selection.start.y - points.end.y);
80
- if (xDiff > 5 && yDiff > 5) {
81
- commit("MOVE_SELECTION", points);
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