From ea71e96f72739fab43a290f5b920ef421a972714 Mon Sep 17 00:00:00 2001 From: zadam Date: Sat, 5 Oct 2019 12:01:00 +0200 Subject: [PATCH] ability to set book zoom level via label --- src/public/javascripts/services/note_detail_book.js | 9 ++++++++- src/public/stylesheets/link_map.css | 5 ----- src/public/stylesheets/style.css | 5 +++++ src/views/details/book.ejs | 2 +- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/public/javascripts/services/note_detail_book.js b/src/public/javascripts/services/note_detail_book.js index b1952e21c..aa18002fb 100644 --- a/src/public/javascripts/services/note_detail_book.js +++ b/src/public/javascripts/services/note_detail_book.js @@ -3,6 +3,7 @@ import linkService from "./link.js"; import utils from "./utils.js"; import treeCache from "./tree_cache.js"; import renderService from "./render.js"; +import zoom from "./zoom.js"; const MIN_ZOOM_LEVEL = 1; const MAX_ZOOM_LEVEL = 6; @@ -45,7 +46,6 @@ class NoteDetailBook { this.$zoomInButton = this.$component.find('.book-zoom-in-button'); this.$zoomOutButton = this.$component.find('.book-zoom-out-button'); this.$expandChildrenButton = this.$component.find('.expand-children-button'); - this.setZoom(1); this.$zoomInButton.click(() => this.setZoom(this.zoomLevel - 1)); this.$zoomOutButton.click(() => this.setZoom(this.zoomLevel + 1)); @@ -93,6 +93,10 @@ class NoteDetailBook { } setZoom(zoomLevel) { + if (!(zoomLevel in ZOOMS)) { + zoomLevel = 1; + } + this.zoomLevel = zoomLevel; this.$zoomInButton.prop("disabled", zoomLevel === MIN_ZOOM_LEVEL); @@ -105,6 +109,9 @@ class NoteDetailBook { async render() { this.$content.empty(); + const zoomLevel = parseInt(await this.ctx.note.getLabelValue('bookZoomLevel')) || 1; + this.setZoom(zoomLevel); + await this.renderIntoElement(this.ctx.note, this.$content); } diff --git a/src/public/stylesheets/link_map.css b/src/public/stylesheets/link_map.css index 020672d21..7ccdfd38d 100644 --- a/src/public/stylesheets/link_map.css +++ b/src/public/stylesheets/link_map.css @@ -31,11 +31,6 @@ font-weight: 600; } -.link-map-container .floating-button { - position: absolute !important; - z-index: 100; -} - .link-map-active-note { background-color: var(--accented-background-color) !important; } diff --git a/src/public/stylesheets/style.css b/src/public/stylesheets/style.css index 4ad5cd91f..3f07af936 100644 --- a/src/public/stylesheets/style.css +++ b/src/public/stylesheets/style.css @@ -824,10 +824,15 @@ a.external:not(.no-arrow):after, a[href^="http://"]:not(.no-arrow):after, a[href z-index: 100; } +.note-detail-book { + height: 100%; +} + .note-detail-book-content { display: flex; flex-wrap: wrap; overflow: auto; + height: 100%; align-content: start; } diff --git a/src/views/details/book.ejs b/src/views/details/book.ejs index eb0d2cc8e..f5dee5d76 100644 --- a/src/views/details/book.ejs +++ b/src/views/details/book.ejs @@ -1,5 +1,5 @@
-
+