Irev-Dev / MRI-Volume-Slice

Tools for view MRI Volumes in the browser
6 stars 7 forks source link

enable toggleable crosshairs #5

Closed Irev-Dev closed 6 years ago

Irev-Dev commented 6 years ago

Currently cross hairs are on by default and can't be turned off, it would be good if for some one using MRI-Volume-Slice.js as a library to be able to turn them off or on. It should be fairly easy to do as where they are drawn on is very defined in it's own function. line 210.

Bonus points if the cross hairs are drawn on when the app first loads (currently only start working after the user clicks) and likewise would be good if the images updated to add and removed the cross hairs when the state of the cross-hairs toggle updates, i.e. the user doesn't need to click again for this to take effect.

_drawCrossHairs(contexts, viewCoors) {
      contexts.z.fillStyle = 'yellow';
      contexts.y.fillStyle = 'yellow';
      contexts.z.fillRect(viewCoors.x, 0, 1, this.size.y);
      contexts.y.fillRect(viewCoors.x, 0, 1, this.size.z);

      contexts.z.fillStyle = 'cyan';
      contexts.x.fillStyle = 'cyan';
      contexts.z.fillRect(0, viewCoors.y, this.size.x, 1);
      contexts.x.fillRect(0, viewCoors.y, this.size.z, 1);

      contexts.x.fillStyle = 'purple';
      contexts.y.fillStyle = 'purple';
      contexts.x.fillRect(viewCoors.z, 0, 1, this.size.y);
      contexts.y.fillRect(0, this.size.z - viewCoors.z, this.size.x, 1);
}
elistone commented 6 years ago

Should have a pull request coming soon for this.

Irev-Dev commented 6 years ago

Resolved, thanks @elistone 🎉