@annalib/anna-core 12.10.10 → 12.10.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -217,12 +217,21 @@ class showEllipsisTextOnHoverDirective {
217
217
  }
218
218
  onMouseEnter() {
219
219
  const element = this.elementRef.nativeElement;
220
- if (element.offsetWidth < element.scrollWidth) {
220
+ if (element.offsetWidth < element.scrollWidth || this.checkRanges(element)) {
221
221
  element.title = element.textContent;
222
222
  }
223
223
  else if (element.title)
224
224
  element.removeAttribute('title');
225
225
  }
226
+ checkRanges(el) {
227
+ const range = new Range();
228
+ range.selectNodeContents(el);
229
+ const range_rect = range.getBoundingClientRect();
230
+ const el_rect = el.getBoundingClientRect();
231
+ let paddingOnRight = window.getComputedStyle(el).paddingRight;
232
+ let padding = +(paddingOnRight.endsWith("px") ? paddingOnRight.slice(0, -2) : paddingOnRight);
233
+ return (range_rect.right + padding) > el_rect.right;
234
+ }
226
235
  }
227
236
  showEllipsisTextOnHoverDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: showEllipsisTextOnHoverDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
228
237
  showEllipsisTextOnHoverDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: showEllipsisTextOnHoverDirective, selector: "[showEllipsisTextOnHover]", host: { listeners: { "mouseenter": "onMouseEnter()" } }, ngImport: i0 });