mirror of
https://github.com/andre482/O-tie.git
synced 2026-07-22 07:44:11 +00:00
Release 1.0.10: Fit zooms out enough to show the full diagram.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
a3cb2911f9
commit
bb4bbcde18
6 changed files with 29 additions and 5 deletions
11
CHANGELOG.md
11
CHANGELOG.md
|
|
@ -2,6 +2,17 @@
|
|||
|
||||
All notable changes to O-Tie are documented here.
|
||||
|
||||
## [1.0.10] — 2026-06-27
|
||||
|
||||
### Fixed
|
||||
|
||||
- **Fit** — The Fit command now zooms out far enough to show the entire diagram; large bowties are no longer clipped by an artificial minimum zoom floor.
|
||||
- **Node selection** — Single-clicking a node again opens the bottom inspector bar and selected-state controls (regression from 1.0.8).
|
||||
- **CSS lint** — Removed `!important` overrides by increasing selector specificity for invalid settings inputs and hidden overlay controls.
|
||||
- **Lint** — Filename sanitisation no longer needs an eslint-disable directive.
|
||||
|
||||
---
|
||||
|
||||
## [1.0.9] — 2026-06-27
|
||||
|
||||
### Fixed
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "o-tie",
|
||||
"name": "O-Tie",
|
||||
"version": "1.0.9",
|
||||
"version": "1.0.10",
|
||||
"minAppVersion": "1.4.0",
|
||||
"description": "Build risk bowtie diagrams in your vault: threats, prevention and mitigation barriers, escalation factors, barrier analysis stacks, and PNG export.",
|
||||
"author": "Andre482",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "o-tie",
|
||||
"version": "1.0.9",
|
||||
"version": "1.0.10",
|
||||
"description": "Obsidian plugin for building risk bowtie diagrams",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import type { BowtieViewState } from "./model";
|
|||
|
||||
export const MIN_ZOOM = 0.2;
|
||||
export const MAX_ZOOM = 3;
|
||||
export const FIT_MIN_ZOOM = 0.3;
|
||||
export const FIT_MAX_ZOOM = 1.2;
|
||||
|
||||
export function clampZoom(zoom: number, min = MIN_ZOOM, max = MAX_ZOOM): number {
|
||||
|
|
@ -63,7 +62,9 @@ export function computeFit(
|
|||
): BowtieViewState {
|
||||
const scaleX = (rectWidth - padding * 2) / boundsWidth;
|
||||
const scaleY = (rectHeight - padding * 2) / boundsHeight;
|
||||
const zoom = Math.min(FIT_MAX_ZOOM, Math.max(FIT_MIN_ZOOM, Math.min(scaleX, scaleY)));
|
||||
const scale = Math.min(scaleX, scaleY);
|
||||
// Fit must be allowed to zoom out below MIN_ZOOM so large diagrams fit entirely.
|
||||
const zoom = Math.min(FIT_MAX_ZOOM, Math.max(0.01, scale));
|
||||
return {
|
||||
zoom,
|
||||
panX: (rectWidth - boundsWidth * zoom) / 2,
|
||||
|
|
|
|||
|
|
@ -55,4 +55,15 @@ describe("computeFit", () => {
|
|||
expect(fit.panX).toBeCloseTo((1000 - renderedW) / 2, 5);
|
||||
expect(fit.panY).toBeCloseTo((600 - renderedH) / 2, 5);
|
||||
});
|
||||
|
||||
it("zooms out enough for large diagrams to fit inside the viewport", () => {
|
||||
const viewportW = 800;
|
||||
const viewportH = 600;
|
||||
const padding = 40;
|
||||
const fit = computeFit(5000, 3000, viewportW, viewportH, padding);
|
||||
const renderedW = 5000 * fit.zoom;
|
||||
const renderedH = 3000 * fit.zoom;
|
||||
expect(renderedW).toBeLessThanOrEqual(viewportW - padding * 2 + 0.01);
|
||||
expect(renderedH).toBeLessThanOrEqual(viewportH - padding * 2 + 0.01);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -8,5 +8,6 @@
|
|||
"1.0.6": "1.4.0",
|
||||
"1.0.7": "1.4.0",
|
||||
"1.0.8": "1.4.0",
|
||||
"1.0.9": "1.4.0"
|
||||
"1.0.9": "1.4.0",
|
||||
"1.0.10": "1.4.0"
|
||||
}
|
||||
Loading…
Reference in a new issue