-
-
Notifications
You must be signed in to change notification settings - Fork 247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Model editor: Drag and drop #2970
base: main
Are you sure you want to change the base?
Conversation
That's super cool. |
#2867 Bundle Size — 11.02MiB (+0.25%).0f229a1(current) vs cceb442 main#2835(baseline) Warning Bundle contains 2 duplicate packages – View duplicate packages Bundle metrics
Bundle size by type
Bundle analysis report Branch mherwege:model_drag_drop Project dashboard Generated by RelativeCI Documentation Report issue |
Indeed and I can't imagine openHAB 5 without it :) |
First comment from watching the GIFs alone would be to make sure there's a confirm message for every drag and drop as it might be too easy to screw up and make an involuntary change. This could be an additional dialog or a Cancel button to the existing ones - like the one asking whether to add an Equipment or a Point. |
I have added some confirmation dialogs. |
From my perspective, this is ready for review and testing by others. |
@ghys Do you want to review? |
@florian-h05 yeah if you don't mind, this is personal for me (like the log viewer) since I always wanted to do it but never got around to it. So I'm glad it got implemented by @mherwege and I'll take care of this one and get it done. |
@mherwege I'm testing it and unfortunately I do have a major remark which IMO is a must fix... The tree view now adds arrows/chevrons besides items even if they don't have children, it's super confusing: This leads to unnecessary clicks on them because you'd think there's something to expand when there's not. Actually it's the case for the sitemap tree view now too (I missed it). I think it should be fixed because it leads to confusion for example: Since the Text widget here is an "expanded empty group" we could easily think the Switch is one of its children, when it's actually on the same level as a child of the Frame. It is possible to at least show those after you've started the drag operation only (so you can insert into an empty group)? |
Regression from openhab#2904. Reported in openhab#2970 (comment). Signed-off-by: Florian Hotze <[email protected]>
Fixed in #3007. |
Yes, fair enough. And it looks like @florian-h05 already found a fix for it in the sitemap editor. I will look into doing something similar here, but need to find some time for doing it. It doesn't look to be a major change, so should be easy enough to include without changing everything. I don't think it should impact other review comments you may have. |
I created a fix in this PR. |
Regression from #2904. Reported in #2970 (comment). Signed-off-by: Florian Hotze <[email protected]>
@ghys Can you please have another look at this? |
Signed-off-by: Mark Herwege <[email protected]>
Signed-off-by: Mark Herwege <[email protected]>
Signed-off-by: Mark Herwege <[email protected]>
Signed-off-by: Mark Herwege <[email protected]>
Signed-off-by: Mark Herwege <[email protected]>
@jimtng I think ESC now works. |
Signed-off-by: Mark Herwege <[email protected]>
@jimtng Can you check if the latest is more performant for you? I believe I improved it somewhat (without being perfect). |
Signed-off-by: Mark Herwege <[email protected]>
There seem to be a significant improvement in certain parts of the operation. |
Not much I can work with. If you have the development tools open, you should have quite extensive debug logging in the console. That would at least pinpoint where it is at when this happens. |
Signed-off-by: Mark Herwege <[email protected]>
BTW The performance is great after the last commit. I haven't noticed any sluggishness / delays so far. Thanks for your work, well done! |
Signed-off-by: Mark Herwege <[email protected]>
Indeed, I believe that should be fixed.
I am considering removing it. I just need to make sure I then don't loose anything if it was manually set and you start moving things around. |
Maybe just do a warning if a point was originally in both equipment + location But if a point only belongs to either equipment or location but not both, then move them as usual without retaining the original parent nor prompting about it. |
Signed-off-by: Mark Herwege <[email protected]>
I implemented this suggestion. |
I encountered another issue that didn't happen on It looks like at some point, a drag start was (mistakenly) triggered. I wasn't intentionally trying to drag at all in here. But that dragstart might've been the trigger that caused the inability to select any other items in the model. |
Signed-off-by: Mark Herwege <[email protected]>
Yes, I noticed this as well. I had put in some logic not to open the details when dragging, as this inadvertently happened without this, but missed the case when there is no move in the end. I fixed that. |
With the latest update, I no longer experience "frozen" selection. But sometimes I still noticed "glitchy" item as I was clicking around (selecting different items). It looked like the item was about to be dragged, so it moved a bit, even though I wasn't trying to drag. Maybe it's a bit too sensitive? Is there some sort of "mouse down and move a minimum of X pixels before it's considered a dragstart"? I'm not sure if this is the cause, so I'm just making a guess here. |
Signed-off-by: Mark Herwege <[email protected]>
Signed-off-by: Mark Herwege <[email protected]>
That's indeed the reason. I just changed it to have some move threshold. |
An editable item should be allowed to be dropped in a non-editable semantic group, as the changes will only need to be persisted for the item, not the group you drop into. But I need to think this through in more detail, as I have not spent much time on this corner case.
I tried to make this more dynamic at one point, but failed, so settled for a warning. I can try again. A warning is still better than silently reverting in my view. |
Signed-off-by: Mark Herwege <[email protected]>
It doesn't allow dropping now where not allowed. It would allow dropping a managed item into a non-managed group, which I believe should be possible. I also added a 1s delay in group opening, so you can move over a group without it being opened if you do not want to drop inside of it. While this may be an improvement, I am still not 100% convinced about this. First, I didn't succeed in changing the cursor. Second, if you move over a place where you can drop and then a place where you cannot, it will drop in the last place where it could drop. And that may be well away from the current cursor position. EDIT: the second point is solved. |
Signed-off-by: Mark Herwege <[email protected]>
Signed-off-by: Mark Herwege <[email protected]>
@jimtng I have spent a lot of time trying to change the cursor when moving over an item where drop is not allowed. At the moment, it will not drop and revert (without a message), but the cursor does not change. I have tried many things, but couldn't find a solution. Looking at the issues and discussions online, it looks like many people are not able to successfully do this. I give up on this aspect. |
Closes #2728
Closes #969
Allow drag and drop in the model view:
This PR requires further testing, but I do want to already provide it for others to start evaluating, as there is a fair amount of change. I probably have missed some boundary cases of changes in the model that are or are not possible.
Edit: I have tested this on different devices, and from my perspective, it works well. But again, I may have missed something. Therefore I would appreciate others to test.
I have put extensive debug logging into the code to be able to debug potential issues.
Here are a few gifs of what it looks like: