mirror of
https://github.com/Equicord/Equicord.git
synced 2025-02-21 15:48:52 -05:00
ImagePreview Fixes (#64)
This commit is contained in:
parent
45002e2ad7
commit
82cae8c771
3 changed files with 13 additions and 7 deletions
|
@ -138,11 +138,12 @@ function loadImagePreview(url: string) {
|
|||
|
||||
const fileName = document.createElement("span");
|
||||
const fileSize = document.createElement("span");
|
||||
fileSize.className = "file-size";
|
||||
const fileSizeSpan = document.createElement("p");
|
||||
const showingSize = document.createElement("p");
|
||||
const mimeTypeSpan = document.createElement("span");
|
||||
|
||||
fileSize.className = "file-size";
|
||||
|
||||
const updatePositionAfterLoad = () => {
|
||||
if (lastMouseEvent && currentPreview) {
|
||||
updatePreviewPosition(lastMouseEvent, currentPreview);
|
||||
|
@ -242,14 +243,14 @@ function loadImagePreview(url: string) {
|
|||
}
|
||||
|
||||
if (settings.store.mouseOnlyMode) {
|
||||
currentPreviewFile.addEventListener("mouseover", () => {
|
||||
currentPreview.addEventListener("mouseover", () => {
|
||||
if (currentPreview && !isCtrlHeld) {
|
||||
shouldKeepPreviewOpen = true;
|
||||
currentPreview.classList.add("allow-zoom-and-drag");
|
||||
}
|
||||
});
|
||||
|
||||
currentPreviewFile.addEventListener("mouseout", () => {
|
||||
currentPreview.addEventListener("mouseout", () => {
|
||||
if (currentPreview && !isCtrlHeld && shouldKeepPreviewOpen) {
|
||||
deleteCurrentPreview();
|
||||
shouldKeepPreviewOpen = false;
|
||||
|
@ -376,7 +377,7 @@ function addHoverListener(element: Element) {
|
|||
|
||||
lastMouseEvent = event as MouseEvent;
|
||||
|
||||
if (currentPreview && !isCtrlHeld) {
|
||||
if (currentPreview && !isCtrlHeld && !settings.store.fixedImage) {
|
||||
updatePreviewPosition(lastMouseEvent, element as HTMLElement);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -38,6 +38,11 @@ const settings = definePluginSettings({
|
|||
description: "Allows you to skip having to hold control to zoom in and move images",
|
||||
default: false
|
||||
},
|
||||
fixedImage: {
|
||||
type: OptionType.BOOLEAN,
|
||||
description: "Fixes the image preview to the initial point of hover",
|
||||
default: false
|
||||
},
|
||||
hoverDelay: {
|
||||
type: OptionType.SLIDER,
|
||||
description: "Delay in seconds before the image preview appears",
|
||||
|
|
|
@ -40,8 +40,8 @@
|
|||
border: 1px solid var(--background-secondary);
|
||||
}
|
||||
|
||||
.image-preview .file-info span:last-child:not(:first-child) {
|
||||
margin: 0 5px;
|
||||
.image-preview .file-info span:not(:last-child) {
|
||||
margin: 0 5px 0 0;
|
||||
}
|
||||
|
||||
.file-size {
|
||||
|
@ -87,4 +87,4 @@
|
|||
max-height: 90vh;
|
||||
object-fit: contain;
|
||||
display: none;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue