@textback/notification-widget
Version:
TODO: Give a short introduction of your project. Let this section explain the objectives or the motivation behind this project.
26 lines (21 loc) • 543 B
JavaScript
;
export default class WindowHelper {
constructior() {}
static get center() {
return {
x: Math.floor(window.innerWidth * 0.5),
y: Math.floor(window.innerHeight * 0.5)
};
}
static getRatio(percent) {
let r = percent / 100;
return {
width: Math.floor(window.innerWidth * r),
height: Math.floor(window.innerHeight * r)
};
}
static getRatioPropString(percent) {
let ratioObj = this.getRatio(percent);
return `width=${ratioObj.width},height=${ratioObj.height}`;
}
}