[Editor] Disabled the alt-text button when the editor is being resized
This commit is contained in:
parent
3f7060e777
commit
bdb8410ad4
@ -622,6 +622,8 @@ class AnnotationEditor {
|
||||
return;
|
||||
}
|
||||
|
||||
this.#toggleAltTextButton(false);
|
||||
|
||||
const boundResizerPointermove = this.#resizerPointermove.bind(this, name);
|
||||
const savedDraggable = this._isDraggable;
|
||||
this._isDraggable = false;
|
||||
@ -641,6 +643,7 @@ class AnnotationEditor {
|
||||
window.getComputedStyle(event.target).cursor;
|
||||
|
||||
const pointerUpCallback = () => {
|
||||
this.#toggleAltTextButton(true);
|
||||
this._isDraggable = savedDraggable;
|
||||
window.removeEventListener("pointerup", pointerUpCallback);
|
||||
window.removeEventListener("blur", pointerUpCallback);
|
||||
@ -904,8 +907,10 @@ class AnnotationEditor {
|
||||
}, DELAY_TO_SHOW_TOOLTIP);
|
||||
});
|
||||
button.addEventListener("mouseleave", () => {
|
||||
clearTimeout(this.#altTextTooltipTimeout);
|
||||
this.#altTextTooltipTimeout = null;
|
||||
if (this.#altTextTooltipTimeout) {
|
||||
clearTimeout(this.#altTextTooltipTimeout);
|
||||
this.#altTextTooltipTimeout = null;
|
||||
}
|
||||
this.#altTextTooltip?.classList.remove("show");
|
||||
});
|
||||
}
|
||||
@ -921,6 +926,17 @@ class AnnotationEditor {
|
||||
}
|
||||
}
|
||||
|
||||
#toggleAltTextButton(enabled = false) {
|
||||
if (!this.#altTextButton) {
|
||||
return;
|
||||
}
|
||||
if (!enabled && this.#altTextTooltipTimeout) {
|
||||
clearTimeout(this.#altTextTooltipTimeout);
|
||||
this.#altTextTooltipTimeout = null;
|
||||
}
|
||||
this.#altTextButton.disabled = !enabled;
|
||||
}
|
||||
|
||||
getClientDimensions() {
|
||||
return this.div.getBoundingClientRect();
|
||||
}
|
||||
|
@ -481,6 +481,10 @@
|
||||
inset-block-end: 8px;
|
||||
inset-inline-start: 8px;
|
||||
|
||||
&:disabled {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
&:dir(ltr) {
|
||||
transform-origin: 0 100%;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user