Stopping a transition after it has begun

In order to dim the light using a zigbee button switch (which can register both when you press down the button and also when you release it) I need to be able to stop the dimming command after it has begun and have the light not reset the light to the properties it had before the transition.

When I use the stop color flow function it just sets the light to whatever properties it was from the beginning.

What I want is something like:
In pseudo code:

if brightness == 1:
    if button_down:
       start_dimming(to_full_brightness)

if button_up:
  stop dimming()
  if brighness < 100:
      print( 'Brightness is now more then when it started but not full brightness' )

Is this possible somehow?