@konfuzio/document-validation-ui 0.1.59 → 0.1.60-dev.0
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/package.json +1 -1
- package/src/components/DocumentPage/DocumentToolbar.vue +14 -5
- package/src/components/DocumentPage/ScrollingPage.vue +10 -2
- package/src/store/display.js +2 -5
- package/src/store/document.js +6 -0
package/package.json
CHANGED
|
@@ -105,6 +105,7 @@ export default {
|
|
|
105
105
|
data() {
|
|
106
106
|
return {
|
|
107
107
|
currentPercentage: 100,
|
|
108
|
+
fitWidthScale: 1, // baseline for 100%
|
|
108
109
|
maxPercentage: 500,
|
|
109
110
|
defaultPercentage: 0.25,
|
|
110
111
|
fitPercentage: 0.5,
|
|
@@ -136,6 +137,13 @@ export default {
|
|
|
136
137
|
this.editModeDisabled = true;
|
|
137
138
|
}
|
|
138
139
|
},
|
|
140
|
+
scale(newScale) {
|
|
141
|
+
if (this.fitWidthScale > 0) {
|
|
142
|
+
this.currentPercentage = Math.round((newScale / this.fitWidthScale) * 100);
|
|
143
|
+
} else {
|
|
144
|
+
this.currentPercentage = Math.round(newScale * 100);
|
|
145
|
+
}
|
|
146
|
+
},
|
|
139
147
|
},
|
|
140
148
|
mounted() {
|
|
141
149
|
if (this.selectedDocument) {
|
|
@@ -178,12 +186,13 @@ export default {
|
|
|
178
186
|
this.updateScale(this.scale - this.defaultPercentage);
|
|
179
187
|
},
|
|
180
188
|
fitAuto() {
|
|
181
|
-
// exit edit mode of Annotation if changing zoom during editing
|
|
182
189
|
this.cancelAnnotationEditMode();
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
190
|
+
this.$store.dispatch("display/updateFit", "all").then(() => {
|
|
191
|
+
this.$nextTick(() => {
|
|
192
|
+
this.fitWidthScale = this.scale;
|
|
193
|
+
this.currentPercentage = 100;
|
|
194
|
+
});
|
|
195
|
+
});
|
|
187
196
|
},
|
|
188
197
|
updateScale(scale) {
|
|
189
198
|
this.$store.dispatch("display/updateFit", "custom").then(() => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div>
|
|
2
|
+
<div v-observe-visibility="visibilityChanged">
|
|
3
3
|
<DummyPage
|
|
4
|
-
v-if="!loadedPage
|
|
4
|
+
v-if="!loadedPage"
|
|
5
5
|
:width="page.size[0]"
|
|
6
6
|
:height="page.size[1]"
|
|
7
7
|
/>
|
|
@@ -179,6 +179,14 @@ export default {
|
|
|
179
179
|
this.pageBeingLoaded = false;
|
|
180
180
|
});
|
|
181
181
|
},
|
|
182
|
+
visibilityChanged(isVisible) {
|
|
183
|
+
if (isVisible && !this.loadedPage && !this.pageBeingLoaded) {
|
|
184
|
+
this.loadPage();
|
|
185
|
+
}
|
|
186
|
+
if (!isVisible && this.loadedPage) {
|
|
187
|
+
this.$store.dispatch("document/unloadDocumentPage", this.page.number);
|
|
188
|
+
}
|
|
189
|
+
},
|
|
182
190
|
pageInVisibleRange(page) {
|
|
183
191
|
return (
|
|
184
192
|
this.currentPage === page.number ||
|
package/src/store/display.js
CHANGED
|
@@ -259,11 +259,8 @@ const actions = {
|
|
|
259
259
|
commit("SET_SCALE", autoScale);
|
|
260
260
|
break;
|
|
261
261
|
case "all": {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
getters.pageWidthScale(elementsWidth, client.width, viewport.width) -
|
|
265
|
-
0.5
|
|
266
|
-
);
|
|
262
|
+
const widthScale = getters.pageWidthScale(elementsWidth, client.width, viewport.width);
|
|
263
|
+
commit("SET_SCALE", widthScale);
|
|
267
264
|
break;
|
|
268
265
|
}
|
|
269
266
|
case "custom": {
|
package/src/store/document.js
CHANGED
|
@@ -1541,6 +1541,9 @@ const actions = {
|
|
|
1541
1541
|
showAcceptedAnnotations({ commit }, show) {
|
|
1542
1542
|
commit("SET_SHOW_ACCEPTED_ANNOTATIONS", show);
|
|
1543
1543
|
},
|
|
1544
|
+
unloadDocumentPage: ({ commit }, pageNumber) => {
|
|
1545
|
+
commit("REMOVE_PAGE", pageNumber);
|
|
1546
|
+
},
|
|
1544
1547
|
};
|
|
1545
1548
|
|
|
1546
1549
|
const mutations = {
|
|
@@ -1814,6 +1817,9 @@ const mutations = {
|
|
|
1814
1817
|
SET_SHOW_FEEDBACK_NEEDED_ANNOTATIONS: (state, show) => {
|
|
1815
1818
|
state.annotationFilters.showFeedbackNeeded = show;
|
|
1816
1819
|
},
|
|
1820
|
+
REMOVE_PAGE: (state, pageNumber) => {
|
|
1821
|
+
state.pages = state.pages.filter((p) => p.number !== pageNumber);
|
|
1822
|
+
},
|
|
1817
1823
|
};
|
|
1818
1824
|
|
|
1819
1825
|
export default {
|