diff --git a/client/components/ExternalLibs/ExternalLibs.vue b/client/components/ExternalLibs/ExternalLibs.vue
index 04650073..bb8c9f3d 100644
--- a/client/components/ExternalLibs/ExternalLibs.vue
+++ b/client/components/ExternalLibs/ExternalLibs.vue
@@ -5,14 +5,22 @@
-
-
- Справка
-
На весь экран
+
+
+ Увеличить масштаб
+
+
+
+ Уменьшить масштаб
+
+
+
+ Справка
+
-
+
@@ -217,12 +227,15 @@ class ExternalLibs extends Vue {
closeAfterSubmit = false;
openInFrameOnEnter = false;
openInFrameOnAdd = false;
+ frameScale = 1;
created() {
this.oldStartLink = '';
this.justOpened = true;
this.$root.addKeyHook(this.keyHook);
+ this.$root.$on('resize', this.frameResize);
+
document.addEventListener('fullscreenchange', () => {
this.fullScreenActive = (document.fullscreenElement !== null);
});
@@ -360,6 +373,11 @@ class ExternalLibs extends Vue {
this.openInFrameOnEnter = libs.openInFrameOnEnter || false;
this.openInFrameOnAdd = libs.openInFrameOnAdd || false;
+ this.frameScale = 1;
+ const index = lu.getSafeRootIndexByUrl(this.libs.groups, this.selectedLink);
+ if (index >= 0)
+ this.frameScale = this.libs.groups[index].frameScale || 1;
+
this.updateStartLink();
}
@@ -494,12 +512,45 @@ class ExternalLibs extends Vue {
this.$nextTick(() => {
this.frameVisible = true;
this.$nextTick(() => {
- if (this.$refs.frame)
+ if (this.$refs.frame) {
this.$refs.frame.contentWindow.focus();
+ this.frameResize();
+ }
});
});
}
+ frameResize() {
+ if (this.$refs.frame) {
+ const w = this.$refs.frameBox.offsetWidth;
+ const h = this.$refs.frameBox.offsetHeight;
+ const normalSize = `width: ${w}px; height: ${h}px;`;
+ this.$refs.frameWrap.style = normalSize;
+ if (this.frameScale != 1) {
+ const s = this.frameScale;
+ this.$refs.frame.style = `width: ${w/s}px; height: ${h/s}px; transform: scale(${s}); transform-origin: 0 0;`;
+ } else {
+ this.$refs.frame.style = normalSize;
+ }
+ }
+ }
+
+ changeScale(delta) {
+ if ((this.frameScale > 0.1 && delta <= 0) || (this.frameScale < 5 && delta >= 0)) {
+ this.frameScale = _.round(this.frameScale + delta, 1);
+
+ const index = lu.getSafeRootIndexByUrl(this.libs.groups, this.selectedLink);
+ if (index >= 0) {
+ let libs = _.cloneDeep(this.libs);
+ libs.groups[index].frameScale = this.frameScale;
+ this.commitLibs(libs);
+ }
+
+ this.frameResize();
+ this.$root.notify.success(`Масштаб изменен: ${(this.frameScale*100).toFixed(0)}%`, '', {position: 'bottom-right'});
+ }
+ }
+
getCommentByLink(list, link) {
const item = lu.getListItemByLink(list, link);
return (item ? item.c : '');