@ -18,6 +18,10 @@ export default {
const zoom = this.em.getZoomDecimal();
const el = opt.el as HTMLElement | undefined;
// if (!(el instanceof HTMLElement)) {
// return;
// }
if (!config.showOffsets || !el || isTextNode(el) || (!config.showOffsetsSelected && state == 'Fixed')) {
editor.stopCommand(`${this.id}`, opts);
return;
@ -37,6 +37,9 @@ export const attrUp = (el?: HTMLElement, attrs: ObjectAny = {}) =>
el && el.setAttribute && each(attrs, (value, key) => el.setAttribute(key, value));
export const isVisible = (el?: HTMLElement) => {
if (!el || !(el instanceof HTMLElement)) {
return false;
}
return el && !!(el.offsetWidth || el.offsetHeight || el.getClientRects().length);
};