Compare commits

..
1 Commits
Author SHA1 Message Date
WendelinandClaude Opus 5.5 00312420d8 Remove clicking the title to enlarge the more info dialog (#56176)
Clicking the title of the more info dialog made it fill the screen, but
nothing showed that this was possible. For a camera it only added black
bars, since its info view already fits the picture. Cameras also no
longer open at the large width: their info view and the image's size the
dialog from the picture, and their other views are as wide as those of
any other entity. A large width passed by the caller still works.

Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-11-26 15:24:20 +01:00
4 changed files with 24 additions and 51 deletions

No files matched your search

@@ -22,6 +22,7 @@ import {
coverHasPositionControls,
coverHasTiltControls,
coverModeAttribute,
coverSupportsPosition,
coverSupportsSetValue,
defaultCoverMode,
} from "../../../data/cover";
@@ -163,7 +164,7 @@ class MoreInfoCover extends LitElement {
if (!request || this._drag) {
return undefined;
}
if (!coverSupportsSetValue(this.stateObj!, request.mode)) {
if (request.mode === "position" && !coverSupportsPosition(this.stateObj!)) {
return this._hint(request.value ? "requested_open" : "requested_closed");
}
return this._hint("requested", {
+2 -17
View File
@@ -149,8 +149,6 @@ export class MoreInfoDialog extends DirtyStateProviderMixin<
@property({ type: Boolean, reflect: true }) public large = false;
@state() private _fill = false;
// The dialog grows with the camera's or image's picture, as high as there
// is room for
@state() private _mediaAspectRatio?: number;
@@ -217,7 +215,6 @@ export class MoreInfoDialog extends DirtyStateProviderMixin<
this._detailsYamlMode = false;
this.large = params.large ?? false;
this._fill = false;
this._open = true;
this._loadEntityRegistryEntry();
}
@@ -701,13 +698,7 @@ export class MoreInfoDialog extends DirtyStateProviderMixin<
return html`
<ha-adaptive-dialog
.open=${this._open}
.width=${
this._fill
? "full"
: this.large || mediaAspectRatio
? "large"
: "medium"
}
.width=${this.large || mediaAspectRatio ? "large" : "medium"}
class=${classMap({
camera: domain === "camera",
image: domain === "image",
@@ -751,7 +742,7 @@ export class MoreInfoDialog extends DirtyStateProviderMixin<
></ha-icon-button-prev>
`
}
<span slot="headerTitle" @click=${this._enlarge} class="title">
<span slot="headerTitle" class="title">
${
breadcrumb.length > 0
? !__DEMO__ && isAdmin
@@ -1168,12 +1159,6 @@ export class MoreInfoDialog extends DirtyStateProviderMixin<
this._cameraControlsHeight = ev.detail.height;
}
private _enlarge() {
withViewTransition(() => {
this._fill = !this._fill;
});
}
private _handleOpened() {
window.addEventListener("dialog-closed", this._enableEscapeKeyClose);
window.addEventListener("show-dialog", this._disableEscapeKeyClose);
@@ -27,6 +27,7 @@ import {
coverCurrentValue,
coverHasTiltControls,
coverModeAttribute,
coverSupportsPosition,
coverSupportsSetValue,
coverSupportsTiltPosition,
coverTiltOpenness,
@@ -77,17 +78,6 @@ const pillHandle = (cx: number, cy: number, vertical: boolean) =>
const swipeResistance = (distance: number) =>
SWIPE_RESISTANCE * (1 - Math.exp(-Math.max(0, distance) / 30));
const OPEN_CLOSE_FEATURES: Record<
CoverControlMode,
Record<CoverSwipe["action"], CoverEntityFeature>
> = {
position: { open: CoverEntityFeature.OPEN, close: CoverEntityFeature.CLOSE },
tilt: {
open: CoverEntityFeature.OPEN_TILT,
close: CoverEntityFeature.CLOSE_TILT,
},
};
const modeSprings = (): ModeSprings => ({
position: new PercentSpring(),
tilt: new PercentSpring(),
@@ -200,11 +190,11 @@ export class HaStateControlCover extends LitElement {
}
private get _openCloseOnly(): boolean {
const features = OPEN_CLOSE_FEATURES[this.mode];
return (
!this._canSetValue &&
(supportsFeature(this.stateObj, features.open) ||
supportsFeature(this.stateObj, features.close))
this.mode === "position" &&
!coverSupportsPosition(this.stateObj) &&
(supportsFeature(this.stateObj, CoverEntityFeature.OPEN) ||
supportsFeature(this.stateObj, CoverEntityFeature.CLOSE))
);
}
@@ -218,9 +208,7 @@ export class HaStateControlCover extends LitElement {
private get _interactive(): boolean {
return (
this.stateObj.state !== UNAVAILABLE &&
(this._canSetValue ||
(this._openCloseOnly &&
coverCurrentValue(this.stateObj, this.mode) !== undefined))
(this._canSetValue || (this._openCloseOnly && !this._valueUnknown))
);
}
@@ -424,7 +412,11 @@ export class HaStateControlCover extends LitElement {
}
private _swipeAction(): CoverSwipe["action"] {
return this._handleGoal(this.mode) >= 50 ? "close" : "open";
const end =
this.request?.mode === "position"
? this.request.value
: this._drawingGoal("position");
return end >= 50 ? "close" : "open";
}
private _startSwipe(
@@ -432,10 +424,14 @@ export class HaStateControlCover extends LitElement {
shape: CoverShape,
startPointer: number
) {
const mode = this.mode;
const action = this._swipeAction();
const closing = action === "close";
if (!supportsFeature(this.stateObj, OPEN_CLOSE_FEATURES[mode][action])) {
if (
!supportsFeature(
this.stateObj,
closing ? CoverEntityFeature.CLOSE : CoverEntityFeature.OPEN
)
) {
return;
}
const direction = closing ? -1 : 1;
@@ -466,13 +462,13 @@ export class HaStateControlCover extends LitElement {
const passedHalfway = Boolean(this._drag?.swipe?.passedHalfway);
this._setDrag(undefined);
if (passedHalfway) {
fireEvent(this, "cover-command", { mode, action });
fireEvent(this, "cover-command", { mode: "position", action });
}
},
tap: (e) => {
const pointer = this._pointerValue(e, shape);
if (pointer !== undefined && pointer >= 50 !== closing) {
fireEvent(this, "cover-command", { mode, action });
fireEvent(this, "cover-command", { mode: "position", action });
}
},
cancel: () => this._setDrag(undefined),
+1 -10
View File
@@ -1,7 +1,6 @@
import type { PropertyValues } from "lit";
import type { HASSDomEvent } from "../common/dom/fire_event";
import { mainWindow } from "../common/dom/get_main_window";
import { computeDomain } from "../common/entity/compute_domain";
import { replaceCurrentUrl } from "../common/navigate";
import {
createMoreInfoUrl,
@@ -12,8 +11,6 @@ import type { MoreInfoDialogParams } from "../dialogs/more-info/ha-more-info-dia
import type { Constructor } from "../types";
import type { HassBaseEl } from "./hass-base-mixin";
const LARGE_MORE_INFO_DOMAINS = ["camera"];
declare global {
// for fire event
interface HASSDomEvents {
@@ -47,13 +44,7 @@ export default <T extends Constructor<HassBaseEl>>(superClass: T) =>
{
entityId: ev.detail.entityId,
view,
large:
ev.detail.large ??
(ev.detail.entityId
? LARGE_MORE_INFO_DOMAINS.includes(
computeDomain(ev.detail.entityId)
)
: false),
large: ev.detail.large,
data: ev.detail.data,
returnUrl,
},