minecodex 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1101,11 +1101,15 @@ function menuCheck(selected) {
1101
1101
  return `<svg class="image-menu-check${selected ? "" : " is-hidden"}" viewBox="0 0 17 17" aria-hidden="true"><path d="M12.8961 3.64101C13.1297 3.41418 13.4984 3.37523 13.7779 3.56581C14.0571 3.75635 14.1554 4.11331 14.0299 4.41347L13.9615 4.53847L7.71151 13.7045C7.59411 13.8767 7.4063 13.9877 7.19881 14.0072C6.99136 14.0267 6.78564 13.9533 6.63826 13.806L2.88826 10.056C2.6192 9.67407 2.64927 9.30496 2.88826 9.06581C3.12738 8.82669 3.49647 8.79676 3.76815 8.97597L7.03084 12.2182L12.8053 3.74941Z" /></svg>`;
1102
1102
  }
1103
1103
 
1104
- function fitZoomPercent() {
1105
- if (!drawerImage.naturalWidth || !drawerImage.naturalHeight) return 100;
1104
+ function fitZoomScale() {
1105
+ if (!drawerImage.naturalWidth || !drawerImage.naturalHeight) return 1;
1106
1106
  const widthScale = drawerImage.clientWidth / drawerImage.naturalWidth;
1107
1107
  const heightScale = drawerImage.clientHeight / drawerImage.naturalHeight;
1108
- return Math.max(1, Math.round(Math.min(widthScale, heightScale) * 100));
1108
+ return Math.min(widthScale, heightScale);
1109
+ }
1110
+
1111
+ function fitZoomPercent() {
1112
+ return Math.max(1, Math.round(fitZoomScale() * 100));
1109
1113
  }
1110
1114
 
1111
1115
  function updateZoomLabel() {
@@ -1423,7 +1427,7 @@ function renderZoomMenu() {
1423
1427
  button.innerHTML = `<span class="image-ratio-label"><span>${value}%</span>${menuCheck(zoomScale === value / 100)}</span>`;
1424
1428
  button.addEventListener("click", () => {
1425
1429
  zoomScale = value / 100;
1426
- drawerImage.style.transform = `scale(${zoomScale})`;
1430
+ drawerImage.style.transform = `scale(${zoomScale / fitZoomScale()})`;
1427
1431
  updateZoomLabel();
1428
1432
  closeEditorMenus();
1429
1433
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "minecodex",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Lightweight, local-first plugins for the Codex desktop app.",
5
5
  "license": "MIT",
6
6
  "type": "module",