[@types/fabric] fix type on getScrollLeftTop (#40780)

* [@types/fabric] fix type on getScrollLeftTop

* [@types/fabric] add unit tests.
This commit is contained in:
Jean-Sébastien Goupil 2019-12-17 10:27:19 -08:00 committed by Nathan Shively-Sanders
parent 0d12531ffe
commit 4ed6d134ac
2 changed files with 8 additions and 2 deletions

View File

@ -5915,9 +5915,8 @@ interface IUtilDomMisc {
/**
* Returns element scroll offsets
* @param element Element to operate on
* @param upperCanvasEl Upper canvas element
*/
getScrollLeftTop(element: HTMLElement, upperCanvasEl: HTMLElement): { left: number; right: number; };
getScrollLeftTop(element: HTMLElement): { left: number; top: number; };
/**
* Returns offset for a given element
* @param element Element to get offset for

View File

@ -1041,3 +1041,10 @@ function sample11() {
const webglFilterBackend = new fabric.WebglFilterBackend();
fabric.filterBackend = new fabric.Canvas2dFilterBackend();
}
function sample12() {
const canvas = new fabric.Canvas('c');
const position = fabric.util.getScrollLeftTop(canvas.getElement());
const x = position.left;
const y = position.top;
}