From 36de97ff699b871a454460b64d3ee87cf6b39234 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Mon, 26 Jun 2023 16:10:32 -0400 Subject: [PATCH] Refactor resize & fix staff rotation --- src/utils/Resize.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/utils/Resize.ts b/src/utils/Resize.ts index 18a06574..0780477a 100644 --- a/src/utils/Resize.ts +++ b/src/utils/Resize.ts @@ -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'); @@ -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')) { @@ -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 {