Skip to content

Conversation

@oegea
Copy link
Collaborator

@oegea oegea commented Aug 22, 2022

Molecule/ImageEditor

❓ Ask

Types of changes

  • ✨ New feature (non-breaking change which adds functionality)

Description, Motivation and Context

ImageEditor is currently calculating a new image every time the user makes zoom or rotates an image. Which, with a normal use, could happen between 50 and 100 times just by sliding the zoom or rotation slide.

This is causing a bad performance. Additionally, as we don't know which is the final calculated image, we're not sure when the save button of our web-app can be enabled to finish the process.

To solve this problematic, this proposal debounces the execution of some critical functions, to ensure that image is calculate just when needed.

Co-authored with @andresin87

Screenshots - Animations

There aren't visual changes.

@github-actions
Copy link

STATEMENTS BRANCHES FUNCTIONS LINES
≍ 0.08↓ ≍ 0= ≍ 0.05↑ ≍ 0.05↑
% 71.93 57.77 58.97 73.58
ABS 2599 / 3613 1464 / 2534 473 / 802 2505 / 3404

MoleculeImageEditor.displayName = 'MoleculeImageEditor'
MoleculeImageEditor.propTypes = {
aspect: PropTypes.number,
previewOnlyMode: PropTypes.bool,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
previewOnlyMode: PropTypes.bool,
isPreviewMode: PropTypes.bool,

or even

Suggested change
previewOnlyMode: PropTypes.bool,
isPreview: PropTypes.bool,

given they're boolean props. What do you think...?

Copy link
Contributor

@jordevo jordevo left a comment

Choose a reason for hiding this comment

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

good stuff 👏

as per our conversation, though, perhaps it's a bit too hacky and we may find a good use case for a debounce here...

@github-actions
Copy link

STATEMENTS BRANCHES FUNCTIONS LINES
≍ 0.03↑ ≍ 0= ≍ 0= ≍ 0=
% 72.04 57.77 58.92 73.71
ABS 2601 / 3610 1460 / 2527 472 / 801 2507 / 3401

@oegea oegea merged commit 482e902 into master Aug 23, 2022
@oegea oegea deleted the feat/image-editor-preview-before-save branch August 23, 2022 09:51
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.

5 participants