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 resize & fix staff rotation #1036

Merged
merged 1 commit into from
Jun 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions src/utils/Resize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ export function resize (element: SVGGraphicsElement, neonView: NeonView, dragHan
function drawInitialRect (): void {
if (element === null) return;

d3.selectAll('.resizePoint').remove();
d3.selectAll('#resizeRect').remove();
d3.selectAll('.rotatePoint').remove();

// if it's a boundingbox just get the coordinates
if (element.classList.contains('syl')) {
const rect = element.querySelector('.sylTextRect-display');
Expand Down Expand Up @@ -307,9 +311,6 @@ export function resize (element: SVGGraphicsElement, neonView: NeonView, dragHan
}
element = document.querySelector(`#${element.id}`);
ulx = undefined, uly = undefined, lrx = undefined, lry = undefined;
d3.selectAll('.resizePoint').remove();
d3.selectAll('#resizeRect').remove();
d3.selectAll('.rotatePoint').remove();
drawInitialRect();

if (element.classList.contains('syl')) {
Expand Down Expand Up @@ -417,11 +418,8 @@ export function resize (element: SVGGraphicsElement, neonView: NeonView, dragHan
element = document.getElementById(element.id) as unknown as SVGGraphicsElement;
ulx = undefined, uly = undefined, lrx = undefined, lry = undefined;
dy = undefined;
d3.selectAll('.resizePoint').remove();
d3.selectAll('#resizeRect').remove();
d3.selectAll('.rotatePoint').remove();
drawInitialRect();
selectAll([element], neonView, dragHandler);

if (element.classList.contains('syl')) {
selectBBox(element.querySelector('.sylTextRect-display'), dragHandler, this);
} else {
Expand Down