fix(ui): autoscroll to new measurement on measurement table (#3223)
Fixed scrolling for measurement clicks changed import
This commit is contained in:
parent
550918dd31
commit
3b6822e7b6
@ -36,6 +36,7 @@
|
|||||||
"@cornerstonejs/tools": "^0.50.2",
|
"@cornerstonejs/tools": "^0.50.2",
|
||||||
"@ohif/extension-cornerstone-dicom-sr": "^3.0.0",
|
"@ohif/extension-cornerstone-dicom-sr": "^3.0.0",
|
||||||
"dcmjs": "^0.29.4",
|
"dcmjs": "^0.29.4",
|
||||||
|
"lodash.debounce": "^4.17.21",
|
||||||
"prop-types": "^15.6.2",
|
"prop-types": "^15.6.2",
|
||||||
"react": "^17.0.2",
|
"react": "^17.0.2",
|
||||||
"react-dom": "^17.0.2",
|
"react-dom": "^17.0.2",
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState, useRef } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import {
|
import {
|
||||||
StudySummary,
|
StudySummary,
|
||||||
@ -11,6 +11,7 @@ import { DicomMetadataStore, utils } from '@ohif/core';
|
|||||||
import { useDebounce } from '@hooks';
|
import { useDebounce } from '@hooks';
|
||||||
import ActionButtons from './ActionButtons';
|
import ActionButtons from './ActionButtons';
|
||||||
import { useTrackedMeasurements } from '../../getContextModule';
|
import { useTrackedMeasurements } from '../../getContextModule';
|
||||||
|
import debounce from 'lodash.debounce';
|
||||||
|
|
||||||
const { downloadCSVReport } = utils;
|
const { downloadCSVReport } = utils;
|
||||||
const { formatDate } = utils;
|
const { formatDate } = utils;
|
||||||
@ -45,6 +46,7 @@ function PanelMeasurementTableTracking({ servicesManager, extensionManager }) {
|
|||||||
DISPLAY_STUDY_SUMMARY_INITIAL_VALUE
|
DISPLAY_STUDY_SUMMARY_INITIAL_VALUE
|
||||||
);
|
);
|
||||||
const [displayMeasurements, setDisplayMeasurements] = useState([]);
|
const [displayMeasurements, setDisplayMeasurements] = useState([]);
|
||||||
|
const measurementsPanelRef = useRef(null);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const measurements = measurementService.getMeasurements();
|
const measurements = measurementService.getMeasurements();
|
||||||
@ -125,6 +127,11 @@ function PanelMeasurementTableTracking({ servicesManager, extensionManager }) {
|
|||||||
subscriptions.push(
|
subscriptions.push(
|
||||||
measurementService.subscribe(evt, () => {
|
measurementService.subscribe(evt, () => {
|
||||||
setMeasurementsUpdated(Date.now().toString());
|
setMeasurementsUpdated(Date.now().toString());
|
||||||
|
if (evt === added) {
|
||||||
|
debounce(() => {
|
||||||
|
measurementsPanelRef.current.scrollTop = measurementsPanelRef.current.scrollHeight;
|
||||||
|
}, 300)();
|
||||||
|
}
|
||||||
}).unsubscribe
|
}).unsubscribe
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@ -241,6 +248,7 @@ function PanelMeasurementTableTracking({ servicesManager, extensionManager }) {
|
|||||||
<>
|
<>
|
||||||
<div
|
<div
|
||||||
className="overflow-x-hidden overflow-y-auto invisible-scrollbar"
|
className="overflow-x-hidden overflow-y-auto invisible-scrollbar"
|
||||||
|
ref={measurementsPanelRef}
|
||||||
data-cy={'trackedMeasurements-panel'}
|
data-cy={'trackedMeasurements-panel'}
|
||||||
>
|
>
|
||||||
{displayStudySummary.key && (
|
{displayStudySummary.key && (
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user