fix: ellipse should use exponent (#2086)

* fix: prevent app from blowing up when snapshot modal is opened

* fix: use superscript tag to indicate ellipse is mm squared

* fix: update measurement item to allow us to specify html in MeasurementItem display text
This commit is contained in:
Danny Brown 2020-10-05 21:45:43 -04:00 committed by GitHub
parent 285a188064
commit 0b80f19bfd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 27 additions and 17 deletions

View File

@ -13,7 +13,7 @@ const DEFAULT_SIZE = 512;
const MAX_TEXTURE_SIZE = 10000; const MAX_TEXTURE_SIZE = 10000;
const CornerstoneViewportDownloadForm = ({ onClose, activeViewportIndex }) => { const CornerstoneViewportDownloadForm = ({ onClose, activeViewportIndex }) => {
const { enabledElement: activeEnabledElement } = getEnabledElement( const { element: activeEnabledElement } = getEnabledElement(
activeViewportIndex activeViewportIndex
); );

View File

@ -385,7 +385,7 @@ function _getDisplayText(
const roundedArea = _round(area, 2); const roundedArea = _round(area, 2);
return [ return [
`${roundedArea} ${unit}2 (S:${seriesNumber}, I:${instanceNumber})`, `${roundedArea} ${unit}<sup>2</sup> (S:${seriesNumber}, I:${instanceNumber})`,
]; ];
} }
case types.POINT: { case types.POINT: {

View File

@ -382,7 +382,6 @@ function _mapDisplaySets(
UIDialogService, UIDialogService,
UINotificationService UINotificationService
) { ) {
console.log(displaySets.length);
const thumbnailDisplaySets = []; const thumbnailDisplaySets = [];
const thumbnailNoImageDisplaySets = []; const thumbnailNoImageDisplaySets = [];
displaySets.forEach(ds => { displaySets.forEach(ds => {

View File

@ -3,7 +3,15 @@ import PropTypes from 'prop-types';
import classnames from 'classnames'; import classnames from 'classnames';
import { Icon } from '../'; import { Icon } from '../';
const MeasurementItem = ({ id, index, label, displayText, isActive, onClick, onEdit }) => { const MeasurementItem = ({
id,
index,
label,
displayText,
isActive,
onClick,
onEdit,
}) => {
const [isHovering, setIsHovering] = useState(false); const [isHovering, setIsHovering] = useState(false);
const onEditHandler = event => { const onEditHandler = event => {
@ -41,14 +49,14 @@ const MeasurementItem = ({ id, index, label, displayText, isActive, onClick, onE
> >
{index} {index}
</div> </div>
<div className="px-2 py-1 flex flex-1 flex-col relative"> <div className="relative flex flex-col flex-1 px-2 py-1">
<span className="text-base text-primary-light mb-1"> <span className="mb-1 text-base text-primary-light">{label}</span>
{label}
</span>
{displayText.map(line => ( {displayText.map(line => (
<span key={line} className="pl-2 border-l border-primary-light text-base text-white"> <span
{line} key={line}
</span> className="pl-2 text-base text-white border-l border-primary-light"
dangerouslySetInnerHTML={{ __html: line }}
></span>
))} ))}
<Icon <Icon
className={classnames( className={classnames(
@ -70,13 +78,16 @@ const MeasurementItem = ({ id, index, label, displayText, isActive, onClick, onE
}; };
MeasurementItem.propTypes = { MeasurementItem.propTypes = {
id: PropTypes.oneOfType([PropTypes.number.isRequired, PropTypes.string.isRequired]), id: PropTypes.oneOfType([
PropTypes.number.isRequired,
PropTypes.string.isRequired,
]),
index: PropTypes.number.isRequired, index: PropTypes.number.isRequired,
label: PropTypes.string, label: PropTypes.string,
displayText: PropTypes.array.isRequired, displayText: PropTypes.array.isRequired,
isActive: PropTypes.bool, isActive: PropTypes.bool,
onClick: PropTypes.func, onClick: PropTypes.func,
onEdit: PropTypes.func onEdit: PropTypes.func,
}; };
MeasurementItem.defaultProps = { MeasurementItem.defaultProps = {

View File

@ -164,7 +164,7 @@ const ViewportDownloadForm = ({
} }
return ( return (
<Typography className="mt-2 pl-1" color="error"> <Typography className="pl-1 mt-2" color="error">
{error_messages[errorType]} {error_messages[errorType]}
</Typography> </Typography>
); );
@ -276,7 +276,7 @@ const ViewportDownloadForm = ({
image. image.
</Typography> </Typography>
<div className="mt-6 flex flex-col"> <div className="flex flex-col mt-6">
<div className="w-full mb-4"> <div className="w-full mb-4">
<Input <Input
data-cy="file-name" data-cy="file-name"
@ -331,7 +331,7 @@ const ViewportDownloadForm = ({
</div> </div>
</div> </div>
<div className="ml-6 w-1/4 pl-6 border-l border-secondary-dark"> <div className="w-1/4 pl-6 ml-6 border-l border-secondary-dark">
<div> <div>
<InputLabelWrapper <InputLabelWrapper
sortDirection="none" sortDirection="none"
@ -405,7 +405,7 @@ const ViewportDownloadForm = ({
/> />
</div> </div>
) : ( ) : (
<div className="text-center p-8"> <div className="p-8 text-center">
<Typography>Loading Image Preview...</Typography> <Typography>Loading Image Preview...</Typography>
</div> </div>
)} )}