Skip to content

Commit

Permalink
Ff pheno fix (#543)
Browse files Browse the repository at this point in the history
Closes #541 

Tried to find a workaround, could not (in a reasonable time). Instead,
just turn off scroll feature in FF.

This was one of the known cons of switching to svg over table:
#372
  • Loading branch information
vincerubinetti authored Jan 19, 2024
1 parent 77c9c83 commit 9a5ba69
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
13 changes: 10 additions & 3 deletions frontend/src/components/ThePhenogrid.vue
Original file line number Diff line number Diff line change
Expand Up @@ -495,17 +495,24 @@ const scrollInfo = useScroll(scroll);
const scrollCoords = ref({ x: 0, y: 0, w: 0, h: 0 });
function updateScroll() {
if (!svg.value || !scroll.value) return;
const { x, y } = screenToSvgCoords(
const position = screenToSvgCoords(
svg.value,
scrollInfo.x.value,
scrollInfo.y.value,
);
const { x: w, y: h } = screenToSvgCoords(
if (!position) return;
const dimensions = screenToSvgCoords(
svg.value,
scroll.value.clientWidth,
scroll.value.clientHeight,
);
scrollCoords.value = { x: x + marginLeft, y: y + marginTop, w, h };
if (!dimensions) return;
scrollCoords.value = {
x: position.x + marginLeft,
y: position.y + marginTop,
w: dimensions.x,
h: dimensions.y,
};
}
watch(() => scrollInfo, updateScroll, { deep: true });
useResizeObserver(scroll, updateScroll);
Expand Down
7 changes: 5 additions & 2 deletions frontend/src/util/dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,11 @@ export const firstInView = (elements: HTMLElement[]): number => {

/** convert screen coordinates to svg coordinates */
export const screenToSvgCoords = (svg: SVGSVGElement, x: number, y: number) => {
/** https://bugzilla.mozilla.org/show_bug.cgi?id=543965 */
if (!svg || !svg.getCTM()) return new DOMPoint(0, 0);
/**
* https://bugzilla.mozilla.org/show_bug.cgi?id=543965 no viable workarounds
* found
*/
if (!svg.getCTM()) return;
let point = svg.createSVGPoint();
point.x = x;
point.y = y;
Expand Down

0 comments on commit 9a5ba69

Please sign in to comment.