You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Engine_Rebuild/src/ts_source/htmlUtil.ts

20 lines
620 B
TypeScript

export module HTMLUtil {
export function getElementXinParent(elem: HTMLElement, parent: HTMLElement): number {
let styleLeft = elem.style.left;
if (0 === styleLeft.length) {
return parent.offsetLeft;
} else {
return parent.offsetLeft+parseInt(styleLeft);
}
}
export function getElementYInParent(elem: HTMLElement, parent: HTMLElement): number {
let styleTop = elem.style.top;
if (0 === styleTop.length) {
return parent.offsetTop;
} else {
return parent.offsetTop + parseInt(styleTop);
}
}
}