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

refactor!: Update flyouts to use inflaters. #8601

Merged
merged 7 commits into from
Oct 2, 2024

Conversation

gonfunko
Copy link
Contributor

The basics

The details

Resolves

Fixes #8546

Proposed Changes

This PR updates the base, horizontal and vertical flyout classes to use the newly introduced inflaters rather than hardcoding support for buttons/labels/blocks. As a result, it's now possible to add arbitrary elements of different types to flyouts.

Breaking Changes

This is a fairly extensive refactor, and makes several changes to the behavior of flyouts. At a high level, support for recycling blocks has been removed. This always required a subclass to enable, and is still achievable through subclassing, but the mostly-inaccessible code that partially supported it has been removed. The continuous toolbox plugin in blockly-samples, which did use recycling, will be updated to implement it using the new API.

Additionally, the backing mats/rects placed behind blocks in the flyout have been removed. These were used to fill in the gaps in C-shaped blocks or empty inputs to allow initiating block drags even when not clicking on the actual block, but instead in one of its voids. This behavior is inconsistent with the main workspace, and was mostly a workaround for not having shadow blocks, which are largely a better solution to this problem.

At an API level, the following have been adjusted:

  • The FlyoutItemType enum has been removed, since flyout items may now be of arbitrary types.
  • The protected method Flyout.layout_ no longer takes the second gaps argument. Flyouts no longer maintain separate lists of gaps and content; instead, there is one list of content, which may include elements representing gaps.
  • The protected Flyout.buttons_ field has been removed, along with the protected Flyout.initFlyoutButton_() and Flyout.addBlockListeners_() methods. Flyouts are now agnostic as to their contents, so special handling for special types of items is now unneeded.
  • The protected Flyout.rectMap_ field, along with the protected Flyout.createRect_() and Flyout.moveRectToBlock_() methods have been removed. Flyouts no longer include backing rects for blocks.
  • The protected Flyout.blockIsRecyclable_() method has been removed, since recycling support has been removed from core.
  • The FlyoutItem interface has been adjusted to remove the block and button fields, and replace them with an element field of type IBoundedElement. The type field remains, and may be used to distinguish the types of individual flyout elements.

@gonfunko gonfunko requested a review from a team as a code owner September 27, 2024 21:48
@github-actions github-actions bot added breaking change Used to mark a PR or issue that changes our public APIs. PR: refactor labels Sep 27, 2024
core/flyout_base.ts Show resolved Hide resolved
core/flyout_base.ts Outdated Show resolved Hide resolved
core/flyout_base.ts Show resolved Hide resolved
core/flyout_base.ts Outdated Show resolved Hide resolved
core/flyout_base.ts Outdated Show resolved Hide resolved
core/flyout_base.ts Show resolved Hide resolved
core/flyout_base.ts Outdated Show resolved Hide resolved
@gonfunko gonfunko merged commit e777086 into google:rc/v12.0.0 Oct 2, 2024
7 checks passed
@gonfunko gonfunko deleted the flyout-inflaters branch October 2, 2024 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change Used to mark a PR or issue that changes our public APIs. PR: refactor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants