mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -04:00
Don't show same dimensions twice if there are no custom dimensions
This commit is contained in:
parent
92ed342547
commit
4142fa2aa2
1 changed files with 12 additions and 3 deletions
|
@ -27,6 +27,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
|
||||
let actualWidth = "";
|
||||
let actualHeight = "";
|
||||
let customDimensions = false;
|
||||
|
||||
let containerTop = 0;
|
||||
let containerLeft = 0;
|
||||
|
@ -71,12 +72,15 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
height = image!.clientHeight;
|
||||
|
||||
const widthProperty = image!.style.width;
|
||||
customDimensions = false;
|
||||
|
||||
if (widthProperty) {
|
||||
actualWidth = widthProperty.endsWith("px")
|
||||
? widthProperty.substring(0, widthProperty.length - 2)
|
||||
: widthProperty;
|
||||
customDimensions = true;
|
||||
} else {
|
||||
actualWidth = String(width);
|
||||
actualWidth = String(naturalWidth);
|
||||
}
|
||||
|
||||
const heightProperty = image!.style.height;
|
||||
|
@ -84,8 +88,9 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
actualHeight = heightProperty.endsWith("px")
|
||||
? heightProperty.substring(0, heightProperty.length - 2)
|
||||
: heightProperty;
|
||||
customDimensions = true;
|
||||
} else {
|
||||
actualHeight = String(height);
|
||||
actualHeight = String(naturalHeight);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -162,7 +167,10 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
</div>
|
||||
{#if showDimensions}
|
||||
<div class="image-handle-dimensions" class:is-rtl={isRtl}>
|
||||
{actualWidth}×{actualHeight} (Original: {naturalWidth}×{naturalHeight})
|
||||
<span>{actualWidth}×{actualHeight}</span>
|
||||
{#if customDimensions}<span
|
||||
>(Original: {naturalWidth}×{naturalHeight})</span
|
||||
>{/if}
|
||||
</div>
|
||||
{/if}
|
||||
<div
|
||||
|
@ -240,6 +248,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
user-select: none;
|
||||
|
||||
font-size: 13px;
|
||||
color: white;
|
||||
background-color: rgba(0 0 0 / 0.3);
|
||||
border-color: black;
|
||||
border-radius: 0.25rem;
|
||||
|
|
Loading…
Reference in a new issue