-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Description
Which Umbraco version are you using?
16.4.1
Bug summary
In my package Umbraco Community Hotspots for Umbraco 13 it has a feature to clear focal point, which returns null in property value converter and in Delivery API, while the Image Cropper in Umbraco core always returns a value for focal point.
However in new backoffice this breaks, because it set styles inside the property value setter.
Can we make focalPoint property nullable? or safe-guard checking for null/undefined before focal point style is set?
Line 41 in b14a7ca
| this.#setFocalPointStyle(this.#focalPoint.left, this.#focalPoint.top); |
Furthermore the umb-image-cropper-focus-setter component has a hideFocalPoint property, but setting this also disable interaction to set focal point. It would be great a have another property to visually hide focal point (or add/remove) marker.
Does hideFocalPoint need to disable interaction, as it has another disabled property?
The component is umb-image-cropper-focus-setter, but not sure it need to be ImageCropper specific. It may just exist under "imaging". In old backoffice it was named umb-image-gravity.
Maybe umb-image-focal-point-setter would be better.
Specifics
No response
Steps to reproduce
Reuse umb-image-cropper-focus-setter component and try set focal point to null.
Example:
import type { UmbImageCropperFocalPoint } from '@umbraco-cms/backoffice/media';
@state()
focalPoint: UmbImageCropperFocalPoint | null = { left: 0.5, top: 0.5 };
protected onClearFocalPoint = async () => {
this.focalPoint = null;
this.#updateValue();
};
protected onResetFocalPoint = () => {
this.focalPoint = { left: 0.5, top: 0.5 };
this.#updateValue();
};
...
protected render() {
return html`
<umb-image-cropper-focus-setter
.focalPoint=${this.focalPoint}
.src=${this.source}
@focalpoint-change=${this.#onFocalPointChange}>
</umb-image-cropper-focus-setter>
<div id="actions">${this.renderActions()}</div>
`;
}
protected renderActions() {
return html`
<uui-button compact label=${this.localize.term('content_clearFocalPoint')} @click=${this.onClearFocalPoint}>
<uui-icon name="icon-remove"></uui-icon>
<umb-localize key="content_clearFocalPoint">Clear focal point</umb-localize>
</uui-button>
<uui-button compact label=${this.localize.term('content_resetFocalPoint')} @click=${this.onResetFocalPoint}>
<uui-icon name="icon-axis-rotation"></uui-icon>
<umb-localize key="content_resetFocalPoint">Reset focal point</umb-localize>
</uui-button>
`,
)}
`;
}
Expected result / actual result
No response