@tencentcloud/roomkit-web-vue3
Version:
<h1 align="center"> TUIRoomKit</h1> Conference (TUIRoomKit) is a product suitable for multi-person audio and video conversation scenarios such as business meetings, webinars, and online education. By integrating this product, you can add room management,
44 lines (43 loc) • 1.85 kB
JavaScript
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const environment = require("./environment.js");
function getScrollInfo(selector, instanceName) {
if (!environment.isWeChat && window) {
const dom = document.querySelector(selector);
if (!dom)
return Promise.reject(
new Error(`getScrollInfo() can't find ${selector} dom.`)
);
return Promise.resolve({
id: dom.id,
scrollTop: dom.scrollTop,
scrollLeft: dom.scrollLeft,
scrollWidth: dom.scrollWidth,
scrollHeight: dom.scrollHeight
});
}
if (environment.isWeChat) {
return Promise.reject(
new Error("uni.getScrollInfo() need instanceName in params.")
);
}
return Promise.reject(new Error("getScrollInfo() occur error"));
}
function getContentSize(element) {
const computedStyle = getComputedStyle(element);
const paddingTop = Number(computedStyle.paddingTop.replace("px", ""));
const paddingBottom = Number(computedStyle.paddingBottom.replace("px", ""));
const borderTop = Number(computedStyle.borderTopWidth.replace("px", ""));
const borderBottom = Number(
computedStyle.borderBottomWidth.replace("px", "")
);
const paddingLeft = Number(computedStyle.paddingLeft.replace("px", ""));
const paddingRight = Number(computedStyle.paddingRight.replace("px", ""));
const borderLeft = Number(computedStyle.borderLeftWidth.replace("px", ""));
const borderRight = Number(computedStyle.borderRightWidth.replace("px", ""));
const contentWidth = element.offsetWidth - paddingLeft - paddingRight - borderLeft - borderRight;
const contentHeight = element.offsetHeight - paddingTop - paddingBottom - borderTop - borderBottom;
return { width: contentWidth, height: contentHeight };
}
exports.getContentSize = getContentSize;
exports.getScrollInfo = getScrollInfo;
;