KitwareMedical / ImageViewer

A lightweight, cross-platform 2D/3D medical image viewer.
Apache License 2.0
39 stars 29 forks source link

refund goes to current RulerMetaDataFactory #127

Open brad-t-moore opened 1 year ago

brad-t-moore commented 1 year ago

There is a design / bug with the current multi-ruler type implementation. When using more than one type of ruler (e.g. Rainbow and ONSD), you can mess up the workflow when you interact with a type of ruler that isn't the active type. For example, setup a workflow with ONSD ruler, then Rainbow ruler. Make an ONSD ruler. Switch to Rainbow ruler. Make a Rainbow ruler. Now delete the ONSD ruler. The ONSD ruler with be "refund()"ed on to the Rainbow meta data factory. So even though you are on the Rainbow ruler workflow step, the next clicks will make the ONSD ruler.

Possible fix is to move refund() from the meta data factory to a method on the RulerTool instance and have it callback to the appropriate meta data factory (not the currently selected). Or disallow interacting with RulerTool instances that don't match the active type.