mirror of
https://github.com/status-im/consul.git
synced 2025-01-31 16:07:58 +00:00
a66973a274
* Install ember-decorators/observes * Remove filter-predicate * Nativize `env` and inject env service * Nativize all other class based helpers
17 lines
488 B
JavaScript
17 lines
488 B
JavaScript
import Helper from '@ember/component/helper';
|
|
import { inject as service } from '@ember/service';
|
|
|
|
export default class DomPosition extends Helper {
|
|
@service('dom') dom;
|
|
|
|
compute([target, from], hash) {
|
|
const $target = this.dom.element(target);
|
|
const $from = this.dom.element(from);
|
|
const fromRect = $from.getBoundingClientRect();
|
|
const rect = $target.getBoundingClientRect();
|
|
rect.x = rect.x - fromRect.x;
|
|
rect.y = rect.y - fromRect.y;
|
|
return rect;
|
|
}
|
|
}
|