Skip to content

Build your personal knowledge base with Trilium Notes

1.8 KB
Raw Blame
/* Focusable wrapper that receives keyboard zoom/pan; fills the available space. */
.image-viewer-root {
    position: relative;
    width: 100%;
    height: 100%;
}

/* Pinned by the corner it names (see `placement` on OverlayControlGroup); left here is only what it
   stands above, which is the image and nothing else. The shortcut-hints button opposite it needs
   nothing at all — it stands where every one of them does, and brings that with it. */
.image-viewer-controls {
    z-index: 1;
}

/* Make the library's viewport fill the available space so the image fits and pans within it. */
.image-viewer-viewport.react-transform-wrapper {
    width: 100%;
    height: 100%;
}

.image-viewer-content.react-transform-component {
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
}

.image-viewer-content img {
    max-width: 100%;
    max-height: 100%;
    opacity: 1;
    user-select: none;
    transition: opacity 300ms ease-out;
}

/* The image stays hidden until it has decoded, then fades in; it is also hidden on error. */
.image-viewer-viewport:not(.img-loaded) .image-viewer-content img,
.image-viewer-viewport.img-loading-error .image-viewer-content img {
    opacity: 0;
}

/* A failed load tints the viewport red. */
.image-viewer-viewport {
    transition: background-color 300ms ease-out;
}

.image-viewer-viewport.img-loading-error {
    background-color: var(--dropdown-item-icon-destructive-color);
}

/* The the grab cursor only while the image is large enough to pan (zoomed past fit). */
.image-viewer-viewport.pannable {
    cursor: grab;
}

.image-viewer-viewport.pannable.panning {
    cursor: grabbing;
}

/* At high zoom, render crisp edges instead of blurred interpolation. */
.image-viewer-viewport.tn-image-large-zoom img {
    image-rendering: pixelated;
}