Skip to content

Commit

Permalink
fix: Use queryselector instead of firstChild to get svg-layer
Browse files Browse the repository at this point in the history
  • Loading branch information
lambacini committed Oct 27, 2022
1 parent 325205b commit 6569c87
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/tools/src/drawingSvg/getSvgDrawingHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { state } from '../store';
import { getEnabledElement } from '@cornerstonejs/core';
import { SVGDrawingHelper } from '../types';

const VIEWPORT_ELEMENT = 'viewport-element';

/**
* Returns the SVG drawing helper for the given HTML element.
* @param element - The HTML element to get the SVG drawing helper for.
Expand Down Expand Up @@ -34,7 +36,8 @@ function getSvgDrawingHelper(element: HTMLDivElement): SVGDrawingHelper {
* @private
*/
function _getSvgLayer(element) {
const internalDivElement = element.firstChild;
const viewportElement = `.${VIEWPORT_ELEMENT}`;
const internalDivElement = element.querySelector(viewportElement);
const svgLayer = internalDivElement.querySelector('.svg-layer');

return svgLayer;
Expand Down

0 comments on commit 6569c87

Please sign in to comment.