Files
video-gen/video-gen-admin/node_modules/@rc-component/tour/lib/util.js
T
2026-05-25 17:08:18 +08:00

21 lines
671 B
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getPlacement = getPlacement;
exports.isInViewPort = isInViewPort;
function isInViewPort(element) {
const viewWidth = window.innerWidth || document.documentElement.clientWidth;
const viewHeight = window.innerHeight || document.documentElement.clientHeight;
const {
top,
right,
bottom,
left
} = element.getBoundingClientRect();
return top >= 0 && left >= 0 && right <= viewWidth && bottom <= viewHeight;
}
function getPlacement(targetElement, placement, stepPlacement) {
return stepPlacement ?? placement ?? (targetElement === null ? 'center' : 'bottom');
}