saalfeldlab / paintera

GNU General Public License v2.0
99 stars 17 forks source link

don't exit shape interpolation mode if it's due to disable/enable of AllowedActions #430

Closed cmhulbert closed 3 years ago

cmhulbert commented 3 years ago

To avoid redundant pop-ups, actions are disabled when generating a new label mask, and re-enabled after.

However, shape interpolation creates masks during interpolation mode. This introduced the following bug where shape-interpolation was not possible:

  1. Shape interpolation mode is entered on pressing s. As a result, a listener is added to the allowedActionsProperty that checks if the allowed actions are changed, and if so exits shape interpolation mode.
  2. Upon selecting a label, a mask is generated to show which label was selected
  3. generating a mask triggers the allowedActionsProperty.disable()
  4. disable() remove the current set of allowed actions and replaces them with an empty set (i.e. no actions are allowed).
  5. Since we modified the allowedActionsProperty's contents, the aforementioned listener was triggered, and shape interpolation mode was exited.

The result of this bug is that shape-interpolation was not possible.

This PR resolves this bug. Since we don't want to exit interpolation mode during mask generation, we need to ensure that we are not in the process of enabling/disabling actions. If we are, then don't exit, since it is expected. If we are not enabling/disabling, then we want to proceed as usually, and exit interpolation mode.