Skip to content

Commit a507351

Browse files
committed
fix(OverlayTool): Make the overlay color default to the configuration 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.
1 parent 5381748 commit a507351

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/tools/OverlayTool.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
import { modules } from '../store/index';
12
import external from '../externalModules.js';
23
import BaseTool from './base/BaseTool.js';
34

5+
const globalConfiguration = modules.globalConfiguration;
6+
47
/**
58
*
69
* http://dicom.nema.org/dicom/2013/output/chtml/part03/sect_C.9.html
@@ -9,7 +12,7 @@ import BaseTool from './base/BaseTool.js';
912
* @class Overlay
1013
* @memberof Tools
1114
*
12-
* @classdesc Tool for displaying a scale overlay on the image.
15+
* @classdesc Tool for displaying a scale overlay on the image. Uses viewport.overlayColor to set the default colour.
1316
* @extends Tools.Base.BaseTool
1417
*/
1518
export default class OverlayTool extends BaseTool {
@@ -63,10 +66,12 @@ export default class OverlayTool extends BaseTool {
6366
return;
6467
}
6568

66-
if (viewport.overlay === undefined) {
67-
viewport.overlay = true;
69+
if (viewport.overlayColor === undefined) {
70+
viewport.overlayColor =
71+
globalConfiguration.configuration.overlayColor || 'white';
6872
}
69-
if (!viewport.overlay) return;
73+
// Allow turning off overlays by setting overlayColor to false
74+
if (viewport.overlayColor === false) return;
7075

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

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

86-
layerContext.fillStyle = overlay.fillStyle || '#b026ff';
91+
layerContext.fillStyle = overlay.fillStyle || viewport.overlayColor;
8792

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

0 commit comments

Comments
 (0)