Skip to content

Commit

Permalink
Refactor resize & fix staff rotation
Browse files Browse the repository at this point in the history
  • Loading branch information
yinanazhou committed Jun 26, 2023
1 parent cabef5a commit 36de97f
Showing 1 changed file with 5 additions and 7 deletions.
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

0 comments on commit 36de97f

Please sign in to comment.