-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added centering of image from video stream (#21155) #21407
Conversation
WalkthroughWalkthroughThe Changes
Assessment against linked issues
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
Thanks for you PR, but I think your solution is not the right one. The issue is that we apply the @ -0,0 +1,40 @@
diff --git a/src/panels/lovelace/components/hui-image.ts b/src/panels/lovelace/components/hui-image.ts
index cbfe01012..331c1c2f3 100644
--- a/src/panels/lovelace/components/hui-image.ts
+++ b/src/panels/lovelace/components/hui-image.ts
@@ -139,9 +139,10 @@ export class HuiImage extends LitElement {
if (!this.hass) {
return nothing;
}
- const useRatio = Boolean(
- this._ratio && this._ratio.w > 0 && this._ratio.h > 0
- );
+ const useRatio =
+ Boolean(this._ratio && this._ratio.w > 0 && this._ratio.h > 0) ||
+ (!(this.cameraImage && this.cameraView === "live") &&
+ this._lastImageHeight === undefined);
const stateObj = this.entity ? this.hass.states[this.entity] : undefined;
const entityState = stateObj ? stateObj.state : UNAVAILABLE;
@@ -198,10 +199,8 @@ export class HuiImage extends LitElement {
<div
style=${styleMap({
paddingBottom: useRatio
- ? `${((100 * this._ratio!.h) / this._ratio!.w).toFixed(2)}%`
- : this._lastImageHeight === undefined
- ? "56.25%"
- : undefined,
+ ? `${(this._ratio ? (100 * this._ratio.h) / this._ratio.w : 56.25).toFixed(2)}%`
+ : undefined,
backgroundImage:
useRatio && this._loadedImageSrc
? `url("${this._loadedImageSrc}")`
@@ -212,7 +211,7 @@ export class HuiImage extends LitElement {
: undefined,
})}
class="container ${classMap({
- ratio: useRatio || this._lastImageHeight === undefined,
+ ratio: useRatio,
contain: this.fitMode === "contain",
fill: this.fitMode === "fill",
})}" |
Since there was no response at all, I'm declaring this PR stale and closing it. ../Frenck |
Breaking change
Proposed change
Type of change
Example configuration
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed:
Summary by CodeRabbit