mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
added possibility to zoom into images using mousewheel
This commit is contained in:
parent
5b72b577b8
commit
0bc91da0bb
1
libraries/wheel-zoom.min.js
vendored
Normal file
1
libraries/wheel-zoom.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -53,6 +53,10 @@ const KATEX = {
|
|||||||
css: [ "libraries/katex/katex.min.css" ]
|
css: [ "libraries/katex/katex.min.css" ]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const WHEEL_ZOOM = {
|
||||||
|
js: [ "libraries/wheel-zoom.min.js"]
|
||||||
|
};
|
||||||
|
|
||||||
async function requireLibrary(library) {
|
async function requireLibrary(library) {
|
||||||
if (library.css) {
|
if (library.css) {
|
||||||
library.css.map(cssUrl => requireCss(cssUrl));
|
library.css.map(cssUrl => requireCss(cssUrl));
|
||||||
@ -101,5 +105,6 @@ export default {
|
|||||||
LINK_MAP,
|
LINK_MAP,
|
||||||
PRINT_THIS,
|
PRINT_THIS,
|
||||||
CALENDAR_WIDGET,
|
CALENDAR_WIDGET,
|
||||||
KATEX
|
KATEX,
|
||||||
|
WHEEL_ZOOM
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import utils from "../../services/utils.js";
|
import utils from "../../services/utils.js";
|
||||||
import toastService from "../../services/toast.js";
|
import toastService from "../../services/toast.js";
|
||||||
import TypeWidget from "./type_widget.js";
|
import TypeWidget from "./type_widget.js";
|
||||||
|
import libraryLoader from "../../services/library_loader.js";
|
||||||
|
|
||||||
const TPL = `
|
const TPL = `
|
||||||
<div class="note-detail-image note-detail-printable">
|
<div class="note-detail-image note-detail-printable">
|
||||||
@ -10,13 +11,25 @@ const TPL = `
|
|||||||
}
|
}
|
||||||
|
|
||||||
.note-detail-image {
|
.note-detail-image {
|
||||||
text-align: center;
|
|
||||||
height: 100%;
|
height: 100%;
|
||||||
overflow: auto;
|
}
|
||||||
|
|
||||||
|
.note-detail-image-wrapper {
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.note-detail-image-view {
|
.note-detail-image-view {
|
||||||
max-width: 100%;
|
display: block;
|
||||||
|
width: auto;
|
||||||
|
height: auto;
|
||||||
|
align-self: center;
|
||||||
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
@ -32,7 +45,15 @@ class ImageTypeWidget extends TypeWidget {
|
|||||||
this.$widget = $(TPL);
|
this.$widget = $(TPL);
|
||||||
this.contentSized();
|
this.contentSized();
|
||||||
this.$imageWrapper = this.$widget.find('.note-detail-image-wrapper');
|
this.$imageWrapper = this.$widget.find('.note-detail-image-wrapper');
|
||||||
this.$imageView = this.$widget.find('.note-detail-image-view');
|
this.$imageView = this.$widget.find('.note-detail-image-view')
|
||||||
|
.attr("id", "image-view-" + utils.randomString(10));
|
||||||
|
|
||||||
|
libraryLoader.requireLibrary(libraryLoader.WHEEL_ZOOM).then(() => {
|
||||||
|
WZoom.create('#' + this.$imageView.attr("id"), {
|
||||||
|
maxScale: 10,
|
||||||
|
zoomOnClick: false
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async doRefresh(note) {
|
async doRefresh(note) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user