MCPcopy Index your code
hub / github.com/shipshapecode/tether / move

Method move

src/js/tether.js:570–747  ·  view source on GitHub ↗
(pos)

Source from the content-addressed store, hash-verified

568
569 // THE ISSUE
570 move(pos) {
571 if (isUndefined(this.element.parentNode)) {
572 return;
573 }
574
575 const same = {};
576
577 for (let type in pos) {
578 same[type] = {};
579
580 for (let key in pos[type]) {
581 let found = false;
582
583 for (let i = 0; i < this.history.length; ++i) {
584 const point = this.history[i];
585 if (
586 !isUndefined(point[type]) &&
587 !within(point[type][key], pos[type][key])
588 ) {
589 found = true;
590 break;
591 }
592 }
593
594 if (!found) {
595 same[type][key] = true;
596 }
597 }
598 }
599
600 let css = { top: '', left: '', right: '', bottom: '' };
601
602 const transcribe = (_same, _pos) => {
603 const hasOptimizations = !isUndefined(this.options.optimizations);
604 const gpu = hasOptimizations ? this.options.optimizations.gpu : null;
605 if (gpu !== false) {
606 let yPos, xPos;
607 if (_same.top) {
608 css.top = 0;
609 yPos = _pos.top;
610 } else {
611 css.bottom = 0;
612 yPos = -_pos.bottom;
613 }
614
615 if (_same.left) {
616 css.left = 0;
617 xPos = _pos.left;
618 } else {
619 css.right = 0;
620 xPos = -_pos.right;
621 }
622
623 if (isNumber(window.devicePixelRatio) && devicePixelRatio % 1 === 0) {
624 xPos = Math.round(xPos * devicePixelRatio) / devicePixelRatio;
625 yPos = Math.round(yPos * devicePixelRatio) / devicePixelRatio;
626 }
627

Callers 1

positionMethod · 0.95

Calls 8

cacheMethod · 0.95
isUndefinedFunction · 0.90
getOffsetParentFunction · 0.90
deferFunction · 0.90
extendFunction · 0.90
withinFunction · 0.85
isFullscreenElementFunction · 0.85
triggerMethod · 0.80

Tested by

no test coverage detected