Skip to content

Commit

Permalink
bug(Select): Fix delay on resize and rotate UI indicators [dev]
Browse files Browse the repository at this point in the history
  • Loading branch information
Kruptein authored Nov 12, 2024
1 parent cb47214 commit ef68cb7
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions client/src/game/tools/variants/select/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -551,21 +551,17 @@ class SelectTool extends Tool implements ISelectTool {
event !== undefined && ctrlOrCmdPressed(event),
true,
);
this.updateCursor(gp, features);
} else if (this.mode === SelectOperations.Rotate) {
const center = this.rotationBox!.center;
const newAngle = -Math.atan2(center.y - gp.y, gp.x - center.x) + Math.PI / 2;
this.rotateSelection(newAngle, center, true);
} else {
this.updateCursor(gp, features);
}
// We also sync in onUp, which always runs,
// however when we click and immediately drag a shape,
// the selection won't appear until the onUp if we don't sync here as well
this.syncSelection();
} else {
document.body.style.cursor = "default";
}
this.updateCursor(gp, features);
}

async onUp(
Expand Down Expand Up @@ -886,7 +882,7 @@ class SelectTool extends Tool implements ISelectTool {
createRotationUi(features: ToolFeatures<SelectFeatures>): void {
const layer = floorState.currentLayer.value!;

const layerSelection = selectedSystem.get({ includeComposites: false });
const layerSelection = this.currentSelection;

if (layerSelection.length === 0 || this.rotationUiActive || !this.hasFeature(SelectFeatures.Rotate, features))
return;
Expand Down

0 comments on commit ef68cb7

Please sign in to comment.