Skip to content
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

feat: make the marker ephemeral #187

Merged
merged 8 commits into from
Feb 6, 2025

Conversation

rachel-fenichel
Copy link
Contributor

@rachel-fenichel rachel-fenichel commented Feb 5, 2025

Part of #168
Part of #181

This change gets rid of the Marker object that we were using to mark where the cursor was before a jump to the toolbox or flyout.

That Marker was a variant on a Cursor, and there was no way to hide it once it had been shown.

In November and January we decided that the marker workflow was confusing, and that the marker should only be visible while actively inserting a block from the toolbox/flyout. In this context, the marker shows where the selected block will be inserted. The marker is then expected to disappear after the block is inserted.

Before this change, the marker stuck around after the new block was inserted. Calling hide on the marker didn't make it go away, because core Blockly redrew it during the next render pass.

Changes in this PR

  • Stop using the marker from core and its associated renderer.
  • Start calling the marked node "passively focused". The "active focus" is the cursor. The "passive focus" shows up when we move the cursor to a new context but want to show where it will return to.
  • Store the location of the passive focus in navigation.ts.
  • Add a new class, PassiveFocus, that renders passive focus at a specific location. This new class only keeps track of it location to let it hide later.
  • Implement passive focus show/hide functions for blocks and next connections.
  • Correctly show and hide the passive focus indicator when opening the toolbox/flyout.
  • Correctly hide the cursor when opening the flyout or toolbox for insertion.

@rachel-fenichel rachel-fenichel marked this pull request as ready for review February 6, 2025 17:28
@rachel-fenichel rachel-fenichel requested a review from a team as a code owner February 6, 2025 17:28
@rachel-fenichel rachel-fenichel requested review from gonfunko and removed request for a team February 6, 2025 17:28
@rachel-fenichel rachel-fenichel merged commit 1974c93 into google:main Feb 6, 2025
1 check passed
@rachel-fenichel rachel-fenichel deleted the saved_location branch February 6, 2025 17:45
@rachel-fenichel
Copy link
Contributor Author

Implications for testing changes to the marker and its rendering:

  • You can modify the appearance of the next connection indicator by applying CSS--the class is passiveNextIndicator.
  • You can change the shape of the next connection indicator by modifying the createNextIndicator function.
  • You can add indicators for other types of nodes by adding cases to passiveFocus.show and passiveFocus.hide that are parallel to the cases for the next indicator.
    • This can include creating new DOM elements for other cases. See createNextIndicator for an example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants