Skip to content

refactor: Don't use skew_ and translate_ attributes on SVGs to animate blocks.#6782

Merged
gonfunko merged 4 commits into
RaspberryPiFoundation:developfrom
gonfunko:block-animations
Jan 18, 2023
Merged

refactor: Don't use skew_ and translate_ attributes on SVGs to animate blocks.#6782
gonfunko merged 4 commits into
RaspberryPiFoundation:developfrom
gonfunko:block-animations

Conversation

@gonfunko
Copy link
Copy Markdown
Contributor

@gonfunko gonfunko commented Jan 18, 2023

The basics

  • I branched from develop
  • My pull request is against develop
  • My code follows the style guide
  • I ran npm run format and npm run lint

The details

Resolves

Fixes #6595

Proposed Changes

This change stops setting skew_ and translation_ attributes on SVGs for blocks. It introduces an internal getter for the translation, and stores it in a proper field on BlockSvg.

skew_ was only being set to a non-'' value in one place, and then immediately read back to set the transform. Instead, the transform is simply setting using the directly-calculated skew value, so there's no need to carry it around and clear it at other points.

WorkspaceCommentSvg also maintained the skew_ and translate_ attributes, but they appear to be vestigial from a long-ago copy-paste and not actually used, so they were removed.

@gonfunko gonfunko requested a review from a team as a code owner January 18, 2023 22:28
@gonfunko gonfunko requested a review from maribethb January 18, 2023 22:28
@gonfunko gonfunko changed the title Block animations refactor: Don't use skew_ and translate_ attributes on SVGs to animate blocks. Jan 18, 2023
@BeksOmega BeksOmega requested review from BeksOmega and removed request for maribethb January 18, 2023 22:36
Comment thread core/block_svg.ts
Comment thread core/block_animations.ts
Comment thread core/block_animations.ts Outdated
@gonfunko gonfunko merged commit 6cb2f72 into RaspberryPiFoundation:develop Jan 18, 2023
@gonfunko gonfunko deleted the block-animations branch January 18, 2023 23:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor block animations to not store data on SVG elements

3 participants