Skip to content

Commit

Permalink
Prevent comments from being processed when selected in the layers tree.
Browse files Browse the repository at this point in the history
  • Loading branch information
bernesto committed Mar 6, 2024
1 parent a0a849f commit e3caf50
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/commands/view/ShowOffset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions src/utils/dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};

Expand Down

0 comments on commit e3caf50

Please sign in to comment.