Skip to content

Commit

Permalink
fix(OverlayTool): Make the overlay color default to the configuration…
Browse files Browse the repository at this point in the history
… value

The overlay colour was set to a purple value ina  previous change, but wasn't configurable, so this
change makes the colour configurable, to allow for a site customization to make it consistently
visible.
  • Loading branch information
wayfarer3130 committed Oct 22, 2021
1 parent 5381748 commit a507351
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/tools/OverlayTool.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { modules } from '../store/index';
import external from '../externalModules.js';
import BaseTool from './base/BaseTool.js';

const globalConfiguration = modules.globalConfiguration;

/**
*
* http://dicom.nema.org/dicom/2013/output/chtml/part03/sect_C.9.html
Expand All @@ -9,7 +12,7 @@ import BaseTool from './base/BaseTool.js';
* @class Overlay
* @memberof Tools
*
* @classdesc Tool for displaying a scale overlay on the image.
* @classdesc Tool for displaying a scale overlay on the image. Uses viewport.overlayColor to set the default colour.
* @extends Tools.Base.BaseTool
*/
export default class OverlayTool extends BaseTool {
Expand Down Expand Up @@ -63,10 +66,12 @@ export default class OverlayTool extends BaseTool {
return;
}

if (viewport.overlay === undefined) {
viewport.overlay = true;
if (viewport.overlayColor === undefined) {
viewport.overlayColor =
globalConfiguration.configuration.overlayColor || 'white';
}
if (!viewport.overlay) return;
// Allow turning off overlays by setting overlayColor to false
if (viewport.overlayColor === false) return;

const imageWidth = image.columns;
const imageHeight = image.rows;
Expand All @@ -83,7 +88,7 @@ export default class OverlayTool extends BaseTool {

const layerContext = layerCanvas.getContext('2d');

layerContext.fillStyle = overlay.fillStyle || '#b026ff';
layerContext.fillStyle = overlay.fillStyle || viewport.overlayColor;

if (overlay.type === 'R') {
layerContext.fillRect(0, 0, layerCanvas.width, layerCanvas.height);
Expand Down

0 comments on commit a507351

Please sign in to comment.