@konfuzio/document-validation-ui 0.1.3-pre-release-2 → 0.1.3-pre-release-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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@konfuzio/document-validation-ui",
3
- "version": "0.1.3-pre-release-2",
3
+ "version": "0.1.3-pre-release-3",
4
4
  "repository": "git://github.com:konfuzio-ai/document-validation-ui.git",
5
5
  "main": "dist/app.js",
6
6
  "scripts": {
package/src/.DS_Store CHANGED
Binary file
@@ -88,14 +88,14 @@ export default {
88
88
  this.clientHeight = clientHeight;
89
89
  },
90
90
  /**
91
- * Scrolls the ScrollingDocument to the offset specified by scrollTop
91
+ * Scrolls the ScrollingDocument to the offset specified by scrollTop & scrollLeft (if zoomed in)
92
92
  * (i.e., another page).
93
93
  */
94
- onPageJump(scrollTop) {
95
- const actualScroll = scrollTop;
96
- this.$refs.scrollingDocument.scrollTop =
97
- // the 4 comes from the margin between pages
98
- actualScroll - (this.$refs.scrollingDocument.offsetTop + 4);
94
+ onPageJump(scrollTop, scrollLeft) {
95
+ const scrollY = scrollTop - (this.$refs.scrollingDocument.offsetTop + 4); // + 4 due to margin between pages
96
+ const scrollX = scrollLeft - this.$refs.scrollingDocument.offsetLeft - 4; // - 4 to add more space before the entity
97
+
98
+ this.$refs.scrollingDocument.scroll(scrollX, scrollY);
99
99
  },
100
100
  },
101
101
  };
@@ -109,7 +109,10 @@ export default {
109
109
  // to the focused annotation.
110
110
  this.$nextTick(() => {
111
111
  // Scroll to the annotation
112
- this.scrollTo(this.getYForBbox(this.documentAnnotationSelected.span));
112
+ this.scrollTo(
113
+ this.getYForBbox(this.documentAnnotationSelected.span),
114
+ this.getXForBbox(this.documentAnnotationSelected.span)
115
+ );
113
116
  });
114
117
  }
115
118
  },
@@ -123,7 +126,7 @@ export default {
123
126
  (this.page.number === number || this.page.number === number) &&
124
127
  !this.isElementFocused
125
128
  ) {
126
- this.$emit("page-jump", this.elementTop);
129
+ this.$emit("page-jump", this.elementTop, 0);
127
130
  }
128
131
  },
129
132
  },
@@ -161,12 +164,16 @@ export default {
161
164
  return this.bboxToRect(this.page, bbox).y;
162
165
  },
163
166
 
167
+ getXForBbox(bbox) {
168
+ return this.bboxToRect(this.page, bbox).x;
169
+ },
170
+
164
171
  /**
165
172
  * Scroll to a relative position in the page. It gets added
166
173
  * the page's element top and a padding margin.
167
174
  */
168
- scrollTo(y) {
169
- this.$emit("page-jump", this.elementTop + y - 80);
175
+ scrollTo(y, x) {
176
+ this.$emit("page-jump", this.elementTop + y - 80, x);
170
177
  },
171
178
  },
172
179
  };