Skip to content

Support white fillStyle and responsible to viewport invert#436

Merged
swederik merged 1 commit intocornerstonejs:masterfrom
laozhu:master
Sep 14, 2021
Merged

Support white fillStyle and responsible to viewport invert#436
swederik merged 1 commit intocornerstonejs:masterfrom
laozhu:master

Conversation

@laozhu
Copy link
Copy Markdown
Contributor

@laozhu laozhu commented Jan 16, 2020

Add a fillStyle option to EnabledElementOptions.

interface EnabledElementOptions {
  renderer?: 'webgl';
  fillStyle?: 'black' | 'white';
}

If options.fillStyle is not set, the same with default behavior.

context.fillStyle = 'black';

If options.fillStyle is set to white or black, you can set default fillStyle for different element, and the fillStyle will responsible to viewport.invert.

const enabledElementOptions = { renderer: 'webgl' };
enabledElementOptions.fillStyle = modality === 'PT' ? 'white' : 'black';
cornerstone.enable(element, enabledElementOptions);

image

I still have a bug here, I can't figure out it, when I have not set renderer to webgl and set the fillStyle to white, the viewport will render to all white.🤔️ I need your help @dannyrb for finishing this PR.

image

@laozhu laozhu marked this pull request as ready for review January 16, 2020 09:21
@dannyrb dannyrb self-requested a review February 6, 2020 04:01
@swederik swederik merged commit ca3a992 into cornerstonejs:master Sep 14, 2021
@swederik
Copy link
Copy Markdown
Member

🎉 This PR is included in version 2.4.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants