Skip to content

Align cdoFieldImageDropdown columns with field_rectangular_dropdown - #51189

Merged
molly-moen merged 1 commit into
stagingfrom
molly/blockly-dropdown-columns
Apr 7, 2023
Merged

Align cdoFieldImageDropdown columns with field_rectangular_dropdown#51189
molly-moen merged 1 commit into
stagingfrom
molly/blockly-dropdown-columns

Conversation

@molly-moen

Copy link
Copy Markdown
Contributor

We recently updated the blockly repo to calculate the number of columns in a field_rectangular_dropdown (for example, the backgrounds dropdown): https://github.com/code-dot-org/blockly/pull/308/files . This PR aligns the google blockly version of this to use the same calculation.

(Screenshots include the backgrounds tab experiment turned on)

Before

Screenshot 2023-04-06 at 3 30 40 PM

After

Screenshot 2023-04-06 at 3 32 32 PM

Links

Testing story

Tested locally.

PR Checklist:

  • Tests provide adequate coverage
  • Privacy and Security impacts have been assessed
  • Code is well-commented
  • New features are translatable or updates will not break translations
  • Relevant documentation has been added or updated
  • User impact is well-understood and desirable
  • Pull Request is labeled appropriately
  • Follow-up work items (including potential tech debt) are tracked and linked

@molly-moen
molly-moen requested a review from a team April 6, 2023 22:36
: Math.floor(Math.sqrt(initialOptions.length));
const numColumns = Math.max(
4,
Math.floor(Math.sqrt(initialOptions.length))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious - is it a standard practice to compute the # of cols using Math.sqrt?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are doing that to keep it approximately square shaped. Logic in the cdo-block repo that I am reproducing is here

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@molly-moen
molly-moen merged commit 6f2196b into staging Apr 7, 2023
@molly-moen
molly-moen deleted the molly/blockly-dropdown-columns branch April 7, 2023 19:35
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.

3 participants