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

Check if there is rotate handle, before update the rotate handles #1568

Merged
merged 2 commits into from
Feb 9, 2023

Conversation

juliaroldi
Copy link
Contributor

For some editing operations, the rotate handle are not rendered. Then we need to check if they exist, before we update them.

rotateCenter,
rotateHandle
);
if (rotateHandle && rotateCenter) {
Copy link
Contributor Author

@juliaroldi juliaroldi Feb 9, 2023

Choose a reason for hiding this comment

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

@BryanValverdeU I'm doing the check for the rotateHandle and rotateCenter here. If they do not exist the updateRotateHandlePosition will not be called.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh I see!
Can we also add to the null check this.editor.getVisibleViewport result? Since the ReturnType is Rect | null

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is a good observation. I'll add it 👍🏻

Copy link
Contributor

@BryanValverdeU BryanValverdeU Feb 9, 2023

Choose a reason for hiding this comment

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

Because if we do:

const top = rotateHandleRect.top - editorRect?.top;

and editorRect is null in Rotator.tsx top could endup being NaN

@juliaroldi juliaroldi merged commit dd5b1b1 into master Feb 9, 2023
@JiuqingSong JiuqingSong deleted the u/juliaroldi/unexpected-erros branch September 8, 2023 22:31
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