Skip to content

fix: add contain mode with fixed cover height option#13

Open
lotadevstudio wants to merge 5 commits intosleroq:mainfrom
lotadevstudio:fix/contain-with-fixed-height
Open

fix: add contain mode with fixed cover height option#13
lotadevstudio wants to merge 5 commits intosleroq:mainfrom
lotadevstudio:fix/contain-with-fixed-height

Conversation

@lotadevstudio
Copy link
Copy Markdown

Adds contain-fixed as a third image fit option alongside the existing cover and contain modes. Users can now use image contain without losing manual height control.

Fixes #7

Adds contain-fixed as a third image fit option alongside
the existing cover and contain modes. Users can now use
image contain without losing manual height control.

Fixes sleroq#7
Adds contain-fixed as a third image fit option alongside
the existing cover and contain modes. Users can now use
image contain without losing manual height control.

Fixes sleroq#7
Comment thread src/kanban-view/options.ts Outdated
Comment thread src/kanban-view/constants.ts Outdated
Comment thread styles.css
- Change image fit options from array to map for correct Obsidian types
- Revert styles.css formatting changes, keep only new CSS classes
Comment thread src/kanban-view.ts
Comment on lines +1864 to 1869
private getCardCoverFitFromConfig(): "cover" | "contain" | "contain-fixed" {
const fit = this.config?.get(CARD_COVER_FIT_OPTION_KEY);
if (fit === "contain") return "contain";
if (fit === "contain-fixed") return "contain-fixed";
return "cover";
}
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will handle backward compatibility for the old option

Suggested change
private getCardCoverFitFromConfig(): "cover" | "contain" | "contain-fixed" {
const fit = this.config?.get(CARD_COVER_FIT_OPTION_KEY);
if (fit === "contain") return "contain";
if (fit === "contain-fixed") return "contain-fixed";
return "cover";
}
private getCardCoverFitFromConfig(): "cover" | "contain" | "contain-fixed" {
const fit = this.config?.get(CARD_COVER_FIT_OPTION_KEY);
if (fit === "cover" || fit === "contain" || fit === "contain-fixed") {
return fit;
}
// Backward compatibility for removed option
if (this.config?.get("cardCoverContain") === true) {
return "contain";
}
return "cover";
}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, applied your suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Image fit - contain

3 participants