Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frontend/src/ts/modals/quote-search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function applyQuoteLengthFilter(quotes: Quote[]): Quote[] {
if (!modal.isOpen()) return [];
const quoteLengthDropdown = modal
.getModal()
.qs<HTMLSelectElement>(".quoteLengthFilter");
.qs<HTMLSelectElement>("select.quoteLengthFilter");
const selectedOptions = quoteLengthDropdown
? Array.from(quoteLengthDropdown.native.selectedOptions)
: [];
Expand Down
9 changes: 6 additions & 3 deletions frontend/src/ts/test/test-screenshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function revert(): void {
qs(".pageTest .buttons")?.show();
qs("noscript")?.show();
qs("#nocss")?.show();
qsa("header, footer")?.show();
qsa("header, footer")?.removeClass("invisible");
qs("#result")?.removeClass("noBalloons");
qs(".wordInputHighlight")?.show();
qs(".highlightContainer")?.show();
Expand Down Expand Up @@ -119,8 +119,11 @@ async function generateCanvas(): Promise<HTMLCanvasElement | null> {
}
await Misc.sleep(50); // Small delay for render updates

const sourceX = src.getOffsetLeft() ?? 0;
const sourceY = src.getOffsetTop() ?? 0;
const sourceX = src.screenBounds().left ?? 0;
const sourceY = src.screenBounds().top ?? 0;

console.log(sourceX, sourceY);

const sourceWidth = src.getOuterWidth();
const sourceHeight = src.getOuterHeight();
const paddingX = convertRemToPixels(2);
Expand Down
11 changes: 8 additions & 3 deletions frontend/src/ts/utils/dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -580,14 +580,19 @@ export class ElementWithUtils<T extends HTMLElement = HTMLElement> {
}

/**
* Get the element's bounding client rect offset
* Get the element's screen bounds: top, left, width and height
*/
offset(): { top: number; left: number } {
screenBounds(): { top: number; left: number; width: number; height: number } {
const rect = this.native.getBoundingClientRect();
const scrollLeft =
window.pageXOffset || document.documentElement.scrollLeft;
const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
return { top: rect.top + scrollTop, left: rect.left + scrollLeft };
return {
top: rect.top + scrollTop,
left: rect.left + scrollLeft,
width: rect.width,
height: rect.height,
};
}

/**
Expand Down
Loading