-
Notifications
You must be signed in to change notification settings - Fork 166
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
cmd+dragging a view / element / component causes unpredictable behaviours based on parent layout mode #69
Comments
(I'm on the phone with Malte) Spike 1 for a possible solution would be to make sure that we can make a "screenshot" of the dragged element, and only the dragged element (do not include things that are visually below it or over it etc). |
I was just having a look at this to see how simple that proposal would be, and I think this is a bigger problem than that proposal would solve. So the underlying issue here is that sometimes we don't want the rendered controls to map 1-to-1 with the outcome, and sometimes in those cases we also want the rendered controls to include a version of the thing being updated. So some example cases:
IMO what we had in legacy partially solved the first two (I'd say we should also adjust the opacity of the dragged thing if the result doesn't match the controls 1-to-1), but not the second. Is this worth further discussion before someone undertakes that spike? |
I'll fill in some more things from the discussion with @balazsbajorics here, and then separately comment on @Rheeseyb your (super helpful) notes. The core issue is precisely that dragging gives you two things that are mutually incompatible:
(1) is direct manipulation, (2) is instant feedback. For design tools, they often go hand in hand, because very few situations will manipulate, transform, hide, or swallow things you're dragging. For us, they diverge - especially with components and styles-that-apply-to-children (transforms, opacity). However, the solution is on one level quite straightforward, and pretty much what we did previously: show a placeholder and extra controls for (2), show the real element for (1), and after letting go use an animation to make the two converge. -- In theory we could do it the other way 'round (a placeholder that follows the mouse, the real thing moving in and out of containers. We previously didn't do this because (IIRC) of perf concerns. And: it doesn't need to be perfect. In particular, one of the two does not need to be real or realistic, or even fast - as long as the other is. E.g. Previously we made the placeholder a pink rectangle - almost a "shadow" of the real element - and that worked well because the real element tracked the mouse with very high speed (fueled by our tears of rage, I'm sure you remember / have suppressed this :). |
I have a branch with this partially solved ( |
Change of plan. I have opened a PR to cover the work from that branch. We will re-address the remaining issues as part of an upcoming process of experimenting with various canvas controls. |
Problem
"I tried moving this div with CMD like you said, but it's not moving"
Root cause
The div in question was in another div, which didn't have a layout type enabled. As a result, it behaved like a flow layout. In a flow layout, at most you can reorder (and not even that if there's a generated element elsewhere in the flow). Otherwise the element stays put until you've moved it out fully. If you're moving it into another flow (or flex) layout, it can give the impression it's still "stuck"
Analysis
In almost any design tool, cmd+drag gives you free-form control over the element you're dragging. We used to do that as well. This meant that you were getting the feedback "I'm moving this thing", with what happens to it (because of layout system etc becoming a separate thing). However, this either regressed or broke. As a consequence, a view inside a flow layout, flex layout, or pinned absolutely, will behave radically differently but with little to nothing on the canvas to tell you that. It also means that during a reparent you get weird or unpredictable behaviours. But most importantly, it gives the impression the editor is "broken", "laggy", "not behaving well".
Proposed solution
(Please discuss in #feature-layout before implementing a solution)
The text was updated successfully, but these errors were encountered: