fix(editor): scale clicking sound missing

This commit is contained in:
maelstrom 2025-07-01 14:39:57 +02:00
parent fea837a29c
commit ce851aaa5e
2 changed files with 6 additions and 2 deletions

View file

@ -94,7 +94,7 @@ void PartAssembly::Scale(Vector3 newSize, bool scaleUp) {
parts[0]->size = newSize;
parts[0]->UpdateProperty("Size");
sendPropertyUpdatedSignal(parts[0], "Size", Variant(parts[0]->size));
_bounds = newSize;
_size = _bounds = newSize;
return;
}
@ -116,7 +116,7 @@ void PartAssembly::Scale(Vector3 newSize, bool scaleUp) {
sendPropertyUpdatedSignal(part, "Size", Variant(part->size));
}
_bounds = _bounds * factor;
_size = _bounds = _bounds * factor;
}
std::vector<PartTransformState> PartAssembly::GetCurrentTransforms() {

View file

@ -226,6 +226,7 @@ void MainGLWidget::handleLinearTransform(QMouseEvent* evt) {
if (editorToolHandles.handlesType == MoveHandles) {
selectionAssembly.TransformBy(CFrame() + absDiff);
} else if (editorToolHandles.handlesType == ScaleHandles) {
Vector3 oldSize = selectionAssembly.size();
if (evt->modifiers() & Qt::AltModifier) {
// If size gets too small, don't
if (glm::any(glm::lessThan(glm::vec3(selectionAssembly.size() + abs(draggingHandle->normal) * diff * 2.f), glm::vec3(0.001f))))
@ -240,6 +241,9 @@ void MainGLWidget::handleLinearTransform(QMouseEvent* evt) {
selectionAssembly.TransformBy(CFrame() + absDiff * 0.5f);
selectionAssembly.Scale(selectionAssembly.size() + abs(draggingHandle->normal) * diff, diff > 0);
}
if (snappingFactor() > 0 && oldSize != selectionAssembly.size() && mainWindow()->editSoundEffects && QFile::exists("./assets/excluded/switch.wav"))
playSound("./assets/excluded/switch.wav");
}
}