Closed sadespresso closed 7 months ago
This is what I need for my project, For now I used @sadespresso fork and hopefully merged with the package. Thank you @rasitayaz & @sadespresso!!
Okay, lemme do that and send you review request again :D :D
So, I've updated the code per your recommendations, and they look quite great!
When alwaysPlaceActionFromCenter
is true, the attachMenu
sets _pointerOffset
.
Upon pointer up, it dismisses the menu only if the pointer fails menu hit test.
Tested, and confirmed that the new implementation works the same as before.
what's the purpose of hit test?
Because _pointerOffset is artificially moved to the center of the menu button, it makes '_isBeyondPointerBounds' behave incorrectly.
As I understand, a simple tap should leave the menu open. A drag triggers action only if the pointer is on the action, and dismissed the menu otherwise.
Putting hit test on the menu button ensures the behaviors mentioned above to work correctly.
If we remove the hit test, a simple tap will just dismiss the menu, and dragging to an action will not trigger the action; requiring an additional tap. which i believe, isn't the expected behavior
Instead of hit test, we can get the original pointer position and do distance check like one in the _isBeyondPointerBounds
thank you, I'll take it from here. I might introduce alignment and offset variables instead of alwaysPlaceActionFromCenter
to expand this feature.
Fixes #50
This PR adds
alwaysPlaceActionFromCenter
option toPieTheme
, default tofalse
. When set totrue
forcesPieMenu
to be rendered from the center of thechild
. Especially useful when usingPieMenu
with small buttons, such asFloatingActionButton
.When
alwaysPlaceActionFromCenter = false
:When
alwaysPlaceActionFromCenter = true
:Not a breaking change, everything will continue to work as before
Tested on Android, iOS, Linux