enso-org / enso

Hybrid visual and textual functional programming.
https://enso.org
Apache License 2.0
7.34k stars 320 forks source link

User can edit edges and other components at the same time #7018

Closed kazcw closed 6 months ago

kazcw commented 1 year ago

Discord username

No response

What type of issue is this?

Permanent – Occurring repeatably

Is this issue blocking you from using Enso?

Is this a regression?

What issue are you facing?

We currently allow a state where a detached edge is following the mouse, and the cursor is editing a node's expression at the same time. This kind of state can be reached in two different ways:

  1. If there is a detached edge, and the user begins editing a node (e.g. with Ctrl+Click). Fixed in #6991.
  2. If the user is editing a node, and they click on any node's output port.

Additionally, there is a case where one action will connect an edge and begin a (conflicting) expression edit:

  1. When there is an edge with a detached target, and the user Ctrl+Clicks on a port, we connect the port and begin editing the expression. (Details here: https://github.com/enso-org/enso/pull/6991#issuecomment-1591273972)

Expected behaviour

I think this "multitasking" is probably not desirable--the user probably never intends to edit an edge and a node expression simultaneously.

Proposed changes:

  1. Clear all detached edges when the user begins editing a node.
  2. If an output port is clicked clicked, commit the current expression edit before creating a new (detached) edge.
  3. Drop the edge instead of connecting it.

How we can reproduce it?

No response

Screenshots or screencasts

Case 1 Case 2

Logs

No response

Enso Version

develop

Browser or standalone distribution

Standalone distribution (local project)

Browser Version or standalone distribution

standalone

Operating System

Linux

Operating System Version

No response

Hardware you are using

No response

kazcw commented 1 year ago

I have a fix for Case 1 in #6991, so this bug tracks fixing Case 2.

kazcw commented 1 year ago

Added case 3 to this bug, because it's a similar problem.

kazcw commented 1 year ago

Case 4: Detached edges can coexist with FS viz, with interesting results: image

Handling this in general

The current approach of explicitly clearing detached edges in response to certain events is fragile; we can easily miss cases, and if we use that approach to fix every known case it will add up to a lot of complexity. I think the ideal solution for all the different cases of conflicting actions is to build on the new exclusive-focus API. If we have a display object that acts as the focus receiver for all detached edges, we can listen for its defocus event and clear all detached edges if anything takes focus. Then, it's a matter of ensuring focus is captured by whatever action is the single current action (expression edit, FS viz, detached edges, etc).

farmaazon commented 6 months ago

The issues seem to be fixed in new GUI: any click outside CB now closes it, ctrl+click at port does not connect.

I'm not sure how to make fullscreen viz while having detached edge. To be checked once shortcut for fullscreen viz will land.