Skip to content

Conversation

amolenaar
Copy link
Member

PR Type

What kind of change does this PR introduce?

  • Bug fix
  • Feature
  • Chore (refactoring, formatting, local variables, other cleanup)
  • Documentation content changes

What is the current behavior?

Actions are always assigned to the first partition when dragging.

Issue Number: fixes #3050

What is the new behavior?

The partition below the mouse cursor is now found.

Other information

  • Add a bit of extra typing to the core collection class.
  • Added tests for State machine dropzone behavior.

So we only have to override one.
I think this is a nice example of what happens if you
do not build your software with TDD. It actually needs
a style sheet to work!
@amolenaar amolenaar requested a review from danyeaw March 30, 2024 20:14
@github-actions github-actions bot added the python Pull requests that update Python code label Mar 30, 2024
@amolenaar amolenaar changed the title Action on right partition Associate Action with right Partition Mar 30, 2024
@danyeaw danyeaw added fix A fix for a bug and removed python Pull requests that update Python code labels Mar 31, 2024
# Conflicts:
#	gaphor/diagram/tests/test_instanteditors.py
#	gaphor/diagram/tools/tests/conftest.py
@github-actions github-actions bot added the python Pull requests that update Python code label Mar 31, 2024
@danyeaw danyeaw removed the python Pull requests that update Python code label Mar 31, 2024
Copy link
Member

@danyeaw danyeaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @amolenaar, these changes look good. I gave it a spin and for me the first drop is still being associated with the first swimlane even if I drop it on the 2nd. When I select the action and release it, then it is associated with the 2nd one.

@amolenaar
Copy link
Member Author

amolenaar commented Apr 1, 2024

Ah, I only fixed it for moving actions from one partition to the other.

Did you drop from the model browser? There no grouping is implemented.

Did you drag from the toolbox?

I added a TODO for placement tool. Not sure yet how to do the grouping without duplicating the logic.

@github-actions github-actions bot added the python Pull requests that update Python code label Apr 1, 2024
@danyeaw
Copy link
Member

danyeaw commented Apr 1, 2024

Hi @amolenaar, I was dropping from the toolbox since I thought that would be the primary use case.

So we can use it to drop any element onto any other element.
Also add some pre-conditions and deal with placing an item outside of a
container.
@amolenaar
Copy link
Member Author

amolenaar commented Apr 1, 2024

I extended the use of drop() to also support dropping items on other items in a diagram. This simplifies the code, I think, since we only need one concept (drop) to handle items being placed on top of one another.

You can now create actions directly on a swim lane, and it's placed in the right swimlane.

Somehow this doesn't work that well for state machines. I have not been able to figure out why, yet.

@amolenaar amolenaar requested a review from danyeaw April 1, 2024 22:09
not via gaphor.modules imports.
So that nested states can still be properly placed afte an
`update_shape()` call.
@amolenaar
Copy link
Member Author

I updated the StateItem and StateMachineItem code, so that nested states can be properly placed in the right region.

The problem was that updates caused the shape to be recreated. As a result regions could not be determined.

@danyeaw
Copy link
Member

danyeaw commented Apr 3, 2024

@amolenaar Oh nice one! I haven't had a chance to look at the updates yet, but I should be able to make some time tomorrow to do one last review.

Copy link
Member

@danyeaw danyeaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really nice update to the drop zones @amolenaar!

@danyeaw danyeaw removed python Pull requests that update Python code documentation labels Apr 6, 2024
@danyeaw danyeaw merged commit ebee598 into main Apr 6, 2024
@danyeaw danyeaw deleted the action-in-partition branch April 6, 2024 01:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix A fix for a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

First activity partition gets all the nodes
2 participants